From: Donggeun Kim Date: Mon, 27 Dec 2010 06:32:45 +0000 (+0900) Subject: fat: get partition size from current partition rather than next partition info X-Git-Tag: v0.2~98 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7683fcce3586d6396d73701f45b6756202199302;p=kernel%2Fu-boot.git fat: get partition size from current partition rather than next partition info Signed-off-by: Donggeun Kim --- diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 77d8693..11bc254 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -45,7 +45,7 @@ static void downcase (char *str) static block_dev_desc_t *cur_dev = NULL; static unsigned long part_offset = 0; -static unsigned long next_part_offset = 0; +static unsigned long part_size = 0; static int cur_part = 1; @@ -100,9 +100,7 @@ int fat_register_device (block_dev_desc_t * dev_desc, int part_no) if (!get_partition_info(dev_desc, part_no, &info)) { part_offset = info.start; cur_part = part_no; - - if (!get_partition_info(dev_desc, part_no + 1, &info)) - next_part_offset = info.start; + part_size = info.size; } else if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3) == 0) || (strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET], "FAT32", 5) == 0)) { /* ok, we assume we are on a PBR only */ diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index e2537b1..55ebeb5 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -1159,7 +1159,7 @@ static int do_fat_write (const char *filename, void *buffer, total_sector = bs.total_sect; if (total_sector == 0) { - total_sector = next_part_offset - part_offset; + total_sector = part_size; } root_cluster = bs.root_cluster; @@ -1331,7 +1331,7 @@ void file_fat_table (void) total_sector = bs.total_sect; if (total_sector == 0) { - total_sector = next_part_offset - part_offset; + total_sector = part_size; } if (mydata->fatsize == 32) @@ -1474,7 +1474,7 @@ int mkfs_vfat (block_dev_desc_t *dev_desc, int part_no) if (!get_partition_info(dev_desc, part_no, &info)) { volume_size_bytes = info.size * info.blksz; - volume_size_sect = volume_size_bytes / bytes_per_sect; + volume_size_sect = info.size; total_sector = volume_size_sect; } else {