diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-10 11:11:49 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-10 11:13:16 -0500 |
commit | f4947fbce208990266920d51837e4e7ba9779db1 (patch) | |
tree | a541edc5de897ce03f54d83c1a1c8147ce22b605 /fs/coda | |
parent | 0b2c4e39c014219ef73f05ab580c284bf8e6af0a (diff) |
coda: switch coda_cnode_make() to sane API as well, clean coda_lookup()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/coda')
-rw-r--r-- | fs/coda/cnode.c | 17 | ||||
-rw-r--r-- | fs/coda/coda_fs_i.h | 2 | ||||
-rw-r--r-- | fs/coda/dir.c | 29 | ||||
-rw-r--r-- | fs/coda/inode.c | 10 |
4 files changed, 27 insertions, 31 deletions
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c index 8af67c9c47dd..911cf30d057d 100644 --- a/fs/coda/cnode.c +++ b/fs/coda/cnode.c | |||
@@ -88,24 +88,21 @@ struct inode * coda_iget(struct super_block * sb, struct CodaFid * fid, | |||
88 | - link the two up if this is needed | 88 | - link the two up if this is needed |
89 | - fill in the attributes | 89 | - fill in the attributes |
90 | */ | 90 | */ |
91 | int coda_cnode_make(struct inode **inode, struct CodaFid *fid, struct super_block *sb) | 91 | struct inode *coda_cnode_make(struct CodaFid *fid, struct super_block *sb) |
92 | { | 92 | { |
93 | struct coda_vattr attr; | 93 | struct coda_vattr attr; |
94 | struct inode *inode; | ||
94 | int error; | 95 | int error; |
95 | 96 | ||
96 | /* We get inode numbers from Venus -- see venus source */ | 97 | /* We get inode numbers from Venus -- see venus source */ |
97 | error = venus_getattr(sb, fid, &attr); | 98 | error = venus_getattr(sb, fid, &attr); |
98 | if ( error ) { | 99 | if (error) |
99 | *inode = NULL; | 100 | return ERR_PTR(error); |
100 | return error; | ||
101 | } | ||
102 | 101 | ||
103 | *inode = coda_iget(sb, fid, &attr); | 102 | inode = coda_iget(sb, fid, &attr); |
104 | if ( IS_ERR(*inode) ) { | 103 | if (IS_ERR(inode)) |
105 | printk("coda_cnode_make: coda_iget failed\n"); | 104 | printk("coda_cnode_make: coda_iget failed\n"); |
106 | return PTR_ERR(*inode); | 105 | return inode; |
107 | } | ||
108 | return 0; | ||
109 | } | 106 | } |
110 | 107 | ||
111 | 108 | ||
diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h index 1c17446f1afe..b24fdfd8a3f0 100644 --- a/fs/coda/coda_fs_i.h +++ b/fs/coda/coda_fs_i.h | |||
@@ -49,7 +49,7 @@ struct coda_file_info { | |||
49 | #define C_DYING 0x4 /* from venus (which died) */ | 49 | #define C_DYING 0x4 /* from venus (which died) */ |
50 | #define C_PURGE 0x8 | 50 | #define C_PURGE 0x8 |
51 | 51 | ||
52 | int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *); | 52 | struct inode *coda_cnode_make(struct CodaFid *, struct super_block *); |
53 | struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); | 53 | struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); |
54 | struct inode *coda_cnode_makectl(struct super_block *sb); | 54 | struct inode *coda_cnode_makectl(struct super_block *sb); |
55 | struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); | 55 | struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index df0f9c1b01d3..177515829062 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -96,12 +96,11 @@ const struct file_operations coda_dir_operations = { | |||
96 | /* access routines: lookup, readlink, permission */ | 96 | /* access routines: lookup, readlink, permission */ |
97 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd) | 97 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd) |
98 | { | 98 | { |
99 | struct inode *inode = NULL; | 99 | struct super_block *sb = dir->i_sb; |
100 | struct CodaFid resfid = { { 0, } }; | ||
101 | int type = 0; | ||
102 | int error = 0; | ||
103 | const char *name = entry->d_name.name; | 100 | const char *name = entry->d_name.name; |
104 | size_t length = entry->d_name.len; | 101 | size_t length = entry->d_name.len; |
102 | struct inode *inode; | ||
103 | int type = 0; | ||
105 | 104 | ||
106 | if (length > CODA_MAXNAMLEN) { | 105 | if (length > CODA_MAXNAMLEN) { |
107 | printk(KERN_ERR "name too long: lookup, %s (%*s)\n", | 106 | printk(KERN_ERR "name too long: lookup, %s (%*s)\n", |
@@ -111,23 +110,21 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc | |||
111 | 110 | ||
112 | /* control object, create inode on the fly */ | 111 | /* control object, create inode on the fly */ |
113 | if (coda_isroot(dir) && coda_iscontrol(name, length)) { | 112 | if (coda_isroot(dir) && coda_iscontrol(name, length)) { |
114 | inode = coda_cnode_makectl(dir->i_sb); | 113 | inode = coda_cnode_makectl(sb); |
115 | type = CODA_NOCACHE; | 114 | type = CODA_NOCACHE; |
116 | goto exit; | 115 | } else { |
116 | struct CodaFid fid = { { 0, } }; | ||
117 | int error = venus_lookup(sb, coda_i2f(dir), name, length, | ||
118 | &type, &fid); | ||
119 | inode = !error ? coda_cnode_make(&fid, sb) : ERR_PTR(error); | ||
117 | } | 120 | } |
118 | 121 | ||
119 | error = venus_lookup(dir->i_sb, coda_i2f(dir), name, length, | 122 | if (!IS_ERR(inode) && (type & CODA_NOCACHE)) |
120 | &type, &resfid); | ||
121 | if (!error) | ||
122 | error = coda_cnode_make(&inode, &resfid, dir->i_sb); | ||
123 | |||
124 | if (error && error != -ENOENT) | ||
125 | return ERR_PTR(error); | ||
126 | |||
127 | exit: | ||
128 | if (inode && !IS_ERR(inode) && (type & CODA_NOCACHE)) | ||
129 | coda_flag_inode(inode, C_VATTR | C_PURGE); | 123 | coda_flag_inode(inode, C_VATTR | C_PURGE); |
130 | 124 | ||
125 | if (inode == ERR_PTR(-ENOENT)) | ||
126 | inode = NULL; | ||
127 | |||
131 | return d_splice_alias(inode, entry); | 128 | return d_splice_alias(inode, entry); |
132 | } | 129 | } |
133 | 130 | ||
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 1c08a8cd673a..5e2e1b3f068d 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
@@ -204,10 +204,12 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
204 | printk("coda_read_super: rootfid is %s\n", coda_f2s(&fid)); | 204 | printk("coda_read_super: rootfid is %s\n", coda_f2s(&fid)); |
205 | 205 | ||
206 | /* make root inode */ | 206 | /* make root inode */ |
207 | error = coda_cnode_make(&root, &fid, sb); | 207 | root = coda_cnode_make(&fid, sb); |
208 | if ( error || !root ) { | 208 | if (IS_ERR(root)) { |
209 | printk("Failure of coda_cnode_make for root: error %d\n", error); | 209 | error = PTR_ERR(root); |
210 | goto error; | 210 | printk("Failure of coda_cnode_make for root: error %d\n", error); |
211 | root = NULL; | ||
212 | goto error; | ||
211 | } | 213 | } |
212 | 214 | ||
213 | printk("coda_read_super: rootinode is %ld dev %s\n", | 215 | printk("coda_read_super: rootinode is %ld dev %s\n", |