Skip to content

Commit b553337

Browse files
carmeli-tamirtorvalds
authored andcommitted
fat: remove FAT_FIRST_ENT macro
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'. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Carmeli Tamir <[email protected]> Acked-by: OGAWA Hirofumi <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Cc: Bart Van Assche <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: Martin K. Petersen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 9da2285 commit b553337

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

fs/fat/inode.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,11 +1803,15 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
18031803
fat_ent_access_init(sb);
18041804

18051805
/*
1806-
* The low byte of FAT's first entry must have same value with
1807-
* media-field. But in real world, too many devices is
1808-
* writing wrong value. So, removed that validity check.
1806+
* The low byte of the first FAT entry must have the same value as
1807+
* the media field of the boot sector. But in real world, too many
1808+
* devices are writing wrong values. So, removed that validity check.
18091809
*
1810-
* if (FAT_FIRST_ENT(sb, media) != first)
1810+
* The removed check compared the first FAT entry to a value dependent
1811+
* on the media field like this:
1812+
* == (0x0F00 | media), for FAT12
1813+
* == (0XFF00 | media), for FAT16
1814+
* == (0x0FFFFF | media), for FAT32
18111815
*/
18121816

18131817
error = -EINVAL;

include/uapi/linux/msdos_fs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
5959
#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
6060

61-
#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
62-
MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
63-
6461
/* start of data cluster's entry (number of reserved clusters) */
6562
#define FAT_START_ENT 2
6663

0 commit comments

Comments
 (0)