Skip to contentSkip to conversation

FAT: fix complie error when enabling FAT write

PATCH New Donggeun Kim 2 participants 2 messages Dec 14, 2011 – Dec 16, 2011 VFAT/FAT/msdos filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 FAT: fix complie error when enabling FAT write

By removing variable of 'part_size' in fs/fat.c,
compile error occurs when enabling FAT write feature.
The variable should be declared only when CONFIG_FAT_WRITE is defined. This patch removes compile error when FAT write is enabled and compile warning when FAT write is disabled.

---
 fs/fat/fat.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
fs/fat/fat.c +7 -0
index 9a29458..40c0538 100644
@@ -47,6 +47,10 @@ static block_dev_desc_t *cur_dev = NULL;
 
 static unsigned long part_offset = 0;
 
+#ifdef CONFIG_FAT_WRITE
+static unsigned long part_size;
+#endif
+
 static int cur_part = 1;
 
 #define DOS_PART_TBL_OFFSET	0x1be
@@ -101,6 +105,9 @@ 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;
+#ifdef CONFIG_FAT_WRITE
+			part_size = info.size;
+#endif
 		} else if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],
 				    "FAT", 3) == 0) ||
 			   (strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET],
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 FAT: fix complie error when enabling FAT write

Dear Donggeun Kim,

Quoted 11 lines · In message <[email protected]> you wrote:

By removing variable of 'part_size' in fs/fat.c,
compile error occurs when enabling FAT write feature.
The variable should be declared only when CONFIG_FAT_WRITE is defined. This patch removes compile error when FAT write is enabled and compile warning when FAT write is disabled.

---
 fs/fat/fat.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Please squash this into the patch that adds the fatwrite feature.

Thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Einstein argued that there must be simplified explanations of nature,
because God is not capricious or arbitrary. No  such  faith  comforts
the software engineer.                             - Fred Brooks, Jr.