From: Carmeli Tamir <carmeli.tamir@gmail.com>
To: carmeli.tamir@gmail.com, hirofumi@mail.parknet.co.jp,
linux-kernel@vger.kernel.org, jthumshirn@suse.de,
sergey.senozhatsky@gmail.com, akpm@linux-foundation.org,
bvanassche@acm.org, axboe@kernel.dk, martin.petersen@oracle.com,
sfr@canb.auug.org.au
Subject: [PATCH v3 1/3] fat: Removed FAT_FIRST_ENT macro
Date: Sun, 16 Dec 2018 15:03:58 -0500 [thread overview]
Message-ID: <1544990640-11604-2-git-send-email-carmeli.tamir@gmail.com> (raw)
In-Reply-To: <1544990640-11604-1-git-send-email-carmeli.tamir@gmail.com>
The comment edited in this patch was the only reference to the
FAT_FIRST_ENT macro, which is not used anymore. Moreover, the
commented line of code does not compile with the current code.
Since the FAT_FIRST_ENT macro checks the FAT variant in a way that the
patch series changes, I removed it, and instead wrote a clear explanation
of what was checked.
I verified that the changed comment is correct according to Microsoft FAT
spec, search for "BPB_Media" in 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'.
Signed-off-by: Carmeli Tamir <carmeli.tamir@gmail.com>
---
fs/fat/inode.c | 12 ++++++++----
include/uapi/linux/msdos_fs.h | 3 ---
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index e981e9d..708de6d 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1804,11 +1804,15 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
fat_ent_access_init(sb);
/*
- * The low byte of FAT's first entry must have same value with
- * media-field. But in real world, too many devices is
- * writing wrong value. So, removed that validity check.
+ * The low byte of the first FAT entry must have the same value as
+ * the media field of the boot sector. But in real world, too many
+ * devices are writing wrong values. So, removed that validity check.
*
- * if (FAT_FIRST_ENT(sb, media) != first)
+ * The removed check compared the first FAT entry to a value dependent
+ * on the media field like this:
+ * == (0x0F00 | media), for FAT12
+ * == (0XFF00 | media), for FAT16
+ * == (0x0FFFFF | media), for FAT32
*/
error = -EINVAL;
diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h
index 1216e6c..833c707 100644
--- a/include/uapi/linux/msdos_fs.h
+++ b/include/uapi/linux/msdos_fs.h
@@ -58,9 +58,6 @@
#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
-#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
- MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
-
/* start of data cluster's entry (number of reserved clusters) */
#define FAT_START_ENT 2
--
2.7.4
next prev parent reply other threads:[~2018-12-16 20:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-16 20:03 [PATCH v3 0/3] fat: Added functions to determine the FAT variant (12/16/32bit) Carmeli Tamir
2018-12-16 20:03 ` Carmeli Tamir [this message]
2018-12-16 20:03 ` [PATCH v3 2/3] fat: Moved MAX_FAT to fat.h and changed it to inline function Carmeli Tamir
2018-12-16 20:04 ` [PATCH v3 3/3] fat: New inline functions to determine the FAT variant (32, 16 or 12) Carmeli Tamir
2018-12-24 12:04 ` [PATCH v3 0/3] fat: Added functions to determine the FAT variant (12/16/32bit) OGAWA Hirofumi
2018-12-25 9:48 ` Sergey Senozhatsky
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=1544990640-11604-2-git-send-email-carmeli.tamir@gmail.com \
--to=carmeli.tamir@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hirofumi@mail.parknet.co.jp \
--cc=jthumshirn@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=sfr@canb.auug.org.au \
/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
all inboxes | Powered by JetHome®