History

include/uapi/linux/msdos_fs.h: use MSDOS_NAME for volume label size

The FAT file system volume label file stored in the root directory should match the volume label field in the FAT boot sector. As consequence, the max length of these fields ought to be the same. This patch replaces the magic '11' usef in the struct fat_boot_sector with MSDOS_NAME, which is used in struct msdos_dir_entry. Please check the following references: 1. Microsoft FAT specification 2005 (http://read.pudn.com/downloads77/ebook/294884/FAT32%20Spec%20%28SDA%20Contribution%29.pdf). Search for 'volume label'. 2. Microsoft Extensible Firmware Initiative, FAT32 File System Specification (https://staff.washington.edu/dittrich/misc/fatgen103.pdf). Search for 'volume label'. 3. User space code that creates FAT filesystem sometimes uses MSDOS_NAME for the label, sometimes not. Search for 'if (memcmp(label, NO_NAME, MSDOS_NAME))'. I consider to make the same patch there as well. https://github.com/dosfstools/dosfstools/blob/master/src/mkfs.fat.c

Carmeli Tamir committed 7 years ago

Commit 9da22851 parent f93ca1e1 file · +2 −2Browse files

Showing the changes to include/uapi/linux (1 of 1 file). Show all

Unified · Split

include/uapi/linux/msdos_fs.h+2−2
@@ -135,7 +135,7 @@ struct fat_boot_sector { · 134 unmodified lines
135 for mount state. */135 for mount state. */
136 __u8 signature; /* extended boot signature */136 __u8 signature; /* extended boot signature */
137 __u8 vol_id[4]; /* volume ID */137 __u8 vol_id[4]; /* volume ID */
138 __u8 vol_label[11]; /* volume label */138 __u8 vol_label[MSDOS_NAME]; /* volume label */
139 __u8 fs_type[8]; /* file system type */139 __u8 fs_type[8]; /* file system type */
140 /* other fields are not added here */140 /* other fields are not added here */
141 } fat16;141 } fat16;
@@ -158,7 +158,7 @@ struct fat_boot_sector { · 16 unmodified lines
158 for mount state. */158 for mount state. */
159 __u8 signature; /* extended boot signature */159 __u8 signature; /* extended boot signature */
160 __u8 vol_id[4]; /* volume ID */160 __u8 vol_id[4]; /* volume ID */
161 __u8 vol_label[11]; /* volume label */161 __u8 vol_label[MSDOS_NAME]; /* volume label */
162 __u8 fs_type[8]; /* file system type */162 __u8 fs_type[8]; /* file system type */
163 /* other fields are not added here */163 /* other fields are not added here */
164 } fat32;164 } fat32;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t