From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
bug-track@fisher-privat.net
Subject: [PATCH 1/2] fat: add extended fileds to struct fat_boot_sector
Date: Fri, 28 Dec 2012 02:19:13 +0900 [thread overview]
Message-ID: <87pq1vza3y.fsf@devron.myhome.or.jp> (raw)
From: Oleksij Rempel <bug-track@fisher-privat.net>
later we will need "state" field to check if volume was cleanly unmounted.
Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
fs/fat/inode.c | 8 ++++----
include/uapi/linux/msdos_fs.h | 36 ++++++++++++++++++++++++++++--------
2 files changed, 32 insertions(+), 12 deletions(-)
diff -puN fs/fat/inode.c~fat-check-dirty-1 fs/fat/inode.c
--- linux/fs/fat/inode.c~fat-check-dirty-1 2012-12-28 02:17:39.000000000 +0900
+++ linux-hirofumi/fs/fat/inode.c 2012-12-28 02:17:39.000000000 +0900
@@ -1298,17 +1298,17 @@ int fat_fill_super(struct super_block *s
sbi->prev_free = FAT_START_ENT;
sb->s_maxbytes = 0xffffffff;
- if (!sbi->fat_length && b->fat32_length) {
+ if (!sbi->fat_length && b->fat32.length) {
struct fat_boot_fsinfo *fsinfo;
struct buffer_head *fsinfo_bh;
/* Must be FAT32 */
sbi->fat_bits = 32;
- sbi->fat_length = le32_to_cpu(b->fat32_length);
- sbi->root_cluster = le32_to_cpu(b->root_cluster);
+ sbi->fat_length = le32_to_cpu(b->fat32.length);
+ sbi->root_cluster = le32_to_cpu(b->fat32.root_cluster);
/* MC - if info_sector is 0, don't multiply by 0 */
- sbi->fsinfo_sector = le16_to_cpu(b->info_sector);
+ sbi->fsinfo_sector = le16_to_cpu(b->fat32.info_sector);
if (sbi->fsinfo_sector == 0)
sbi->fsinfo_sector = 1;
diff -puN include/uapi/linux/msdos_fs.h~fat-check-dirty-1 include/uapi/linux/msdos_fs.h
--- linux/include/uapi/linux/msdos_fs.h~fat-check-dirty-1 2012-12-28 02:17:39.000000000 +0900
+++ linux-hirofumi/include/uapi/linux/msdos_fs.h 2012-12-28 02:17:39.000000000 +0900
@@ -120,14 +120,34 @@ struct fat_boot_sector {
__le32 hidden; /* hidden sectors (unused) */
__le32 total_sect; /* number of sectors (if sectors == 0) */
- /* The following fields are only used by FAT32 */
- __le32 fat32_length; /* sectors/FAT */
- __le16 flags; /* bit 8: fat mirroring, low 4: active fat */
- __u8 version[2]; /* major, minor filesystem version */
- __le32 root_cluster; /* first cluster in root directory */
- __le16 info_sector; /* filesystem info sector */
- __le16 backup_boot; /* backup boot sector */
- __le16 reserved2[6]; /* Unused */
+ union {
+ struct {
+ /* Extended BPB Fields for FAT16 */
+ __u8 drive_number; /* Physical drive number */
+ __u8 state; /* undocumented, but used
+ for mount state. */
+ /* other fiealds are not added here */
+ } fat16;
+
+ struct {
+ /* only used by FAT32 */
+ __le32 length; /* sectors/FAT */
+ __le16 flags; /* bit 8: fat mirroring,
+ low 4: active fat */
+ __u8 version[2]; /* major, minor filesystem
+ version */
+ __le32 root_cluster; /* first cluster in
+ root directory */
+ __le16 info_sector; /* filesystem info sector */
+ __le16 backup_boot; /* backup boot sector */
+ __le16 reserved2[6]; /* Unused */
+ /* Extended BPB Fields for FAT32 */
+ __u8 drive_number; /* Physical drive number */
+ __u8 state; /* undocumented, but used
+ for mount state. */
+ /* other fiealds are not added here */
+ } fat32;
+ };
};
struct fat_boot_fsinfo {
_
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next reply other threads:[~2012-12-27 17:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-27 17:19 OGAWA Hirofumi [this message]
2012-12-27 17:20 ` [PATCH 2/2] fat: mark fs as dirty on mount and clean on umount OGAWA Hirofumi
2013-01-02 23:44 ` Andrew Morton
2013-01-03 8:46 ` Oleksij Rempel
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=87pq1vza3y.fsf@devron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=akpm@linux-foundation.org \
--cc=bug-track@fisher-privat.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).