From: Carmeli Tamir <carmeli.tamir@gmail.com>
To: hirofumi@mail.parknet.co.jp, jthumshirn@suse.de,
sergey.senozhatsky@gmail.com, akpm@linux-foundation.org,
axboe@kernel.dk, martin.petersen@oracle.com, bvanassche@acm.org,
linux-kernel@vger.kernel.org, carmeli.tamir@gmail.com
Subject: [PATCH 1/2] fat: Moved macros that won't work without fat.h
Date: Mon, 10 Dec 2018 14:41:56 -0500 [thread overview]
Message-ID: <1544470917-6443-2-git-send-email-carmeli.tamir@gmail.com> (raw)
In-Reply-To: <1544470917-6443-1-git-send-email-carmeli.tamir@gmail.com>
Both FAT_FIRST_ENT and MAX_FAT are useless in msdos_fs.h, since they need the
MSDOS_SB function that is defined in fat.h. So really, both can be only called
from code that already includes fat.h.
Hence, this patch moves them to fat.h, right after MSDOS_SB is defined.
This patch is required for the next in the series, in which the variant (whether
this is FAT12, FAT16 or FAT32) checks are replaced with new macros.
Signed-off-by: Carmeli Tamir <carmeli.tamir@gmail.com>
---
fs/fat/fat.h | 22 +++++++++++++++++-----
include/uapi/linux/msdos_fs.h | 5 -----
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 4e1b2f6..e06fdd3 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -106,6 +106,23 @@ struct msdos_sb_info {
#define FAT_CACHE_VALID 0 /* special case for valid cache */
+static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb)
+{
+ return sb->s_fs_info;
+}
+
+/*
+ * Definitions that depend on the variant of the FAT file system (i.e., whether
+ * this is FAT12, FAT16 or FAT32.
+ */
+
+#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
+ MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
+
+/* maximum number of clusters */
+#define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \
+ MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12)
+
/*
* MS-DOS file system inode data in memory
*/
@@ -137,11 +154,6 @@ struct fat_slot_info {
struct buffer_head *bh;
};
-static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb)
-{
- return sb->s_fs_info;
-}
-
static inline struct msdos_inode_info *MSDOS_I(struct inode *inode)
{
return container_of(inode, struct msdos_inode_info, vfs_inode);
diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h
index 1216e6c..a577389 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
@@ -68,8 +65,6 @@
#define MAX_FAT12 0xFF4
#define MAX_FAT16 0xFFF4
#define MAX_FAT32 0x0FFFFFF6
-#define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \
- MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12)
/* bad cluster mark */
#define BAD_FAT12 0xFF7
--
2.7.4
next prev parent reply other threads:[~2018-12-10 19:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-10 19:41 [PATCH 0/2] fat: Added macros to determine the FAT FS variant (12/16/32bit) Carmeli Tamir
2018-12-10 19:41 ` Carmeli Tamir [this message]
2018-12-10 19:41 ` [PATCH 2/2] fat: New macros to determine the FAT variant (32, 16 or 12) Carmeli Tamir
2018-12-10 20:09 ` Joe Perches
2018-12-14 3:16 ` OGAWA Hirofumi
2018-12-14 8:14 ` Tamir Carmeli
2018-12-14 9:49 ` 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=1544470917-6443-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 \
/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®