diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-10-21 15:20:42 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-10-31 17:48:54 -0400 |
commit | a7400222e3eb7d5ce3820d2234905bbeafabd171 (patch) | |
tree | f630c4138ceb3889e08c5cd0029d2f07ec47dd0a /fs/coda | |
parent | ac7576f4b1da8c9c6bc1ae026c2b9e86ae617ba5 (diff) |
new helper: is_root_inode()
replace open-coded instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/coda')
-rw-r--r-- | fs/coda/coda_linux.c | 6 | ||||
-rw-r--r-- | fs/coda/coda_linux.h | 1 | ||||
-rw-r--r-- | fs/coda/dir.c | 12 |
3 files changed, 6 insertions, 13 deletions
diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c index 1326d38960db..f1714cfb589c 100644 --- a/fs/coda/coda_linux.c +++ b/fs/coda/coda_linux.c | |||
@@ -40,12 +40,6 @@ int coda_iscontrol(const char *name, size_t length) | |||
40 | (strncmp(name, CODA_CONTROL, CODA_CONTROLLEN) == 0)); | 40 | (strncmp(name, CODA_CONTROL, CODA_CONTROLLEN) == 0)); |
41 | } | 41 | } |
42 | 42 | ||
43 | /* recognize /coda inode */ | ||
44 | int coda_isroot(struct inode *i) | ||
45 | { | ||
46 | return ( i->i_sb->s_root->d_inode == i ); | ||
47 | } | ||
48 | |||
49 | unsigned short coda_flags_to_cflags(unsigned short flags) | 43 | unsigned short coda_flags_to_cflags(unsigned short flags) |
50 | { | 44 | { |
51 | unsigned short coda_flags = 0; | 45 | unsigned short coda_flags = 0; |
diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h index d42b725b1d21..d6f7a76a1f5b 100644 --- a/fs/coda/coda_linux.h +++ b/fs/coda/coda_linux.h | |||
@@ -52,7 +52,6 @@ int coda_setattr(struct dentry *, struct iattr *); | |||
52 | 52 | ||
53 | /* this file: heloers */ | 53 | /* this file: heloers */ |
54 | char *coda_f2s(struct CodaFid *f); | 54 | char *coda_f2s(struct CodaFid *f); |
55 | int coda_isroot(struct inode *i); | ||
56 | int coda_iscontrol(const char *name, size_t length); | 55 | int coda_iscontrol(const char *name, size_t length); |
57 | 56 | ||
58 | void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); | 57 | void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 9c3dedc000d1..7ff025966e4f 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -107,7 +107,7 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsig | |||
107 | } | 107 | } |
108 | 108 | ||
109 | /* control object, create inode on the fly */ | 109 | /* control object, create inode on the fly */ |
110 | if (coda_isroot(dir) && coda_iscontrol(name, length)) { | 110 | if (is_root_inode(dir) && coda_iscontrol(name, length)) { |
111 | inode = coda_cnode_makectl(sb); | 111 | inode = coda_cnode_makectl(sb); |
112 | type = CODA_NOCACHE; | 112 | type = CODA_NOCACHE; |
113 | } else { | 113 | } else { |
@@ -195,7 +195,7 @@ static int coda_create(struct inode *dir, struct dentry *de, umode_t mode, bool | |||
195 | struct CodaFid newfid; | 195 | struct CodaFid newfid; |
196 | struct coda_vattr attrs; | 196 | struct coda_vattr attrs; |
197 | 197 | ||
198 | if (coda_isroot(dir) && coda_iscontrol(name, length)) | 198 | if (is_root_inode(dir) && coda_iscontrol(name, length)) |
199 | return -EPERM; | 199 | return -EPERM; |
200 | 200 | ||
201 | error = venus_create(dir->i_sb, coda_i2f(dir), name, length, | 201 | error = venus_create(dir->i_sb, coda_i2f(dir), name, length, |
@@ -227,7 +227,7 @@ static int coda_mkdir(struct inode *dir, struct dentry *de, umode_t mode) | |||
227 | int error; | 227 | int error; |
228 | struct CodaFid newfid; | 228 | struct CodaFid newfid; |
229 | 229 | ||
230 | if (coda_isroot(dir) && coda_iscontrol(name, len)) | 230 | if (is_root_inode(dir) && coda_iscontrol(name, len)) |
231 | return -EPERM; | 231 | return -EPERM; |
232 | 232 | ||
233 | attrs.va_mode = mode; | 233 | attrs.va_mode = mode; |
@@ -261,7 +261,7 @@ static int coda_link(struct dentry *source_de, struct inode *dir_inode, | |||
261 | int len = de->d_name.len; | 261 | int len = de->d_name.len; |
262 | int error; | 262 | int error; |
263 | 263 | ||
264 | if (coda_isroot(dir_inode) && coda_iscontrol(name, len)) | 264 | if (is_root_inode(dir_inode) && coda_iscontrol(name, len)) |
265 | return -EPERM; | 265 | return -EPERM; |
266 | 266 | ||
267 | error = venus_link(dir_inode->i_sb, coda_i2f(inode), | 267 | error = venus_link(dir_inode->i_sb, coda_i2f(inode), |
@@ -287,7 +287,7 @@ static int coda_symlink(struct inode *dir_inode, struct dentry *de, | |||
287 | int symlen; | 287 | int symlen; |
288 | int error; | 288 | int error; |
289 | 289 | ||
290 | if (coda_isroot(dir_inode) && coda_iscontrol(name, len)) | 290 | if (is_root_inode(dir_inode) && coda_iscontrol(name, len)) |
291 | return -EPERM; | 291 | return -EPERM; |
292 | 292 | ||
293 | symlen = strlen(symname); | 293 | symlen = strlen(symname); |
@@ -507,7 +507,7 @@ static int coda_dentry_revalidate(struct dentry *de, unsigned int flags) | |||
507 | return -ECHILD; | 507 | return -ECHILD; |
508 | 508 | ||
509 | inode = de->d_inode; | 509 | inode = de->d_inode; |
510 | if (!inode || coda_isroot(inode)) | 510 | if (!inode || is_root_inode(inode)) |
511 | goto out; | 511 | goto out; |
512 | if (is_bad_inode(inode)) | 512 | if (is_bad_inode(inode)) |
513 | goto bad; | 513 | goto bad; |