From: Carmeli Tamir <carmeli.tamir@gmail.com>
To: axboe@kernel.dk, sergey.senozhatsky@gmail.com,
jthumshirn@suse.de, bvanassche@acm.org,
martin.petersen@oracle.com, linux-kernel@vger.kernel.org,
carmeli.tamir@gmail.com
Subject: [PATCH] fat: Replaced 11 magic to MSDOS_NAME for volume label
Date: Sat, 24 Nov 2018 17:01:19 -0500 [thread overview]
Message-ID: <1543096879-82837-1-git-send-email-carmeli.tamir@gmail.com> (raw)
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
Signed-off-by: Carmeli Tamir <carmeli.tamir@gmail.com>
---
include/uapi/linux/msdos_fs.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h
index fde7537..1216e6c 100644
--- a/include/uapi/linux/msdos_fs.h
+++ b/include/uapi/linux/msdos_fs.h
@@ -135,7 +135,7 @@ struct fat_boot_sector {
for mount state. */
__u8 signature; /* extended boot signature */
__u8 vol_id[4]; /* volume ID */
- __u8 vol_label[11]; /* volume label */
+ __u8 vol_label[MSDOS_NAME]; /* volume label */
__u8 fs_type[8]; /* file system type */
/* other fields are not added here */
} fat16;
@@ -158,7 +158,7 @@ struct fat_boot_sector {
for mount state. */
__u8 signature; /* extended boot signature */
__u8 vol_id[4]; /* volume ID */
- __u8 vol_label[11]; /* volume label */
+ __u8 vol_label[MSDOS_NAME]; /* volume label */
__u8 fs_type[8]; /* file system type */
/* other fields are not added here */
} fat32;
--
2.7.4
next reply other threads:[~2018-11-24 22:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-24 22:01 Carmeli Tamir [this message]
2018-11-26 5:07 ` [PATCH] fat: Replaced 11 magic to MSDOS_NAME for volume label Sergey Senozhatsky
2018-11-26 7:58 ` Johannes Thumshirn
2018-11-26 19:23 ` Tamir Carmeli
2018-11-27 1:40 ` Sergey Senozhatsky
2018-11-27 2:08 ` OGAWA Hirofumi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1543096879-82837-1-git-send-email-carmeli.tamir@gmail.com \
--to=carmeli.tamir@gmail.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=jthumshirn@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sergey.senozhatsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).