On Tue, Mar 04, 2014 at 11:00:36AM +0100, Karel Zak wrote: > 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>. 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. -- Dave Chinner david@xxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html