nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
Blob Blame History Raw
From 6e7405adb0dacbc8a7424b777cdc1106ac44182e Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 28 Feb 2013 10:50:01 +0100
Subject: [PATCH 167/482] 	* grub-core/fs/minix.c: Remove nested
 functions.

---
 ChangeLog            |  4 ++++
 grub-core/fs/minix.c | 41 ++++++++++++++++++++---------------------
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 206a094..056de9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
 
+	* grub-core/fs/minix.c: Remove nested functions.
+
+2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
+
 	* grub-core/fs/iso9660.c: Remove nested functions.
 
 2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c
index 918fe56..225770a 100644
--- a/grub-core/fs/minix.c
+++ b/grub-core/fs/minix.c
@@ -178,6 +178,20 @@ static grub_dl_t my_mod;
 static grub_err_t grub_minix_find_file (struct grub_minix_data *data,
 					const char *path);
 
+  /* Read the block pointer in ZONE, on the offset NUM.  */
+static grub_minix_uintn_t
+grub_get_indir (struct grub_minix_data *data, 
+		 grub_minix_uintn_t zone,
+		 grub_minix_uintn_t num)
+{
+  grub_minix_uintn_t indirn;
+  grub_disk_read (data->disk,
+		  GRUB_MINIX_ZONE2SECT(zone),
+		  sizeof (grub_minix_uintn_t) * num,
+		  sizeof (grub_minix_uintn_t), (char *) &indirn);
+  return grub_minix_to_cpu_n (indirn);
+}
+
 static grub_minix_uintn_t
 grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
 {
@@ -185,21 +199,6 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
   const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ
 					/ GRUB_MINIX_INODE_BLKSZ (data));
 
-  auto grub_minix_uintn_t grub_get_indir (grub_minix_uintn_t,
-					  grub_minix_uintn_t);
-
-  /* Read the block pointer in ZONE, on the offset NUM.  */
-  grub_minix_uintn_t grub_get_indir (grub_minix_uintn_t zone,
-				     grub_minix_uintn_t num)
-    {
-      grub_minix_uintn_t indirn;
-      grub_disk_read (data->disk,
-		      GRUB_MINIX_ZONE2SECT(zone),
-		      sizeof (grub_minix_uintn_t) * num,
-		      sizeof (grub_minix_uintn_t), (char *) &indirn);
-      return grub_minix_to_cpu_n (indirn);
-    }
-
   /* Direct block.  */
   if (blk < GRUB_MINIX_INODE_DIR_BLOCKS)
     return GRUB_MINIX_INODE_DIR_ZONES (data, blk);
@@ -208,7 +207,7 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
   blk -= GRUB_MINIX_INODE_DIR_BLOCKS;
   if (blk < block_per_zone)
     {
-      indir = grub_get_indir (GRUB_MINIX_INODE_INDIR_ZONE (data), blk);
+      indir = grub_get_indir (data, GRUB_MINIX_INODE_INDIR_ZONE (data), blk);
       return indir;
     }
 
@@ -216,10 +215,10 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
   blk -= block_per_zone;
   if (blk < block_per_zone * block_per_zone)
     {
-      indir = grub_get_indir (GRUB_MINIX_INODE_DINDIR_ZONE (data),
+      indir = grub_get_indir (data, GRUB_MINIX_INODE_DINDIR_ZONE (data),
 			      blk / block_per_zone);
 
-      indir = grub_get_indir (indir, blk % block_per_zone);
+      indir = grub_get_indir (data, indir, blk % block_per_zone);
 
       return indir;
     }
@@ -229,10 +228,10 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
   if (blk < ((grub_uint64_t) block_per_zone * (grub_uint64_t) block_per_zone
 	     * (grub_uint64_t) block_per_zone))
     {
-      indir = grub_get_indir (grub_minix_to_cpu_n (data->inode.triple_indir_zone),
+      indir = grub_get_indir (data, grub_minix_to_cpu_n (data->inode.triple_indir_zone),
 			      (blk / block_per_zone) / block_per_zone);
-      indir = grub_get_indir (indir, (blk / block_per_zone) % block_per_zone);
-      indir = grub_get_indir (indir, blk % block_per_zone);
+      indir = grub_get_indir (data, indir, (blk / block_per_zone) % block_per_zone);
+      indir = grub_get_indir (data, indir, blk % block_per_zone);
 
       return indir;
     }
-- 
1.8.2.1