mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
UPSTREAM: new helper: inode_wrong_type()
commit 6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85 upstream. 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. Change-Id: I346cb7a2d1cec2ca16096962d8adc9d7f848fc94 Signed-off-by: Al Viro <[email protected]> Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
462f12c6dc
commit
831d8c1175
10 changed files with 22 additions and 18 deletions
|
|
@ -455,7 +455,7 @@ static int v9fs_test_inode(struct inode *inode, void *data)
|
|||
|
||||
umode = p9mode2unixmode(v9ses, st, &rdev);
|
||||
/* don't match inode of different type */
|
||||
if ((inode->i_mode & S_IFMT) != (umode & S_IFMT))
|
||||
if (inode_wrong_type(inode, umode))
|
||||
return 0;
|
||||
|
||||
/* compare qid details */
|
||||
|
|
@ -1412,7 +1412,7 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
|
|||
* Don't update inode if the file type is different
|
||||
*/
|
||||
umode = p9mode2unixmode(v9ses, st, &rdev);
|
||||
if ((inode->i_mode & S_IFMT) != (umode & S_IFMT))
|
||||
if (inode_wrong_type(inode, umode))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -924,7 +924,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;
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue