move all statfs f_type magic numbers to linux/magic.h
Subsystems (14)
The file <linux/magic.h> is incomplete and some magic numbers that kernel returns by statfs f_type to userspace are not defined there. This situation makes statfs f_type usage in userpace painful as you have to "ifndef-define" many magic numbers in userspace code.
All the patches are trivial and just move *_SUPER_MAGIC stuff from filesystem specific files to the generic <linux/magic.h>.
Karel
PATCH 1/22 cifs: move CIFS_MAGIC_NUMBER to <linux/magic.h>
Move the magic number to proper place.
--- fs/cifs/cifsglob.h | 3 +-- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifsglob.h +1 -2
@@ -22,6 +22,7 @@#include <linux/in.h> #include <linux/in6.h> #include <linux/slab.h> +#include <linux/magic.h> #include <linux/mempool.h> #include <linux/workqueue.h> #include "cifs_fs_sb.h"
@@ -33,8 +34,6 @@#include "smb2pdu.h" #endif -#define CIFS_MAGIC_NUMBER 0xFF534D42/* the first four bytes of SMB PDUs */ -/* * The sizes of various internal tables and strings */
include/uapi/linux/magic.h +1 -0
@@ -5,6 +5,7 @@#define AFFS_SUPER_MAGIC 0xadff#define AFS_SUPER_MAGIC 0x5346414F#define AUTOFS_SUPER_MAGIC 0x0187 +#define CIFS_MAGIC_NUMBER 0xff534d42#define CODA_SUPER_MAGIC 0x73757245#define CRAMFS_MAGIC 0x28cd3d45/* some random number */ #define CRAMFS_MAGIC_WEND 0x453dcd28/* magic number with the wrong endianess */
Signature · 1 line
1.8.5.3
PATCH 2/22 xfs: add XFS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place as it's exported by statfs.f_type to userspace.
--- fs/xfs/xfs_sb.h | 4 +++- include/uapi/linux/magic.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_sb.h +3 -1
@@ -18,6 +18,8 @@#ifndef __XFS_SB_H__#define __XFS_SB_H__ +#include <linux/magic.h> +/* * Super block * Fits into a sector-sized buffer at address 0 of each allocation group.
@@ -28,7 +30,7 @@ struct xfs_buf;struct xfs_mount ;struct xfs_trans ; -#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ +#define XFS_SB_MAGIC XFS_SUPER_MAGIC/* see linux/magic.h */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */ #define XFS_SB_VERSION_2 2/* 6.2 - attributes */ #define XFS_SB_VERSION_3 3/* 6.2 - new inode version */
include/uapi/linux/magic.h +1 -0
@@ -32,6 +32,7 @@#define PSTOREFS_MAGIC 0x6165676C#define EFIVARFS_MAGIC 0xde5e81e4#define HOSTFS_SUPER_MAGIC 0x00c0ffee +#define XFS_SUPER_MAGIC 0x58465342#define MINIX_SUPER_MAGIC 0x137F/* minix v1 fs, 14 char names */ #define MINIX_SUPER_MAGIC2 0x138F/* minix v1 fs, 30 char names */
Signature · 1 line
1.8.5.3
Re: [PATCH 02/22] xfs: add XFS_SUPER_MAGIC to <linux/magic.h>
Quoted 2 lines · Karel Zak
Move the magic number to proper place as it's exported by statfs.f_type to userspace.
It is in it's proper place. It's an on-disk definition not a userspace API definition. So, for the reasons I've already outlined w.r.t. to coupling userspace APIs and on-disk format definitions being Bad Thing, NACK.
Quoted 21 lines
CC Dave Chinner <[email protected]>Signed-off-by Karel Zak <[email protected]>--- fs/xfs/xfs_sb.h | 4 +++- include/uapi/linux/magic.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)fs/xfs/xfs_sb.h +2
-0@@ -18,6 +18,8 @@#ifndef __XFS_SB_H__#define __XFS_SB_H__ +#include <linux/magic.h> +/* * Super block * Fits into a sector-sized buffer at address 0 of each allocation group.
fs/xfs/xfs_sb.h struct xfs_buf; · line 36
Quoted 8 lines
fs/xfs/xfs_sb.h +1
-1@@ -28,7 +30,7 @@ struct xfs_buf;struct xfs_mount ;struct xfs_trans ; -#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ +#define XFS_SB_MAGIC XFS_SUPER_MAGIC/* see linux/magic.h */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */ #define XFS_SB_VERSION_2 2/* 6.2 - attributes */ #define XFS_SB_VERSION_3 3/* 6.2 - new inode version */
FYI, this file (along with all the other on-disk format definitions and the core XFS code to read, modify and write it) is shared with the userspace xfsprogs code, so it needs the on-disk magic number to be defined in this file. It also means we don't include random header files from within other header files - we use explicit includes in the .c files or, for generic headers needed everywhere, consolidate them in fs/xfs/xfs_linux.h.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
PATCH 3/22 ipc/mqueue: move MQUEUE_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- include/uapi/linux/magic.h | 1 + ipc/mqueue.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/uapi/linux/magic.h +1 -0
@@ -10,6 +10,7 @@#define CRAMFS_MAGIC 0x28cd3d45/* some random number */ #define CRAMFS_MAGIC_WEND 0x453dcd28/* magic number with the wrong endianess */ #define DEBUGFS_MAGIC 0x64626720 +#define MQUEUE_MAGIC 0x19800202#define SECURITYFS_MAGIC 0x73636673#define SELINUX_MAGIC 0xf97cff8c#define SMACK_MAGIC 0x43415d53/* "SMAC" */
ipc/mqueue.c +1 -1
@@ -35,11 +35,11 @@#include <linux/ipc_namespace.h> #include <linux/user_namespace.h> #include <linux/slab.h> +#include <linux/magic.h> #include <net/sock.h> #include "util.h" -#define MQUEUE_MAGIC 0x19800202#define DIRENT_SIZE 20#define FILENT_SIZE 80
Signature · 1 line
1.8.5.3
PATCH 4/22 configfs: move CONFIGFS_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/configfs/mount.c | 4 +--- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
fs/configfs/mount.c +1 -3
@@ -30,13 +30,11 @@#include <linux/pagemap.h> #include <linux/init.h> #include <linux/slab.h> +#include <linux/magic.h> #include <linux/configfs.h> #include "configfs_internal.h" -/* Random magic number */ -#define CONFIGFS_MAGIC 0x62656570 -static struct vfsmount *configfs_mount =NULL ;struct kmem_cache *configfs_dir_cachep;static int configfs_mnt_count =0 ;
include/uapi/linux/magic.h +1 -0
@@ -7,6 +7,7 @@#define AUTOFS_SUPER_MAGIC 0x0187#define CIFS_MAGIC_NUMBER 0xff534d42#define CODA_SUPER_MAGIC 0x73757245 +#define CONFIGFS_MAGIC 0x62656570/* some random number */ #define CRAMFS_MAGIC 0x28cd3d45/* some random number */ #define CRAMFS_MAGIC_WEND 0x453dcd28/* magic number with the wrong endianess */ #define DEBUGFS_MAGIC 0x64626720
Signature · 1 line
1.8.5.3
PATCH 5/22 befs: move BEFS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/befs/befs_fs_types.h | 5 +++-- include/uapi/linux/magic.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
fs/befs/befs_fs_types.h +3 -2
@@ -16,8 +16,10 @@#ifdef __KERNEL__#include <linux/types.h> +#include <linux/magic.h> #endif /*__KERNEL__*/ +#define PACKED __attribute__ ((__packed__))/*
@@ -49,7 +51,7 @@ enum super_flags {BEFS_BYTESEX_LE ,BEFS_CLEAN =0x434c454e ,BEFS_DIRTY =0x44495254 , -BEFS_SUPER_MAGIC1 =0x42465331 ,/* BFS1 */ + BEFS_SUPER_MAGIC1 = BEFS_SUPER_MAGIC /* see linux/magic.h */BEFS_SUPER_MAGIC2 =0xdd121031 , BEFS_SUPER_MAGIC3 = 0x15b6830e, };
@@ -58,7 +60,6 @@ enum super_flags {#define BEFS_BYTEORDER_NATIVE_LE (__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE)#define BEFS_BYTEORDER_NATIVE_BE (__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE) -#define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1#define BEFS_SUPER_MAGIC1_LE (__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1)#define BEFS_SUPER_MAGIC1_BE (__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1)
include/uapi/linux/magic.h +1 -0
@@ -5,6 +5,7 @@#define AFFS_SUPER_MAGIC 0xadff#define AFS_SUPER_MAGIC 0x5346414F#define AUTOFS_SUPER_MAGIC 0x0187 +#define BEFS_SUPER_MAGIC 0x42465331/* "BFS1" */ #define CIFS_MAGIC_NUMBER 0xff534d42#define CODA_SUPER_MAGIC 0x73757245#define CONFIGFS_MAGIC 0x62656570/* some random number */
Signature · 1 line
1.8.5.3
PATCH 6/22 bfs: move BFS_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- include/uapi/linux/bfs_fs.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
include/uapi/linux/bfs_fs.h +1 -1
@@ -7,11 +7,11 @@#define _LINUX_BFS_FS_H#include <linux/types.h> +#include <linux/magic.h> #define BFS_BSIZE_BITS 9#define BFS_BSIZE (1<<BFS_BSIZE_BITS) -#define BFS_MAGIC 0x1BADFACE#define BFS_ROOT_INO 2#define BFS_INODES_PER_BLOCK 8
include/uapi/linux/magic.h +1 -0
@@ -6,6 +6,7 @@#define AFS_SUPER_MAGIC 0x5346414F#define AUTOFS_SUPER_MAGIC 0x0187#define BEFS_SUPER_MAGIC 0x42465331/* "BFS1" */ +#define BFS_MAGIC 0x1BADFACE#define CIFS_MAGIC_NUMBER 0xff534d42#define CODA_SUPER_MAGIC 0x73757245#define CONFIGFS_MAGIC 0x62656570/* some random number */
Signature · 1 line
1.8.5.3
PATCH 7/22 ceph: move CEPH_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/ceph/super.h | 4 +--- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
fs/ceph/super.h +1 -3
@@ -14,6 +14,7 @@#include <linux/writeback.h> #include <linux/slab.h> #include <linux/posix_acl.h> +#include <linux/magic.h> #include <linux/ceph/libceph.h>
@@ -21,9 +22,6 @@#include <linux/fscache.h> #endif -/* f_type in struct statfs */ -#define CEPH_SUPER_MAGIC 0x00c36400 -/* large granularity for statfs utilization stats to facilitate * large volume sizes on 32-bit machines. */ #define CEPH_BLOCK_SHIFT 22/* 4 MB */
include/uapi/linux/magic.h +1 -0
@@ -7,6 +7,7 @@#define AUTOFS_SUPER_MAGIC 0x0187#define BEFS_SUPER_MAGIC 0x42465331/* "BFS1" */ #define BFS_MAGIC 0x1BADFACE +#define CEPH_SUPER_MAGIC 0x00c36400#define CIFS_MAGIC_NUMBER 0xff534d42#define CODA_SUPER_MAGIC 0x73757245#define CONFIGFS_MAGIC 0x62656570/* some random number */
Signature · 1 line
1.8.5.3
PATCH 8/22 exofs: move EXOFS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/exofs/common.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
fs/exofs/common.h +1 -1
@@ -37,6 +37,7 @@#define __EXOFS_COM_H__#include <linux/types.h> +#include <linux/magic.h> #include <scsi/osd_attributes.h> #include <scsi/osd_initiator.h>
@@ -82,7 +83,6 @@ enum {/**************************************************************************** * superblock-related things ****************************************************************************/ -#define EXOFS_SUPER_MAGIC 0x5DF5/* * The file system control block - stored in object EXOFS_SUPER_ID's data.
include/uapi/linux/magic.h +1 -0
@@ -24,6 +24,7 @@#define SQUASHFS_MAGIC 0x73717368#define ECRYPTFS_SUPER_MAGIC 0xf15f#define EFS_SUPER_MAGIC 0x414A53 +#define EXOFS_SUPER_MAGIC 0x5DF5#define EXT2_SUPER_MAGIC 0xEF53#define EXT3_SUPER_MAGIC 0xEF53#define XENFS_SUPER_MAGIC 0xabba1974
Signature · 1 line
1.8.5.3
Re: [PATCH 08/22] exofs: move EXOFS_SUPER_MAGIC to <linux/magic.h>
Quoted 3 lines · Karel Zak
Move the magic number to proper place.
CC Boaz Harrosh <[email protected]>
- CC: Boaz Harrosh <[email protected]>
+ ACK-by: Boaz Harrosh <[email protected]>
Are you pushing this or you need that I push it through the exofs tree?
BTW: does anyone know - Today I need to do:
mount -t exofs /dev/osdX /mnt
How to teach the Kernel to send any osd devices to exofs when -t is not specified?
Thanks
Boaz
Quoted 39 lines
Signed-off-by Karel Zak <[email protected]>--- fs/exofs/common.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)fs/exofs/common.h +1
-1@@ -37,6 +37,7 @@#define __EXOFS_COM_H__#include <linux/types.h> +#include <linux/magic.h> #include <scsi/osd_attributes.h> #include <scsi/osd_initiator.h> @@ -82,7 +83,6 @@ enum {/**************************************************************************** * superblock-related things ****************************************************************************/ -#define EXOFS_SUPER_MAGIC 0x5DF5/* * The file system control block - stored in object EXOFS_SUPER_ID's data. include/uapi/linux/magic.h +1
-0@@ -24,6 +24,7 @@#define SQUASHFS_MAGIC 0x73717368#define ECRYPTFS_SUPER_MAGIC 0xf15f#define EFS_SUPER_MAGIC 0x414A53 +#define EXOFS_SUPER_MAGIC 0x5DF5#define EXT2_SUPER_MAGIC 0xEF53#define EXT3_SUPER_MAGIC 0xEF53#define XENFS_SUPER_MAGIC 0xabba1974
PATCH 9/22 freevxfs: move VXFS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/freevxfs/vxfs.h | 6 +----- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 5 deletions(-)
fs/freevxfs/vxfs.h +1 -5
@@ -37,6 +37,7 @@* superblocks of the Veritas Filesystem. */ #include <linux/types.h> +#include <linux/magic.h> /*
@@ -46,11 +47,6 @@ typedef int32_t vx_daddr_t;typedef int32_t vx_ino_t ;/* -* Superblock magic number (vxfs_super->vs_magic). -*/ -#define VXFS_SUPER_MAGIC 0xa501FCF5 - -/* * The root inode. */ #define VXFS_ROOT_INO 2
include/uapi/linux/magic.h +1 -0
@@ -38,6 +38,7 @@#define PSTOREFS_MAGIC 0x6165676C#define EFIVARFS_MAGIC 0xde5e81e4#define HOSTFS_SUPER_MAGIC 0x00c0ffee +#define VXFS_SUPER_MAGIC 0xa501FCF5#define XFS_SUPER_MAGIC 0x58465342#define MINIX_SUPER_MAGIC 0x137F/* minix v1 fs, 14 char names */
Signature · 1 line
1.8.5.3
Re: [PATCH 09/22] freevxfs: move VXFS_SUPER_MAGIC to <linux/magic.h>
Quoted 1 line · Karel Zak
Move the magic number to proper place.
It's already in the proper place. A filesystem should be sef-contained and not have part of it's on-disk structure in an ABI header.
PATCH 10/22 fuse: move FUSE_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/fuse/inode.c | 3 +-- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
fs/fuse/inode.c +1 -2
@@ -20,6 +20,7 @@#include <linux/random.h> #include <linux/sched.h> #include <linux/exportfs.h> +#include <linux/magic.h> MODULE_AUTHOR ("Miklos Szeredi <[email protected]>" );MODULE_DESCRIPTION ("Filesystem in Userspace" );
@@ -47,8 +48,6 @@ MODULE_PARM_DESC(max_user_congthresh,"Global limit for the maximum congestion threshold an " "unprivileged user can set"); -#define FUSE_SUPER_MAGIC 0x65735546 -#define FUSE_DEFAULT_BLKSIZE 512/** Maximum number of outstanding background requests */
include/uapi/linux/magic.h +1 -0
@@ -29,6 +29,7 @@#define EXT3_SUPER_MAGIC 0xEF53#define XENFS_SUPER_MAGIC 0xabba1974#define EXT4_SUPER_MAGIC 0xEF53 +#define FUSE_SUPER_MAGIC 0x65735546#define BTRFS_SUPER_MAGIC 0x9123683E#define NILFS_SUPER_MAGIC 0x3434#define F2FS_SUPER_MAGIC 0xF2F52010
Signature · 1 line
1.8.5.3
PATCH 11/22 gfs2: move GFS2_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- include/uapi/linux/gfs2_ondisk.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
include/uapi/linux/gfs2_ondisk.h +1 -1
@@ -11,8 +11,8 @@#define __GFS2_ONDISK_DOT_H__#include <linux/types.h> +#include <linux/magic.h> -#define GFS2_MAGIC 0x01161970#define GFS2_BASIC_BLOCK 512#define GFS2_BASIC_BLOCK_SHIFT 9
include/uapi/linux/magic.h +1 -0
@@ -14,6 +14,7 @@#define CRAMFS_MAGIC 0x28cd3d45/* some random number */ #define CRAMFS_MAGIC_WEND 0x453dcd28/* magic number with the wrong endianess */ #define DEBUGFS_MAGIC 0x64626720 +#define GFS2_MAGIC 0x01161970#define MQUEUE_MAGIC 0x19800202#define SECURITYFS_MAGIC 0x73636673#define SELINUX_MAGIC 0xf97cff8c
Signature · 1 line
1.8.5.3
Re: [PATCH 11/22] gfs2: move GFS2_MAGIC to <linux/magic.h>
Hi,
Quoted 2 lines · Karel Zak
Move the magic number to proper place.
I'm not convinced that it makes sense to move this to a shared header, outside of gfs2_ondisk.h unless it is needed by some other subsystem or component. That doesn't appear to be the case here,
Steve.
Quoted 33 lines
CC Steven Whitehouse <[email protected]>Signed-off-by Karel Zak <[email protected]>--- include/uapi/linux/gfs2_ondisk.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)include/uapi/linux/gfs2_ondisk.h +1
-1@@ -11,8 +11,8 @@#define __GFS2_ONDISK_DOT_H__#include <linux/types.h> +#include <linux/magic.h> -#define GFS2_MAGIC 0x01161970#define GFS2_BASIC_BLOCK 512#define GFS2_BASIC_BLOCK_SHIFT 9include/uapi/linux/magic.h +1
-0@@ -14,6 +14,7 @@#define CRAMFS_MAGIC 0x28cd3d45/* some random number */ #define CRAMFS_MAGIC_WEND 0x453dcd28/* magic number with the wrong endianess */ #define DEBUGFS_MAGIC 0x64626720 +#define GFS2_MAGIC 0x01161970#define MQUEUE_MAGIC 0x19800202#define SECURITYFS_MAGIC 0x73636673#define SELINUX_MAGIC 0xf97cff8c
PATCH 12/22 hfsplus: move HFSPLUS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/hfsplus/hfsplus_raw.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
fs/hfsplus/hfsplus_raw.h +1 -1
@@ -14,6 +14,7 @@#define _LINUX_HFSPLUS_RAW_H#include <linux/types.h> +#include <linux/magic.h> /* Some constants */ #define HFSPLUS_SECTOR_SIZE 512
@@ -21,7 +22,6 @@#define HFSPLUS_VOLHEAD_SECTOR 2#define HFSPLUS_VOLHEAD_SIG 0x482b#define HFSPLUS_VOLHEAD_SIGX 0x4858 -#define HFSPLUS_SUPER_MAGIC 0x482b#define HFSPLUS_MIN_VERSION 4#define HFSPLUS_CURRENT_VERSION 5
include/uapi/linux/magic.h +1 -0
@@ -39,6 +39,7 @@#define JFFS2_SUPER_MAGIC 0x72b6#define PSTOREFS_MAGIC 0x6165676C#define EFIVARFS_MAGIC 0xde5e81e4 +#define HFSPLUS_SUPER_MAGIC 0x482b#define HOSTFS_SUPER_MAGIC 0x00c0ffee#define VXFS_SUPER_MAGIC 0xa501FCF5#define XFS_SUPER_MAGIC 0x58465342
Signature · 1 line
1.8.5.3
Vyacheslav Dubeyko
maintainerRe: [PATCH 12/22] hfsplus: move HFSPLUS_SUPER_MAGIC to <linux/magic.h>
Quoted 21 lines · Karel Zak
Move the magic number to proper place.
Signed-off-by Karel Zak <[email protected]>--- fs/hfsplus/hfsplus_raw.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)fs/hfsplus/hfsplus_raw.h +1
-0@@ -14,6 +14,7 @@#define _LINUX_HFSPLUS_RAW_H#include <linux/types.h> +#include <linux/magic.h> /* Some constants */ #define HFSPLUS_SECTOR_SIZE 512
fs/hfsplus/hfsplus_raw.h line 24
Quoted 4 lines
fs/hfsplus/hfsplus_raw.h +0
-1@@ -21,7 +22,6 @@#define HFSPLUS_VOLHEAD_SECTOR 2#define HFSPLUS_VOLHEAD_SIG 0x482b#define HFSPLUS_VOLHEAD_SIGX 0x4858 -#define HFSPLUS_SUPER_MAGIC 0x482b
Frankly speaking, HFSPLUS_VOLHEAD_SIGX is also magic number. The HFSPLUS_SUPER_MAGIC ('H+') is magic for HFS+ volumes. And HFSPLUS_VOLHEAD_SIGX ('HX') is magic for HFSX volumes.
But, moreover, as I can see HFSPLUS_VOLHEAD_SIG is synonym for HFSPLUS_SUPER_MAGIC. And it is used more frequently in HFS+ driver code. So, maybe, it makes sense to clean up duplication in declarations.
Thanks,
Vyacheslav Dubeyko.
Re: [PATCH 12/22] hfsplus: move HFSPLUS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakQuoted 1 line · Karel Zak
Move the magic number to proper place.
NAK. It's already in the proper place. Your whole series is a move in the wrong direction.
PATCH 13/22 hppfs: move HPPFS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/hppfs/hppfs.c | 3 +-- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
fs/hppfs/hppfs.c +1 -2
@@ -17,6 +17,7 @@#include <linux/types.h> #include <linux/pid_namespace.h> #include <linux/namei.h> +#include <linux/magic.h> #include <asm/uaccess.h> #include <os.h>
@@ -44,8 +45,6 @@ static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode) return container_of(inode, struct hppfs_inode_info, vfs_inode); } -#define HPPFS_SUPER_MAGIC 0xb00000ee -static const struct super_operations hppfs_sbops;static int is_pid (struct dentry *dentry)
include/uapi/linux/magic.h +1 -0
@@ -41,6 +41,7 @@#define EFIVARFS_MAGIC 0xde5e81e4#define HFSPLUS_SUPER_MAGIC 0x482b#define HOSTFS_SUPER_MAGIC 0x00c0ffee +#define HPPFS_SUPER_MAGIC 0xb00000ee#define VXFS_SUPER_MAGIC 0xa501FCF5#define XFS_SUPER_MAGIC 0x58465342
Signature · 1 line
1.8.5.3
PATCH 14/22 jfs: move JFS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/jfs/jfs_incore.h | 6 +----- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 5 deletions(-)
fs/jfs/jfs_incore.h +1 -5
@@ -23,16 +23,12 @@#include <linux/rwsem.h> #include <linux/slab.h> #include <linux/bitops.h> +#include <linux/magic.h> #include "jfs_types.h" #include "jfs_xtree.h" #include "jfs_dtree.h" /* -* JFS magic number -*/ -#define JFS_SUPER_MAGIC 0x3153464a/* "JFS1" */ - -/* * JFS-private inode information */ struct jfs_inode_info {
include/uapi/linux/magic.h +1 -0
@@ -37,6 +37,7 @@#define HPFS_SUPER_MAGIC 0xf995e849#define ISOFS_SUPER_MAGIC 0x9660#define JFFS2_SUPER_MAGIC 0x72b6 +#define JFS_SUPER_MAGIC 0x3153464a/* "JFS1" */ #define PSTOREFS_MAGIC 0x6165676C#define EFIVARFS_MAGIC 0xde5e81e4#define HFSPLUS_SUPER_MAGIC 0x482b
Signature · 1 line
1.8.5.3
PATCH 15/22 logfs: add LOGFS_FTYPE_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the 32bit statfs f_type magic number to proper place.
--- fs/logfs/logfs_abi.h | 7 +++++-- fs/logfs/super.c | 2 +- include/uapi/linux/magic.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-)
fs/logfs/logfs_abi.h +5 -2
@@ -60,9 +60,12 @@ static inline void check_##type(void) \*/ -/* Magic numbers. 64bit for superblock, 32bit for statfs f_type */ +/* +* Magic numbers. +* +* 64bit for superblock, 32bit for statfs f_type defined in linux/magic.h +*/ #define LOGFS_MAGIC 0x7a3a8e5cb9d5bf67ull -#define LOGFS_MAGIC_U32 0xc97e8168u/* * Various blocksize related macros. Blocksize is currently fixed at 4KiB.
fs/logfs/super.c +1 -1
@@ -99,7 +99,7 @@ int logfs_statfs(struct dentry *dentry, struct kstatfs *stats)struct super_block *sb = dentry->d_sb;struct logfs_super *super =logfs_super (sb); - stats->f_type =LOGFS_MAGIC_U32 ; + stats->f_type =LOGFS_FTYPE_MAGIC ; stats->f_bsize = sb->s_blocksize; stats->f_blocks = super->s_size >>LOGFS_BLOCK_BITS >>3 ; stats->f_bfree = super->s_free_bytes >> sb->s_blocksize_bits;
include/uapi/linux/magic.h +2 -0
@@ -46,6 +46,8 @@#define VXFS_SUPER_MAGIC 0xa501FCF5#define XFS_SUPER_MAGIC 0x58465342 +#define LOGFS_FTYPE_MAGIC 0xc97e8168 +#define MINIX_SUPER_MAGIC 0x137F/* minix v1 fs, 14 char names */ #define MINIX_SUPER_MAGIC2 0x138F/* minix v1 fs, 30 char names */ #define MINIX2_SUPER_MAGIC 0x2468/* minix v2 fs, 14 char names */
Signature · 1 line
1.8.5.3
PATCH 16/22 ntfs: move NTFS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/ntfs/ntfs.h | 2 +- fs/ntfs/super.c | 4 ++-- include/uapi/linux/magic.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-)
fs/ntfs/ntfs.h +1 -1
@@ -32,6 +32,7 @@#include <linux/nls.h> #include <linux/smp.h> #include <linux/pagemap.h> +#include <linux/magic.h> #include "types.h" #include "volume.h"
@@ -40,7 +41,6 @@ typedef enum { NTFS_BLOCK_SIZE = 512, NTFS_BLOCK_SIZE_BITS = 9, - NTFS_SB_MAGIC = 0x5346544e, /* 'NTFS' */ NTFS_MAX_NAME_LEN = 255, NTFS_MAX_ATTR_NAME_LEN = 255, NTFS_MAX_CLUSTER_SIZE = 64 * 1024, /* 64kiB */
fs/ntfs/super.c +2 -2
@@ -2620,7 +2620,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 =PAGE_CACHE_SIZE ;/*
@@ -2847,7 +2847,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)/* 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;
include/uapi/linux/magic.h +1 -0
@@ -33,6 +33,7 @@#define FUSE_SUPER_MAGIC 0x65735546#define BTRFS_SUPER_MAGIC 0x9123683E#define NILFS_SUPER_MAGIC 0x3434 +#define NTFS_SUPER_MAGIC 0x5346544e/* 'NTFS' */ #define F2FS_SUPER_MAGIC 0xF2F52010#define HPFS_SUPER_MAGIC 0xf995e849#define ISOFS_SUPER_MAGIC 0x9660
Signature · 1 line
1.8.5.3
PATCH 17/22 ocfs2: move OCFS2_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/ocfs2/ocfs2_fs.h | 5 ++--- include/uapi/linux/magic.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-)
fs/ocfs2/ocfs2_fs.h +2 -3
@@ -25,6 +25,8 @@#ifndef _OCFS2_FS_H#define _OCFS2_FS_H +#include <linux/magic.h> +/* Version */ #define OCFS2_MAJOR_REV_LEVEL 0#define OCFS2_MINOR_REV_LEVEL 90
@@ -56,9 +58,6 @@#define OCFS2_MIN_BLOCKSIZE 512#define OCFS2_MAX_BLOCKSIZE OCFS2_MIN_CLUSTERSIZE -/* Filesystem magic number */ -#define OCFS2_SUPER_MAGIC 0x7461636f -/* Object signatures */ #define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2"#define OCFS2_INODE_SIGNATURE "INODE01"
include/uapi/linux/magic.h +1 -0
@@ -15,6 +15,7 @@#define CRAMFS_MAGIC_WEND 0x453dcd28/* magic number with the wrong endianess */ #define DEBUGFS_MAGIC 0x64626720#define GFS2_MAGIC 0x01161970 +#define OCFS2_SUPER_MAGIC 0x7461636f#define MQUEUE_MAGIC 0x19800202#define SECURITYFS_MAGIC 0x73636673#define SELINUX_MAGIC 0xf97cff8c
Signature · 1 line
1.8.5.3
PATCH 18/22 omfs: move OMFS_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/omfs/omfs_fs.h | 3 ++- include/uapi/linux/magic.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
fs/omfs/omfs_fs.h +2 -1
@@ -1,9 +1,10 @@#ifndef _OMFS_FS_H#define _OMFS_FS_H +#include <linux/magic.h> +/* OMFS On-disk structures */ -#define OMFS_MAGIC 0xC2993D87#define OMFS_IMAGIC 0xD2#define OMFS_DIR 'D'
include/uapi/linux/magic.h +1 -0
@@ -16,6 +16,7 @@#define DEBUGFS_MAGIC 0x64626720#define GFS2_MAGIC 0x01161970#define OCFS2_SUPER_MAGIC 0x7461636f +#define OMFS_MAGIC 0xC2993D87#define MQUEUE_MAGIC 0x19800202#define SECURITYFS_MAGIC 0x73636673#define SELINUX_MAGIC 0xf97cff8c
Signature · 1 line
1.8.5.3
Re: [PATCH 18/22] omfs: move OMFS_MAGIC to <linux/magic.h>
Quoted 4 lines · Karel Zak
Move the magic number to proper place.
CC Bob Copeland <[email protected]>Signed-off-by Karel Zak <[email protected]>
Thanks!
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
PATCH 19/22 romfs: move ROMFS_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- include/uapi/linux/magic.h | 1 + include/uapi/linux/romfs_fs.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/uapi/linux/magic.h +1 -0
@@ -24,6 +24,7 @@#define RAMFS_MAGIC 0x858458f6/* some random number */ #define TMPFS_MAGIC 0x01021994#define HUGETLBFS_MAGIC 0x958458f6/* some random number */ +#define ROMFS_MAGIC 0x7275#define SQUASHFS_MAGIC 0x73717368#define ECRYPTFS_SUPER_MAGIC 0xf15f#define EFS_SUPER_MAGIC 0x414A53
include/uapi/linux/romfs_fs.h +1 -1
@@ -3,13 +3,13 @@#include <linux/types.h> #include <linux/fs.h> +#include <linux/magic.h> /* The basic structures of the romfs filesystem */ #define ROMBSIZE BLOCK_SIZE#define ROMBSBITS BLOCK_SIZE_BITS#define ROMBMASK (ROMBSIZE-1) -#define ROMFS_MAGIC 0x7275#define ROMFS_MAXFN 128
Signature · 1 line
1.8.5.3
PATCH 20/22 ubifs: move UBIFS_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/ubifs/ubifs.h | 4 +--- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
fs/ubifs/ubifs.h +1 -3
@@ -36,6 +36,7 @@#include <linux/mtd/ubi.h> #include <linux/pagemap.h> #include <linux/backing-dev.h> +#include <linux/magic.h> #include "ubifs-media.h" /* Version of this UBIFS implementation */
@@ -52,9 +53,6 @@pr_warn ("UBIFS warning (pid %d): %s: " fmt"\n" , \ current->pid, __func__, ##__VA_ARGS__) -/* UBIFS file system VFS magic number */ -#define UBIFS_SUPER_MAGIC 0x24051905 - /* Number of UBIFS blocks per VFS page */#define UBIFS_BLOCKS_PER_PAGE (PAGE_CACHE_SIZE / UBIFS_BLOCK_SIZE)#define UBIFS_BLOCKS_PER_PAGE_SHIFT (PAGE_CACHE_SHIFT - UBIFS_BLOCK_SHIFT)
include/uapi/linux/magic.h +1 -0
@@ -47,6 +47,7 @@#define HFSPLUS_SUPER_MAGIC 0x482b#define HOSTFS_SUPER_MAGIC 0x00c0ffee#define HPPFS_SUPER_MAGIC 0xb00000ee +#define UBIFS_SUPER_MAGIC 0x24051905#define VXFS_SUPER_MAGIC 0xa501FCF5#define XFS_SUPER_MAGIC 0x58465342
Signature · 1 line
1.8.5.3
PATCH 21/22 udf: move UDF_SUPER_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic number to proper place.
--- fs/udf/udf_sb.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
fs/udf/udf_sb.h +1 -1
@@ -3,9 +3,9 @@#include <linux/mutex.h> #include <linux/bitops.h> +#include <linux/magic.h> /* Since UDF 2.01 is ISO 13346 based... */ -#define UDF_SUPER_MAGIC 0x15013346#define UDF_MAX_READ_VERSION 0x0250#define UDF_MAX_WRITE_VERSION 0x0201
include/uapi/linux/magic.h +1 -0
@@ -48,6 +48,7 @@#define HOSTFS_SUPER_MAGIC 0x00c0ffee#define HPPFS_SUPER_MAGIC 0xb00000ee#define UBIFS_SUPER_MAGIC 0x24051905 +#define UDF_SUPER_MAGIC 0x15013346#define VXFS_SUPER_MAGIC 0xa501FCF5#define XFS_SUPER_MAGIC 0x58465342
Signature · 1 line
1.8.5.3
Jan Kara
reviewerRe: [PATCH 21/22] udf: move UDF_SUPER_MAGIC to <linux/magic.h>
Quoted 14 lines · Karel Zak
Move the magic number to proper place.
CC Jan Kara <[email protected]>Signed-off-by Karel Zak <[email protected]>--- fs/udf/udf_sb.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)fs/udf/udf_sb.h +0
-0
fs/udf/udf_sb.h line 8
Quoted 7 lines
fs/udf/udf_sb.h +1
-1@@ -3,9 +3,9 @@#include <linux/mutex.h> #include <linux/bitops.h> +#include <linux/magic.h> /* Since UDF 2.01 is ISO 13346 based... */ -#define UDF_SUPER_MAGIC 0x15013346
The comment refers to the magic so delete it as well... Otherwise the
patch looks OK.
Honza
Quoted 18 lines
fs/udf/udf_sb.h +0
-0#define UDF_MAX_READ_VERSION 0x0250#define UDF_MAX_WRITE_VERSION 0x0201include/uapi/linux/magic.h +1
-0@@ -48,6 +48,7 @@#define HOSTFS_SUPER_MAGIC 0x00c0ffee#define HPPFS_SUPER_MAGIC 0xb00000ee#define UBIFS_SUPER_MAGIC 0x24051905 +#define UDF_SUPER_MAGIC 0x15013346#define VXFS_SUPER_MAGIC 0xa501FCF5#define XFS_SUPER_MAGIC 0x58465342Signature · 1 line
1.8.5.3
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 21/22] udf: move UDF_SUPER_MAGIC to <linux/magic.h>
Quoted 16 lines · Jan Kara
Quoted 15 lines · Karel Zak
Move the magic number to proper place.
CC Jan Kara <[email protected]>Signed-off-by Karel Zak <[email protected]>--- fs/udf/udf_sb.h | 2 +- include/uapi/linux/magic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)fs/udf/udf_sb.h +0
-0@@ -3,9 +3,9 @@
Quoted 8 lines
fs/udf/udf_sb.h line 8
Quoted 6 lines
fs/udf/udf_sb.h +1
-1#include <linux/mutex.h> #include <linux/bitops.h> +#include <linux/magic.h> /* Since UDF 2.01 is ISO 13346 based... */ -#define UDF_SUPER_MAGIC 0x15013346The comment refers to the magic so delete it as well... Otherwise the
patch looks OK.
... meaning you can add
I could take the patch if you prefer that but I guess you'll merge the whole
series at once, right?
Honza
Quoted 20 lines
Quoted 17 lines
fs/udf/udf_sb.h +0
-0#define UDF_MAX_READ_VERSION 0x0250#define UDF_MAX_WRITE_VERSION 0x0201include/uapi/linux/magic.h +1
-0@@ -48,6 +48,7 @@#define HOSTFS_SUPER_MAGIC 0x00c0ffee#define HPPFS_SUPER_MAGIC 0xb00000ee#define UBIFS_SUPER_MAGIC 0x24051905 +#define UDF_SUPER_MAGIC 0x15013346#define VXFS_SUPER_MAGIC 0xa501FCF5#define XFS_SUPER_MAGIC 0x58465342Signature · 1 line
1.8.5.3Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH 22/22 ufs: move UFS_MAGIC and UFS2_MAGIC to <linux/magic.h>
In reply to Karel ZakMove the magic numbers to proper place.
--- fs/ufs/ufs_fs.h | 5 +++-- include/uapi/linux/magic.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-)
fs/ufs/ufs_fs.h +3 -2
@@ -35,6 +35,7 @@#include <linux/stat.h> #include <linux/fs.h> #include <linux/workqueue.h> +#include <linux/magic.h> #include <asm/div64.h> typedef __u64 __bitwise __fs64 ;
@@ -48,9 +49,9 @@ typedef __u16 __bitwise __fs16;#define UFS_SECTOR_SIZE 512#define UFS_SECTOR_BITS 9 -#define UFS_MAGIC 0x00011954 + +/* see linux/magic.h for regular magic numbers */ #define UFS_MAGIC_BW 0x0f242697 -#define UFS2_MAGIC 0x19540119#define UFS_CIGAM 0x54190100/* byteswapped MAGIC */ /* Copied from FreeBSD */
include/uapi/linux/magic.h +2 -0
@@ -24,6 +24,8 @@#define RAMFS_MAGIC 0x858458f6/* some random number */ #define TMPFS_MAGIC 0x01021994#define HUGETLBFS_MAGIC 0x958458f6/* some random number */ +#define UFS_MAGIC 0x00011954 +#define UFS2_MAGIC 0x19540119#define ROMFS_MAGIC 0x7275#define SQUASHFS_MAGIC 0x73717368#define ECRYPTFS_SUPER_MAGIC 0xf15f
Signature · 1 line
1.8.5.3
Quoted 7 lines · Karel Zak
The file <
linux/magic.h> is incomplete and some magic numbers that kernel returns by statfsf_typeto userspace are not defined there. This situation makes statfsf_typeusage in userpace painful as you have to "ifndef-define" many magic numbers in userspace code.All the patches are trivial and just move
*_SUPER_MAGICstuff from filesystem specific files to the generic <linux/magic.h>.
IMO, this is the wrong way to fix the statfs magic numbers into the user API. You're changing the code to define magic numbers that are on disk to be defined - and fixed permanently - by the statfs syscall API.
We need to be able to change the on-disk magic numbers whenever and however we want without affecting userspace, but if you tie them together then filesystems will break the ABI every time a new on disk superblock magic number is required by a filesystem.
If you want all the magic numbers that filesystems expose to userspace in statfs to be defined in one place, then you need to create the definitions for only that purpose that match what is currently documented in the statfs() man page and use those in the filesystem statfs implementation rather than the on-disk superblock magic number definitions.
e.g. include/uapi/linux/statfs_magic.h:
#define __STATFS_ADFS_SUPER_MAGIC 0xadf5
#define __STATFS_AFFS_SUPER_MAGIC 0xADFF
...
and then convert all the kernel filesystem statfs code to use these types rather than their on-disk magic numbers in f_type.
Then, for userspace, wrap them appropriately in glibc sys/statfs.h:
#include <linux/statfs_magic.h>
#define ADFS_SUPER_MAGIC __STATFS_ADFS_SUPER_MAGIC
#define AFFS_SUPER_MAGIC __STATFS_AFFS_SUPER_MAGIC
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 6 lines · Dave Chinner
Quoted 5 lines · Karel Zak
The file <
linux/magic.h> is incomplete and some magic numbers that kernel returns by statfsf_typeto userspace are not defined there. This situation makes statfsf_typeusage in userpace painful as you have to "ifndef-define" many magic numbers in userspace code.
Quoted 7 lines
Quoted 2 lines
All the patches are trivial and just move
*_SUPER_MAGICstuff from filesystem specific files to the generic <linux/magic.h>.IMO, this is the wrong way to fix the statfs magic numbers into the user API. You're changing the code to define magic numbers that are on disk to be defined - and fixed permanently - by the statfs syscall API.
Well, my idea was to follow the current kernel manner :-) and add the missing magic numbers to the API.
I agree that linux/magic.h is mess, and if there is call for something better than I can send v2 with API cleanup.
Quoted 2 lines
We need to be able to change the on-disk magic numbers whenever and however we want without affecting userspace
It's still possible, just define a new FOO_SUPER_MAGIC2 in fs code and keep linux/magic.h unchanged.
And not in all cases *_SUPER_MAGIC are used for on-disk stuff, very often it's magic number for s_magic and f_type only.
Quoted 3 lines
If you want all the magic numbers that filesystems expose to userspace in statfs to be defined in one place, then you need to create the definitions for only that purpose that match what is
Yes, I thought about it, but I was not sure if such change will be accepted.
Quoted 9 lines
currently documented in the
statfs()man page and use those in the filesystem statfs implementation rather than the on-disk superblock magic number definitions.e.g.
include/uapi/linux/statfs_magic.h:#define
__STATFS_ADFS_SUPER_MAGIC0xadf5
#define__STATFS_AFFS_SUPER_MAGIC0xADFF
...
Now filesystems usually share statfs f_type with superblock s_magic. It would be probably good enough to use something like
include/uapi/linux/statfs_magic.h:
#define __STATFS_FOO_SUPER_MAGIC 0xadf5
fs/foo/foo_sb.h:
#define FOO_SUPER_MAGIC __STATFS_FOO_SUPER_MAGIC
to avoid multiple definitions of the same numbers.
Quoted 9 lines
and then convert all the kernel filesystem statfs code to use these types rather than their on-disk magic numbers in
f_type.Then, for userspace, wrap them appropriately in glibc
sys/statfs.h:#include <
linux/statfs_magic.h>#define
ADFS_SUPER_MAGIC__STATFS_ADFS_SUPER_MAGIC
#defineAFFS_SUPER_MAGIC__STATFS_AFFS_SUPER_MAGIC
and what about the old linux/magic.h? I guess it's necessary to keep it for backward compatibility.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 18 lines · Karel Zak
Quoted 6 lines · Dave Chinner
Quoted 5 lines · Karel Zak
The file <
linux/magic.h> is incomplete and some magic numbers that kernel returns by statfsf_typeto userspace are not defined there. This situation makes statfsf_typeusage in userpace painful as you have to "ifndef-define" many magic numbers in userspace code.Quoted 7 lines
Quoted 2 lines
All the patches are trivial and just move
*_SUPER_MAGICstuff from filesystem specific files to the generic <linux/magic.h>.IMO, this is the wrong way to fix the statfs magic numbers into the user API. You're changing the code to define magic numbers that are on disk to be defined - and fixed permanently - by the statfs syscall API.
Well, my idea was to follow the current kernel manner :-) and add the missing magic numbers to the API.
Quoted 8 lines
I agree that
linux/magic.his mess, and if there is call for something better than I can send v2 with API cleanup.Quoted 2 lines
We need to be able to change the on-disk magic numbers whenever and however we want without affecting userspace
It's still possible, just define a new
FOO_SUPER_MAGIC2in fs code and keeplinux/magic.hunchanged.
Which points out exactly why the coupling this patch set introduces is wrong.
Quoted 2 lines
And not in all cases
*_SUPER_MAGICare used for on-disk stuff, very often it's magic number fors_magicandf_typeonly.
Sure, those cases are fine. But it's not ok to move an on-disk format definition into the userspace API.
Quoted 22 lines
Quoted 3 lines
If you want all the magic numbers that filesystems expose to userspace in statfs to be defined in one place, then you need to create the definitions for only that purpose that match what is
Yes, I thought about it, but I was not sure if such change will be accepted.
Quoted 9 lines
currently documented in the
statfs()man page and use those in the filesystem statfs implementation rather than the on-disk superblock magic number definitions.e.g.
include/uapi/linux/statfs_magic.h:#define
__STATFS_ADFS_SUPER_MAGIC0xadf5
#define__STATFS_AFFS_SUPER_MAGIC0xADFF
...Now filesystems usually share statfs
f_typewith superblocks_magic. It would be probably good enough to use something like
include/uapi/linux/statfs_magic.h:
Quoted 7 lines
#define __STATFS_FOO_SUPER_MAGIC 0xadf5
fs/foo/foo_sb.h:#define FOO_SUPER_MAGIC __STATFS_FOO_SUPER_MAGICto avoid multiple definitions of the same numbers.
That has exactly the same problem as this patchset - you're coupling the on-disk format definition to an unrelated userspace API definition.
We shouldn't have a single shared definition of magic numbers for statfs and on-disk formats. They are independent, have different rules determining how they can be changed and have completely different purposes in life. Hence they should be defined separately, even if they are initially defined to the same value....
Quoted 2 lines
and what about the old
linux/magic.h? I guess it's necessary to keep it for backward compatibility.
It's part of the UAPI - it has to remain there forever now....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]