]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
coda: switch coda_cnode_make() to sane API as well, clean coda_lookup()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 10 Jan 2012 16:11:49 +0000 (11:11 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 10 Jan 2012 16:13:16 +0000 (11:13 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/coda/cnode.c
fs/coda/coda_fs_i.h
fs/coda/dir.c
fs/coda/inode.c

index 8af67c9c47dd49ad0bfb326074663f68210a3cd5..911cf30d057d21b3e7608a0b3f5f1855dacaf584 100644 (file)
@@ -88,24 +88,21 @@ struct inode * coda_iget(struct super_block * sb, struct CodaFid * fid,
    - link the two up if this is needed
    - fill in the attributes
 */
-int coda_cnode_make(struct inode **inode, struct CodaFid *fid, struct super_block *sb)
+struct inode *coda_cnode_make(struct CodaFid *fid, struct super_block *sb)
 {
         struct coda_vattr attr;
+       struct inode *inode;
         int error;
         
        /* We get inode numbers from Venus -- see venus source */
        error = venus_getattr(sb, fid, &attr);
-       if ( error ) {
-           *inode = NULL;
-           return error;
-       } 
+       if (error)
+               return ERR_PTR(error);
 
-       *inode = coda_iget(sb, fid, &attr);
-       if ( IS_ERR(*inode) ) {
+       inode = coda_iget(sb, fid, &attr);
+       if (IS_ERR(inode))
                printk("coda_cnode_make: coda_iget failed\n");
-                return PTR_ERR(*inode);
-        }
-       return 0;
+       return inode;
 }
 
 
index 1c17446f1afec93b684f3bb796f600ef5036f855..b24fdfd8a3f097a091fe5b04362cd437b96ba0f7 100644 (file)
@@ -49,7 +49,7 @@ struct coda_file_info {
 #define C_DYING       0x4   /* from venus (which died) */
 #define C_PURGE       0x8
 
-int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *);
+struct inode *coda_cnode_make(struct CodaFid *, struct super_block *);
 struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr);
 struct inode *coda_cnode_makectl(struct super_block *sb);
 struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
index df0f9c1b01d3ae87d1bdda444588073d395ead99..177515829062d82aed7dcdce9bda390535804614 100644 (file)
@@ -96,12 +96,11 @@ const struct file_operations coda_dir_operations = {
 /* access routines: lookup, readlink, permission */
 static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd)
 {
-       struct inode *inode = NULL;
-       struct CodaFid resfid = { { 0, } };
-       int type = 0;
-       int error = 0;
+       struct super_block *sb = dir->i_sb;
        const char *name = entry->d_name.name;
        size_t length = entry->d_name.len;
+       struct inode *inode;
+       int type = 0;
 
        if (length > CODA_MAXNAMLEN) {
                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
 
        /* control object, create inode on the fly */
        if (coda_isroot(dir) && coda_iscontrol(name, length)) {
-               inode = coda_cnode_makectl(dir->i_sb);
+               inode = coda_cnode_makectl(sb);
                type = CODA_NOCACHE;
-               goto exit;
+       } else {
+               struct CodaFid fid = { { 0, } };
+               int error = venus_lookup(sb, coda_i2f(dir), name, length,
+                                    &type, &fid);
+               inode = !error ? coda_cnode_make(&fid, sb) : ERR_PTR(error);
        }
 
-       error = venus_lookup(dir->i_sb, coda_i2f(dir), name, length,
-                            &type, &resfid);
-       if (!error)
-               error = coda_cnode_make(&inode, &resfid, dir->i_sb);
-
-       if (error && error != -ENOENT)
-               return ERR_PTR(error);
-
-exit:
-       if (inode && !IS_ERR(inode) && (type & CODA_NOCACHE))
+       if (!IS_ERR(inode) && (type & CODA_NOCACHE))
                coda_flag_inode(inode, C_VATTR | C_PURGE);
 
+       if (inode == ERR_PTR(-ENOENT))
+               inode = NULL;
+
        return d_splice_alias(inode, entry);
 }
 
index 1c08a8cd673a917d1e73f68a31ef3bd675c3acd1..5e2e1b3f068d432ab082c43f97b0cb00d3d86000 100644 (file)
@@ -204,10 +204,12 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
        printk("coda_read_super: rootfid is %s\n", coda_f2s(&fid));
        
        /* make root inode */
-        error = coda_cnode_make(&root, &fid, sb);
-        if ( error || !root ) {
-           printk("Failure of coda_cnode_make for root: error %d\n", error);
-           goto error;
+        root = coda_cnode_make(&fid, sb);
+        if (IS_ERR(root)) {
+               error = PTR_ERR(root);
+               printk("Failure of coda_cnode_make for root: error %d\n", error);
+               root = NULL;
+               goto error;
        } 
 
        printk("coda_read_super: rootinode is %ld dev %s\n",