]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/coda/dir.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[linux-2.6-omap-h63xx.git] / fs / coda / dir.c
index 04a3dd84c99340d6875a97702bd3ad5577553e83..75b1fa90b2cb8ee205efc96bbbb8a7c71fc9a1e1 100644 (file)
@@ -86,7 +86,6 @@ const struct file_operations coda_dir_operations = {
        .read           = generic_read_dir,
        .readdir        = coda_readdir,
        .open           = coda_open,
-       .flush          = coda_flush,
        .release        = coda_release,
        .fsync          = coda_fsync,
 };
@@ -138,13 +137,18 @@ exit:
 }
 
 
-int coda_permission(struct inode *inode, int mask, struct nameidata *nd)
+int coda_permission(struct inode *inode, int mask)
 {
         int error = 0;
+
+       mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
  
        if (!mask)
                return 0; 
 
+       if ((mask & MAY_EXEC) && !execute_ok(inode))
+               return -EACCES;
+
        lock_kernel();
 
        if (coda_cache_check(inode, mask))
@@ -346,7 +350,7 @@ static int coda_symlink(struct inode *dir_inode, struct dentry *de,
 }
 
 /* destruction routines: unlink, rmdir */
-int coda_unlink(struct inode *dir, struct dentry *de)
+static int coda_unlink(struct inode *dir, struct dentry *de)
 {
         int error;
        const char *name = de->d_name.name;
@@ -366,7 +370,7 @@ int coda_unlink(struct inode *dir, struct dentry *de)
        return 0;
 }
 
-int coda_rmdir(struct inode *dir, struct dentry *de)
+static int coda_rmdir(struct inode *dir, struct dentry *de)
 {
        const char *name = de->d_name.name;
        int len = de->d_name.len;
@@ -425,7 +429,7 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 
 /* file operations for directories */
-int coda_readdir(struct file *coda_file, void *buf, filldir_t filldir)
+static int coda_readdir(struct file *coda_file, void *buf, filldir_t filldir)
 {
        struct coda_file_info *cfi;
        struct file *host_file;
@@ -510,20 +514,20 @@ static int coda_venus_readdir(struct file *coda_file, void *buf,
        vdir = kmalloc(sizeof(*vdir), GFP_KERNEL);
        if (!vdir) return -ENOMEM;
 
-       switch (coda_file->f_pos) {
-       case 0:
+       if (coda_file->f_pos == 0) {
                ret = filldir(buf, ".", 1, 0, de->d_inode->i_ino, DT_DIR);
-               if (ret < 0) break;
+               if (ret < 0)
+                       goto out;
                result++;
                coda_file->f_pos++;
-               /* fallthrough */
-       case 1:
+       }
+       if (coda_file->f_pos == 1) {
                ret = filldir(buf, "..", 2, 1, de->d_parent->d_inode->i_ino, DT_DIR);
-               if (ret < 0) break;
+               if (ret < 0)
+                       goto out;
                result++;
                coda_file->f_pos++;
-               /* fallthrough */
-       default:
+       }
        while (1) {
                /* read entries from the directory file */
                ret = kernel_read(host_file, coda_file->f_pos - 2, (char *)vdir,
@@ -578,7 +582,7 @@ static int coda_venus_readdir(struct file *coda_file, void *buf,
                 * we've already established it is non-zero. */
                coda_file->f_pos += vdir->d_reclen;
        }
-       }
+out:
        kfree(vdir);
        return result ? result : ret;
 }