return iflags;
}
+#define FUSE2FS_MODIFIABLE_XFLAGS (FS_XFLAG_IMMUTABLE | \
+ FS_XFLAG_APPEND | \
+ FS_XFLAG_SYNC | \
+ FS_XFLAG_NOATIME | \
+ FS_XFLAG_NODUMP | \
+ FS_XFLAG_PROJINHERIT)
+
+#define FUSE2FS_MODIFIABLE_IXFLAGS (FS_IMMUTABLE_FL | \
+ FS_APPEND_FL | \
+ FS_SYNC_FL | \
+ FS_NOATIME_FL | \
+ FS_NODUMP_FL | \
+ FS_PROJINHERIT_FL)
+
+static inline int set_xflags(struct ext2_inode_large *inode, __u32 xflags)
+{
+ __u32 iflags;
+
+ if (xflags & ~FUSE2FS_MODIFIABLE_XFLAGS)
+ return -EINVAL;
+
+ iflags = fsxflags_to_iflags(xflags);
+ inode->i_flags = (inode->i_flags & ~FUSE2FS_MODIFIABLE_IXFLAGS) |
+ (iflags & FUSE2FS_MODIFIABLE_IXFLAGS);
+ return 0;
+}
+
static int ioctl_fssetxattr(struct fuse2fs *ff, struct fuse2fs_file_handle *fh,
void *data)
{
int ret;
struct fuse_context *ctxt = fuse_get_context();
struct fsxattr *fsx = data;
- __u32 flags = fsxflags_to_iflags(fsx->fsx_xflags);
unsigned int inode_size;
FUSE2FS_CHECK_MAGIC(fs, fh, FUSE2FS_FILE_MAGIC);
if (want_check_owner(ff, ctxt) && inode_uid(inode) != ctxt->uid)
return -EPERM;
- ret = set_iflags(&inode, flags);
+ ret = set_xflags(&inode, fsx->fsx_xflags);
if (ret)
return ret;