netns xfrm: fix "ip xfrm state|policy count" misreport
[safe/jmp/linux-2.6] / fs / ufs / namei.c
index abd5f23..4c26d9e 100644 (file)
 
 #include <linux/time.h>
 #include <linux/fs.h>
-#include <linux/ufs_fs.h>
 #include <linux/smp_lock.h>
-#include "swab.h"      /* will go away - see comment in mknod() */
+
+#include "ufs_fs.h"
+#include "ufs.h"
 #include "util.h"
 
 static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode)
@@ -55,12 +56,12 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, stru
                return ERR_PTR(-ENAMETOOLONG);
 
        lock_kernel();
-       ino = ufs_inode_by_name(dir, dentry);
+       ino = ufs_inode_by_name(dir, &dentry->d_name);
        if (ino) {
-               inode = iget(dir->i_sb, ino);
-               if (!inode) {
+               inode = ufs_iget(dir->i_sb, ino);
+               if (IS_ERR(inode)) {
                        unlock_kernel();
-                       return ERR_PTR(-EACCES);
+                       return ERR_CAST(inode);
                }
        }
        unlock_kernel();
@@ -110,7 +111,6 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t
        err = PTR_ERR(inode);
        if (!IS_ERR(inode)) {
                init_special_inode(inode, mode, rdev);
-               /* NOTE: that'll go when we get wide dev_t */
                ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev);
                mark_inode_dirty(inode);
                lock_kernel();
@@ -129,7 +129,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
        struct inode * inode;
 
        if (l > sb->s_blocksize)
-               goto out;
+               goto out_notlocked;
 
        lock_kernel();
        inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
@@ -147,7 +147,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
        } else {
                /* fast symlink */
                inode->i_op = &ufs_fast_symlink_inode_operations;
-               memcpy((char*)&UFS_I(inode)->i_u1.i_data,symname,l);
+               memcpy(UFS_I(inode)->i_u1.i_symlink, symname, l);
                inode->i_size = l-1;
        }
        mark_inode_dirty(inode);
@@ -155,6 +155,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
        err = ufs_add_nondir(dentry, inode);
 out:
        unlock_kernel();
+out_notlocked:
        return err;
 
 out_fail:
@@ -236,7 +237,7 @@ static int ufs_unlink(struct inode *dir, struct dentry *dentry)
        struct page *page;
        int err = -ENOENT;
 
-       de = ufs_find_entry(dir, dentry, &page);
+       de = ufs_find_entry(dir, &dentry->d_name, &page);
        if (!de)
                goto out;
 
@@ -280,7 +281,7 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
        struct ufs_dir_entry *old_de;
        int err = -ENOENT;
 
-       old_de = ufs_find_entry(old_dir, old_dentry, &old_page);
+       old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page);
        if (!old_de)
                goto out;
 
@@ -300,14 +301,14 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
                        goto out_dir;
 
                err = -ENOENT;
-               new_de = ufs_find_entry(new_dir, new_dentry, &new_page);
+               new_de = ufs_find_entry(new_dir, &new_dentry->d_name, &new_page);
                if (!new_de)
                        goto out_dir;
                inode_inc_link_count(old_inode);
                ufs_set_link(new_dir, new_de, new_page, old_inode);
                new_inode->i_ctime = CURRENT_TIME_SEC;
                if (dir_de)
-                       new_inode->i_nlink--;
+                       drop_nlink(new_inode);
                inode_dec_link_count(new_inode);
        } else {
                if (dir_de) {
@@ -354,7 +355,7 @@ out:
        return err;
 }
 
-struct inode_operations ufs_dir_inode_operations = {
+const struct inode_operations ufs_dir_inode_operations = {
        .create         = ufs_create,
        .lookup         = ufs_lookup,
        .link           = ufs_link,