diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-10-10 16:46:25 -0700 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2017-10-16 09:42:44 +0200 |
commit | 4d81e8b4af6fdecf20ed777d67fe4b25e9fb46f6 (patch) | |
tree | 2043902d09360177ead404620aea85ebfc7c3a8f | |
parent | 16f31b143b41aaa50e43073fa0aadb8474820e1f (diff) | |
download | quota-tools-4d81e8b4af6fdecf20ed777d67fe4b25e9fb46f6.tar.gz |
f2fs: support f2fs's quota sysfile
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | bylabel.c | 18 | ||||
-rw-r--r-- | mntopt.h | 1 | ||||
-rw-r--r-- | quotasys.c | 2 |
3 files changed, 20 insertions, 1 deletions
@@ -65,6 +65,14 @@ struct reiserfs_super_block { u_char s_volume_name[16]; }; +#define F2FS_SUPER_MAGIC "0xF2F52010" +struct f2fs_super_block { + u_char s_magic[8]; + u_char s_dummy[144]; + u_char s_uuid[16]; + u_char s_volume_name[512]; +}; + static inline unsigned short swapped(unsigned short a) { return (a >> 8) | (a << 8); @@ -81,6 +89,7 @@ static int get_label_uuid(const char *device, char **label, char *uuid) struct ext2_super_block e2sb; struct xfs_super_block xfsb; struct reiserfs_super_block reisersb; + struct f2fs_super_block f2fssb; fd = open(device, O_RDONLY); if (fd < 0) @@ -114,6 +123,15 @@ static int get_label_uuid(const char *device, char **label, char *uuid) sstrncpy(*label, (char *)reisersb.s_volume_name, namesize); rv = 0; } + else if (lseek(fd, 65536, SEEK_SET) == 65536 + && read(fd, (char *)&f2fssb, sizeof(f2fssb)) == sizeof(f2fssb) + && !strncmp((char *)&f2fssb.s_magic, F2FS_SUPER_MAGIC, 8)) { + memcpy(uuid, f2fssb.s_uuid, sizeof(f2fssb.s_uuid)); + namesize = sizeof(f2fssb.s_volume_name); + *label = smalloc(namesize + 1); + sstrncpy(*label, (char *)f2fssb.s_volume_name, namesize); + rv = 0; + } close(fd); return rv; } @@ -7,6 +7,7 @@ #define MNTTYPE_EXT2 "ext2" /* 2nd Extended file system */ #define MNTTYPE_EXT3 "ext3" /* ext2 + journaling */ #define MNTTYPE_EXT4 "ext4" /* ext4 filesystem */ +#define MNTTYPE_F2FS "f2fs" /* f2fs filesystem */ #define MNTTYPE_NEXT3 "next3" /* next3 filesystem */ #define MNTTYPE_EXT4DEV "ext4dev"/* ext4dev filesystem */ #define MNTTYPE_MINIX "minix" /* MINIX file system */ @@ -769,7 +769,7 @@ static int hasquota(const char *dev, struct mntent *mnt, int type, int flags) * standard GETFMT quotactl because that does not distinguish between * quota in system file and quota in ordinary file. */ - if (!strcmp(mnt->mnt_type, MNTTYPE_EXT4)) { + if (!strcmp(mnt->mnt_type, MNTTYPE_EXT4) || !strcmp(mnt->mnt_type, MNTTYPE_F2FS)) { struct if_dqinfo kinfo; if (quotactl(QCMD(Q_GETINFO, type), dev, 0, (void *)&kinfo) == 0) { |