diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2021-03-02 02:37:10 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2021-03-08 16:19:35 +0100 |
commit | 6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85 (patch) | |
tree | ef51a46d8ebbfa4300e6fa4f1c20b171b351bf13 /fs/9p/vfs_inode_dotl.c | |
parent | Linux 5.12-rc2 (diff) | |
download | linux-6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85.tar.xz linux-6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85.zip |
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/9p/vfs_inode_dotl.c')
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 1dc7af046615..df0b87b05c42 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -59,7 +59,7 @@ static int v9fs_test_inode_dotl(struct inode *inode, void *data) struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; /* don't match inode of different type */ - if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) + if (inode_wrong_type(inode, st->st_mode)) return 0; if (inode->i_generation != st->st_gen) @@ -959,7 +959,7 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) /* * Don't update inode if the file type is different */ - if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) + if (inode_wrong_type(inode, st->st_mode)) goto out; /* |