[PATCH] ntfs(3): export super block magic
David Timber <[email protected]>
| Newsgroups | dev.linux.lists.ntfs3,org.kernel.vger.linux-fsdevel |
|---|---|
| Message-ID | <[email protected]> |
Export NTFS_SUPER_MAGIC and NTFS3_SUPER_MAGIC so that the NTFS implementation could be differentiated from userspace through fstatfs() and the coreutils comamnd `stat -f`. Signed-off-by: David Timber <[email protected]> --- fs/ntfs/ntfs.h | 1 - fs/ntfs/super.c | 4 ++-- fs/ntfs3/super.c | 4 ++-- include/uapi/linux/magic.h | 2 ++ 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h index 45064dbcc2e4..c41be5fbff17 100644 --- a/fs/ntfs/ntfs.h +++ b/fs/ntfs/ntfs.h @@ -76,7 +76,6 @@ enum { NTFS_BLOCK_SIZE = 512, NTFS_BLOCK_SIZE_BITS = 9, - NTFS_SB_MAGIC = 0x5346544e, /* 'NTFS' */ NTFS_MAX_NAME_LEN = 255, NTFS_MAX_LABEL_LEN = 128, }; diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 39a5c3b81001..e595a34619fa 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -2149,7 +2149,7 @@ static int ntfs_statfs(struct dentry *dentry, struct kstatfs *sfs) ntfs_debug("Entering."); /* Type of filesystem. */ - sfs->f_type = NTFS_SB_MAGIC; + sfs->f_type = NTFS_SUPER_MAGIC; /* Optimal transfer block size. */ sfs->f_bsize = vol->cluster_size; /* Fundamental file system block size, used as the unit. */ @@ -2352,7 +2352,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) /* Initialize the cluster and mft allocators. */ ntfs_setup_allocators(vol); /* Setup remaining fields in the super block. */ - sb->s_magic = NTFS_SB_MAGIC; + sb->s_magic = NTFS_SUPER_MAGIC; /* * Ntfs allows 63 bits for the file size, i.e. correct would be: * sb->s_maxbytes = ~0ULL >> 1; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 47c11547c972..388d4c51f24b 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -731,7 +731,7 @@ static int ntfs_statfs(struct dentry *dentry, struct kstatfs *buf) struct wnd_bitmap *wnd = &sbi->used.bitmap; CLST da_clusters = ntfs_get_da(sbi); - buf->f_type = sb->s_magic; + buf->f_type = NTFS3_SUPER_MAGIC; buf->f_bsize = buf->f_frsize = sbi->cluster_size; buf->f_blocks = wnd->nbits; @@ -1279,7 +1279,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) } sbi->options = options; sb->s_flags |= SB_NODIRATIME; - sb->s_magic = 0x7366746e; // "ntfs" + sb->s_magic = NTFS3_SUPER_MAGIC; sb->s_op = &ntfs_sops; sb->s_export_op = &ntfs_export_ops; sb->s_time_gran = NTFS_TIME_GRAN; // 100 nsec diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h index 4f2da935a76c..7bc8058c7108 100644 --- a/include/uapi/linux/magic.h +++ b/include/uapi/linux/magic.h @@ -54,6 +54,8 @@ #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ #define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ #define AFS_FS_MAGIC 0x6B414653 +#define NTFS_SUPER_MAGIC 0x5346544e /* "NTFS" */ +#define NTFS3_SUPER_MAGIC 0x7366746e /* "ntfs" */ #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ -- 2.53.0.1.ga224b40d3f.dirty