diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2021-03-01 20:37:10 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2021-03-08 10:19:35 -0500 |
commit | 6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85 (patch) | |
tree | ef51a46d8ebbfa4300e6fa4f1c20b171b351bf13 /fs/fuse/dir.c | |
parent | a38fd8748464831584a19438cbb3082b5a2dab15 (diff) |
new helper: inode_wrong_type()
inode_wrong_type(inode, mode) returns true if setting inode->i_mode
to given value would've changed the inode type. We have enough of
those checks open-coded to make a helper worthwhile.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r-- | fs/fuse/dir.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 06a18700a845..2400b98e8808 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -252,7 +252,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) if (ret == -ENOMEM) goto out; if (ret || fuse_invalid_attr(&outarg.attr) || - (outarg.attr.mode ^ inode->i_mode) & S_IFMT) + inode_wrong_type(inode, outarg.attr.mode)) goto invalid; forget_all_cached_acls(inode); @@ -1054,7 +1054,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat, err = fuse_simple_request(fm, &args); if (!err) { if (fuse_invalid_attr(&outarg.attr) || - (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { + inode_wrong_type(inode, outarg.attr.mode)) { fuse_make_bad(inode); err = -EIO; } else { @@ -1703,7 +1703,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, } if (fuse_invalid_attr(&outarg.attr) || - (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { + inode_wrong_type(inode, outarg.attr.mode)) { fuse_make_bad(inode); err = -EIO; goto error; |