sh: convert /proc/cpu/aligmnent, /proc/cpu/kernel_alignment to seq_file
[safe/jmp/linux-2.6] / fs / afs / dir.c
index dbbe75d..88067f3 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,8 @@ const struct file_operations afs_dir_file_operations = {
        .open           = afs_dir_open,
        .release        = afs_release,
        .readdir        = afs_readdir,
+       .lock           = afs_lock,
+       .llseek         = generic_file_llseek,
 };
 
 const struct inode_operations afs_dir_inode_operations = {
@@ -55,10 +58,11 @@ const struct inode_operations afs_dir_inode_operations = {
        .rmdir          = afs_rmdir,
        .rename         = afs_rename,
        .permission     = afs_permission,
-       .getattr        = afs_inode_getattr,
+       .getattr        = afs_getattr,
+       .setattr        = afs_setattr,
 };
 
-static struct dentry_operations afs_fs_dentry_operations = {
+static const struct dentry_operations afs_fs_dentry_operations = {
        .d_revalidate   = afs_d_revalidate,
        .d_delete       = afs_d_delete,
        .d_release      = afs_d_release,
@@ -137,7 +141,7 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
 
        if (page->index == 0 && qty != ntohs(dbuf->blocks[0].pagehdr.npages)) {
                printk("kAFS: %s(%lu): wrong number of dir blocks %d!=%hu\n",
-                      __FUNCTION__, dir->i_ino, qty,
+                      __func__, dir->i_ino, qty,
                       ntohs(dbuf->blocks[0].pagehdr.npages));
                goto error;
        }
@@ -156,7 +160,7 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
        for (tmp = 0; tmp < qty; tmp++) {
                if (dbuf->blocks[tmp].pagehdr.magic != AFS_DIR_MAGIC) {
                        printk("kAFS: %s(%lu): bad magic %d/%d is %04hx\n",
-                              __FUNCTION__, dir->i_ino, tmp, qty,
+                              __func__, dir->i_ino, tmp, qty,
                               ntohs(dbuf->blocks[tmp].pagehdr.magic));
                        goto error;
                }
@@ -194,10 +198,7 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index,
 
        page = read_mapping_page(dir->i_mapping, index, &file);
        if (!IS_ERR(page)) {
-               wait_on_page_locked(page);
                kmap(page);
-               if (!PageUptodate(page))
-                       goto fail;
                if (!PageChecked(page))
                        afs_dir_check_page(dir, page);
                if (PageError(page))
@@ -419,7 +420,8 @@ static int afs_lookup_filldir(void *_cookie, const char *name, int nlen,
        struct afs_lookup_cookie *cookie = _cookie;
 
        _enter("{%s,%Zu},%s,%u,,%llu,%u",
-              cookie->name, cookie->nlen, name, nlen, ino, dtype);
+              cookie->name, cookie->nlen, name, nlen,
+              (unsigned long long) ino, dtype);
 
        /* insanity checks first */
        BUILD_BUG_ON(sizeof(union afs_dir_block) != 2048);
@@ -493,12 +495,12 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
 
        vnode = AFS_FS_I(dir);
 
-       _enter("{%x:%d},%p{%s},",
+       _enter("{%x:%u},%p{%s},",
               vnode->fid.vid, vnode->fid.vnode, dentry, dentry->d_name.name);
 
        ASSERTCMP(dentry->d_inode, ==, NULL);
 
-       if (dentry->d_name.len > 255) {
+       if (dentry->d_name.len >= AFSNAMEMAX) {
                _leave(" = -ENAMETOOLONG");
                return ERR_PTR(-ENAMETOOLONG);
        }
@@ -511,7 +513,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);
@@ -539,17 +541,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;
 }
@@ -562,7 +564,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
 static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
 {
        struct afs_vnode *vnode, *dir;
-       struct afs_fid fid;
+       struct afs_fid uninitialized_var(fid);
        struct dentry *parent;
        struct key *key;
        void *dir_version;
@@ -629,9 +631,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);
@@ -733,11 +736,11 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        dvnode = AFS_FS_I(dir);
 
-       _enter("{%x:%d},{%s},%o",
+       _enter("{%x:%u},{%s},%o",
               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);
@@ -798,11 +801,11 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
 
        dvnode = AFS_FS_I(dir);
 
-       _enter("{%x:%d},{%s}",
+       _enter("{%x:%u},{%s}",
               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);
@@ -844,11 +847,11 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
 
        dvnode = AFS_FS_I(dir);
 
-       _enter("{%x:%d},{%s}",
+       _enter("{%x:%u},{%s}",
               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);
@@ -918,11 +921,11 @@ static int afs_create(struct inode *dir, struct dentry *dentry, int mode,
 
        dvnode = AFS_FS_I(dir);
 
-       _enter("{%x:%d},{%s},%o,",
+       _enter("{%x:%u},{%s},%o,",
               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);
@@ -985,13 +988,13 @@ static int afs_link(struct dentry *from, struct inode *dir,
        vnode = AFS_FS_I(from->d_inode);
        dvnode = AFS_FS_I(dir);
 
-       _enter("{%x:%d},{%x:%d},{%s}",
+       _enter("{%x:%u},{%x:%u},{%s}",
               vnode->fid.vid, vnode->fid.vnode,
               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);
@@ -1034,16 +1037,16 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
 
        dvnode = AFS_FS_I(dir);
 
-       _enter("{%x:%d},{%s},%s",
+       _enter("{%x:%u},{%s},%s",
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name,
               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);
@@ -1106,14 +1109,14 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
        orig_dvnode = AFS_FS_I(old_dir);
        new_dvnode = AFS_FS_I(new_dir);
 
-       _enter("{%x:%d},{%x:%d},{%x:%d},{%s}",
+       _enter("{%x:%u},{%x:%u},{%x:%u},{%s}",
               orig_dvnode->fid.vid, orig_dvnode->fid.vnode,
               vnode->fid.vid, vnode->fid.vnode,
               new_dvnode->fid.vid, new_dvnode->fid.vnode,
               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);