public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V4 1/3] FAT: remove cur_part_nr
@ 2012-10-17 16:44 Stephen Warren
  2012-10-17 16:44 ` [U-Boot] [PATCH V4 2/3] FAT: initialize all fields in cur_part_info, simplify init Stephen Warren
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stephen Warren @ 2012-10-17 16:44 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

A future patch will implement the more standard filesystem API
fat_set_blk_dev(). This API has no way to know which partition number
the partition represents. Equally, future DM rework will make the
concept of partition number harder to pass around.

So, simply remove cur_part_nr from fat.c; its only use is in a
diagnostic printf, and the context where it's printed should make it
obvious which partition is referred to anyway (since the partition ID
would come from the user command-line that caused it).

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v4: New patch: Dropped addition of part number of disk_partition_t, and
replaced it with this patch.
---
 fs/fat/fat.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 80156c8..b038baf 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -46,7 +46,6 @@ static void downcase(char *str)
 }
 
 static block_dev_desc_t *cur_dev;
-static unsigned int cur_part_nr;
 static disk_partition_t cur_part_info;
 
 #define DOS_BOOT_MAGIC_OFFSET	0x1fe
@@ -77,10 +76,8 @@ int fat_register_device(block_dev_desc_t * dev_desc, int part_no)
      defined(CONFIG_SYSTEMACE) )
 
 	/* Read the partition table, if present */
-	if (!get_partition_info(dev_desc, part_no, &cur_part_info)) {
+	if (!get_partition_info(dev_desc, part_no, &cur_part_info))
 		cur_dev = dev_desc;
-		cur_part_nr = part_no;
-	}
 #endif
 
 	/* Otherwise it might be a superfloppy (whole-disk FAT filesystem) */
@@ -92,7 +89,6 @@ int fat_register_device(block_dev_desc_t * dev_desc, int part_no)
 		}
 
 		cur_dev = dev_desc;
-		cur_part_nr = 1;
 		cur_part_info.start = 0;
 		cur_part_info.size = dev_desc->lba;
 		cur_part_info.blksz = dev_desc->blksz;
@@ -1235,8 +1231,7 @@ int file_fat_detectfs(void)
 	vol_label[11] = '\0';
 	volinfo.fs_type[5] = '\0';
 
-	printf("Partition %d: Filesystem: %s \"%s\"\n", cur_part_nr,
-		volinfo.fs_type, vol_label);
+	printf("Filesystem: %s \"%s\"\n", volinfo.fs_type, vol_label);
 
 	return 0;
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-26  3:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 16:44 [U-Boot] [PATCH V4 1/3] FAT: remove cur_part_nr Stephen Warren
2012-10-17 16:44 ` [U-Boot] [PATCH V4 2/3] FAT: initialize all fields in cur_part_info, simplify init Stephen Warren
2012-10-17 16:44 ` [U-Boot] [PATCH V4 3/3] FAT: implement fat_set_blk_dev(), convert cmd_fat.c Stephen Warren
2012-10-17 17:12   ` Benoît Thébaudeau
2012-10-26  3:29 ` [U-Boot] [PATCH V4 1/3] FAT: remove cur_part_nr Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox