Convert ERR_PTR(PTR_ERR(p)) instances to ERR_CAST(p)
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / afs / dir.c
index 2fb31276196bbc32d5c6fab51c12b8e7132c37e2..b58af8f18bc4d36a849e7f314b9c809834a96bae 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/ctype.h>
+#include <linux/sched.h>
 #include "internal.h"
 
 static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
@@ -43,6 +44,7 @@ const struct file_operations afs_dir_file_operations = {
        .open           = afs_dir_open,
        .release        = afs_release,
        .readdir        = afs_readdir,
+       .lock           = afs_lock,
 };
 
 const struct inode_operations afs_dir_inode_operations = {
@@ -497,7 +499,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
 
        ASSERTCMP(dentry->d_inode, ==, NULL);
 
-       if (dentry->d_name.len > 255) {
+       if (dentry->d_name.len >= AFSNAMEMAX) {
                _leave(" = -ENAMETOOLONG");
                return ERR_PTR(-ENAMETOOLONG);
        }
@@ -510,7 +512,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
        key = afs_request_key(vnode->volume->cell);
        if (IS_ERR(key)) {
                _leave(" = %ld [key]", PTR_ERR(key));
-               return ERR_PTR(PTR_ERR(key));
+               return ERR_CAST(key);
        }
 
        ret = afs_validate(vnode, key);
@@ -538,17 +540,17 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
        key_put(key);
        if (IS_ERR(inode)) {
                _leave(" = %ld", PTR_ERR(inode));
-               return ERR_PTR(PTR_ERR(inode));
+               return ERR_CAST(inode);
        }
 
        dentry->d_op = &afs_fs_dentry_operations;
 
        d_add(dentry, inode);
-       _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%lu }",
+       _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%llu }",
               fid.vnode,
               fid.unique,
               dentry->d_inode->i_ino,
-              dentry->d_inode->i_version);
+              (unsigned long long)dentry->d_inode->i_version);
 
        return NULL;
 }
@@ -628,9 +630,10 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
                 * been deleted and replaced, and the original vnode ID has
                 * been reused */
                if (fid.unique != vnode->fid.unique) {
-                       _debug("%s: file deleted (uq %u -> %u I:%lu)",
+                       _debug("%s: file deleted (uq %u -> %u I:%llu)",
                               dentry->d_name.name, fid.unique,
-                              vnode->fid.unique, dentry->d_inode->i_version);
+                              vnode->fid.unique,
+                              (unsigned long long)dentry->d_inode->i_version);
                        spin_lock(&vnode->lock);
                        set_bit(AFS_VNODE_DELETED, &vnode->flags);
                        spin_unlock(&vnode->lock);
@@ -736,7 +739,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
 
        ret = -ENAMETOOLONG;
-       if (dentry->d_name.len > 255)
+       if (dentry->d_name.len >= AFSNAMEMAX)
                goto error;
 
        key = afs_request_key(dvnode->volume->cell);
@@ -801,7 +804,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);
 
        ret = -ENAMETOOLONG;
-       if (dentry->d_name.len > 255)
+       if (dentry->d_name.len >= AFSNAMEMAX)
                goto error;
 
        key = afs_request_key(dvnode->volume->cell);
@@ -847,7 +850,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);
 
        ret = -ENAMETOOLONG;
-       if (dentry->d_name.len > 255)
+       if (dentry->d_name.len >= AFSNAMEMAX)
                goto error;
 
        key = afs_request_key(dvnode->volume->cell);
@@ -921,7 +924,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, int mode,
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
 
        ret = -ENAMETOOLONG;
-       if (dentry->d_name.len > 255)
+       if (dentry->d_name.len >= AFSNAMEMAX)
                goto error;
 
        key = afs_request_key(dvnode->volume->cell);
@@ -990,7 +993,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
               dentry->d_name.name);
 
        ret = -ENAMETOOLONG;
-       if (dentry->d_name.len > 255)
+       if (dentry->d_name.len >= AFSNAMEMAX)
                goto error;
 
        key = afs_request_key(dvnode->volume->cell);
@@ -1038,11 +1041,11 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
               content);
 
        ret = -ENAMETOOLONG;
-       if (dentry->d_name.len > 255)
+       if (dentry->d_name.len >= AFSNAMEMAX)
                goto error;
 
        ret = -EINVAL;
-       if (strlen(content) > 1023)
+       if (strlen(content) >= AFSPATHMAX)
                goto error;
 
        key = afs_request_key(dvnode->volume->cell);
@@ -1112,7 +1115,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
               new_dentry->d_name.name);
 
        ret = -ENAMETOOLONG;
-       if (new_dentry->d_name.len > 255)
+       if (new_dentry->d_name.len >= AFSNAMEMAX)
                goto error;
 
        key = afs_request_key(orig_dvnode->volume->cell);