Skip to content

Commit 9b7365f

Browse files
mtfstytso
authored andcommitted
ext4: add FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
This patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface support for ext4. The interface is kept consistent with XFS_IOC_FSGETXATTR/XFS_IOC_FSGETXATTR. Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Reviewed-by: Jan Kara <jack@suse.cz>
1 parent 689c958 commit 9b7365f

File tree

2 files changed

+336
-87
lines changed

2 files changed

+336
-87
lines changed

fs/ext4/ext4.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ struct flex_groups {
381381
#define EXT4_FL_USER_VISIBLE 0x304BDFFF /* User visible flags */
382382
#define EXT4_FL_USER_MODIFIABLE 0x204380FF /* User modifiable flags */
383383

384+
#define EXT4_FL_XFLAG_VISIBLE (EXT4_SYNC_FL | \
385+
EXT4_IMMUTABLE_FL | \
386+
EXT4_APPEND_FL | \
387+
EXT4_NODUMP_FL | \
388+
EXT4_NOATIME_FL | \
389+
EXT4_PROJINHERIT_FL)
390+
384391
/* Flags that should be inherited by new inodes from their parent. */
385392
#define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\
386393
EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\
@@ -619,6 +626,46 @@ enum {
619626
#define EXT4_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16])
620627
#define EXT4_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct ext4_encryption_policy)
621628

629+
#ifndef FS_IOC_FSGETXATTR
630+
/* Until the uapi changes get merged for project quota... */
631+
632+
#define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr)
633+
#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
634+
635+
/*
636+
* Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR.
637+
*/
638+
struct fsxattr {
639+
__u32 fsx_xflags; /* xflags field value (get/set) */
640+
__u32 fsx_extsize; /* extsize field value (get/set)*/
641+
__u32 fsx_nextents; /* nextents field value (get) */
642+
__u32 fsx_projid; /* project identifier (get/set) */
643+
unsigned char fsx_pad[12];
644+
};
645+
646+
/*
647+
* Flags for the fsx_xflags field
648+
*/
649+
#define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */
650+
#define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */
651+
#define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */
652+
#define FS_XFLAG_APPEND 0x00000010 /* all writes append */
653+
#define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
654+
#define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */
655+
#define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
656+
#define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
657+
#define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
658+
#define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
659+
#define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
660+
#define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
661+
#define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
662+
#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
663+
#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
664+
#endif /* !defined(FS_IOC_FSGETXATTR) */
665+
666+
#define EXT4_IOC_FSGETXATTR FS_IOC_FSGETXATTR
667+
#define EXT4_IOC_FSSETXATTR FS_IOC_FSSETXATTR
668+
622669
#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
623670
/*
624671
* ioctl commands in 32 bit emulation

0 commit comments

Comments
 (0)