nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0167-grub-core-fs-minix.c-Remove-nested-functions.patch

f96e0b
From 6e7405adb0dacbc8a7424b777cdc1106ac44182e Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Thu, 28 Feb 2013 10:50:01 +0100
f96e0b
Subject: [PATCH 167/482] 	* grub-core/fs/minix.c: Remove nested
f96e0b
 functions.
f96e0b
f96e0b
---
f96e0b
 ChangeLog            |  4 ++++
f96e0b
 grub-core/fs/minix.c | 41 ++++++++++++++++++++---------------------
f96e0b
 2 files changed, 24 insertions(+), 21 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index 206a094..056de9d 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,5 +1,9 @@
f96e0b
 2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
+	* grub-core/fs/minix.c: Remove nested functions.
f96e0b
+
f96e0b
+2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
 	* grub-core/fs/iso9660.c: Remove nested functions.
f96e0b
 
f96e0b
 2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c
f96e0b
index 918fe56..225770a 100644
f96e0b
--- a/grub-core/fs/minix.c
f96e0b
+++ b/grub-core/fs/minix.c
f96e0b
@@ -178,6 +178,20 @@ static grub_dl_t my_mod;
f96e0b
 static grub_err_t grub_minix_find_file (struct grub_minix_data *data,
f96e0b
 					const char *path);
f96e0b
 
f96e0b
+  /* Read the block pointer in ZONE, on the offset NUM.  */
f96e0b
+static grub_minix_uintn_t
f96e0b
+grub_get_indir (struct grub_minix_data *data, 
f96e0b
+		 grub_minix_uintn_t zone,
f96e0b
+		 grub_minix_uintn_t num)
f96e0b
+{
f96e0b
+  grub_minix_uintn_t indirn;
f96e0b
+  grub_disk_read (data->disk,
f96e0b
+		  GRUB_MINIX_ZONE2SECT(zone),
f96e0b
+		  sizeof (grub_minix_uintn_t) * num,
f96e0b
+		  sizeof (grub_minix_uintn_t), (char *) &indirn);
f96e0b
+  return grub_minix_to_cpu_n (indirn);
f96e0b
+}
f96e0b
+
f96e0b
 static grub_minix_uintn_t
f96e0b
 grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
f96e0b
 {
f96e0b
@@ -185,21 +199,6 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
f96e0b
   const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ
f96e0b
 					/ GRUB_MINIX_INODE_BLKSZ (data));
f96e0b
 
f96e0b
-  auto grub_minix_uintn_t grub_get_indir (grub_minix_uintn_t,
f96e0b
-					  grub_minix_uintn_t);
f96e0b
-
f96e0b
-  /* Read the block pointer in ZONE, on the offset NUM.  */
f96e0b
-  grub_minix_uintn_t grub_get_indir (grub_minix_uintn_t zone,
f96e0b
-				     grub_minix_uintn_t num)
f96e0b
-    {
f96e0b
-      grub_minix_uintn_t indirn;
f96e0b
-      grub_disk_read (data->disk,
f96e0b
-		      GRUB_MINIX_ZONE2SECT(zone),
f96e0b
-		      sizeof (grub_minix_uintn_t) * num,
f96e0b
-		      sizeof (grub_minix_uintn_t), (char *) &indirn);
f96e0b
-      return grub_minix_to_cpu_n (indirn);
f96e0b
-    }
f96e0b
-
f96e0b
   /* Direct block.  */
f96e0b
   if (blk < GRUB_MINIX_INODE_DIR_BLOCKS)
f96e0b
     return GRUB_MINIX_INODE_DIR_ZONES (data, blk);
f96e0b
@@ -208,7 +207,7 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
f96e0b
   blk -= GRUB_MINIX_INODE_DIR_BLOCKS;
f96e0b
   if (blk < block_per_zone)
f96e0b
     {
f96e0b
-      indir = grub_get_indir (GRUB_MINIX_INODE_INDIR_ZONE (data), blk);
f96e0b
+      indir = grub_get_indir (data, GRUB_MINIX_INODE_INDIR_ZONE (data), blk);
f96e0b
       return indir;
f96e0b
     }
f96e0b
 
f96e0b
@@ -216,10 +215,10 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
f96e0b
   blk -= block_per_zone;
f96e0b
   if (blk < block_per_zone * block_per_zone)
f96e0b
     {
f96e0b
-      indir = grub_get_indir (GRUB_MINIX_INODE_DINDIR_ZONE (data),
f96e0b
+      indir = grub_get_indir (data, GRUB_MINIX_INODE_DINDIR_ZONE (data),
f96e0b
 			      blk / block_per_zone);
f96e0b
 
f96e0b
-      indir = grub_get_indir (indir, blk % block_per_zone);
f96e0b
+      indir = grub_get_indir (data, indir, blk % block_per_zone);
f96e0b
 
f96e0b
       return indir;
f96e0b
     }
f96e0b
@@ -229,10 +228,10 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
f96e0b
   if (blk < ((grub_uint64_t) block_per_zone * (grub_uint64_t) block_per_zone
f96e0b
 	     * (grub_uint64_t) block_per_zone))
f96e0b
     {
f96e0b
-      indir = grub_get_indir (grub_minix_to_cpu_n (data->inode.triple_indir_zone),
f96e0b
+      indir = grub_get_indir (data, grub_minix_to_cpu_n (data->inode.triple_indir_zone),
f96e0b
 			      (blk / block_per_zone) / block_per_zone);
f96e0b
-      indir = grub_get_indir (indir, (blk / block_per_zone) % block_per_zone);
f96e0b
-      indir = grub_get_indir (indir, blk % block_per_zone);
f96e0b
+      indir = grub_get_indir (data, indir, (blk / block_per_zone) % block_per_zone);
f96e0b
+      indir = grub_get_indir (data, indir, blk % block_per_zone);
f96e0b
 
f96e0b
       return indir;
f96e0b
     }
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b