cifs: when renaming don't try to unlink negative dentry
[safe/jmp/linux-2.6] / fs / gfs2 / eaops.c
index c1f4400..dee9b03 100644 (file)
@@ -11,9 +11,9 @@
 #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
+#include <linux/capability.h>
 #include <linux/xattr.h>
 #include <linux/gfs2_ondisk.h>
-#include <linux/lm_interface.h>
 #include <asm/uaccess.h>
 
 #include "gfs2.h"
@@ -55,46 +55,6 @@ unsigned int gfs2_ea_name2type(const char *name, const char **truncated_name)
        return type;
 }
 
-static int user_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
-{
-       struct inode *inode = &ip->i_inode;
-       int error = permission(inode, MAY_READ, NULL);
-       if (error)
-               return error;
-
-       return gfs2_ea_get_i(ip, er);
-}
-
-static int user_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
-{
-       struct inode *inode = &ip->i_inode;
-
-       if (S_ISREG(inode->i_mode) ||
-           (S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) {
-               int error = permission(inode, MAY_WRITE, NULL);
-               if (error)
-                       return error;
-       } else
-               return -EPERM;
-
-       return gfs2_ea_set_i(ip, er);
-}
-
-static int user_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
-{
-       struct inode *inode = &ip->i_inode;
-
-       if (S_ISREG(inode->i_mode) ||
-           (S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) {
-               int error = permission(inode, MAY_WRITE, NULL);
-               if (error)
-                       return error;
-       } else
-               return -EPERM;
-
-       return gfs2_ea_remove_i(ip, er);
-}
-
 static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
 {
        if (!GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len) &&
@@ -107,8 +67,6 @@ static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
             GFS2_ACL_IS_DEFAULT(er->er_name, er->er_name_len)))
                return -EOPNOTSUPP;
 
-
-
        return gfs2_ea_get_i(ip, er);
 }
 
@@ -169,58 +127,28 @@ static int system_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
        return gfs2_ea_remove_i(ip, er);
 }
 
-static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
-{
-       struct inode *inode = &ip->i_inode;
-       int error = permission(inode, MAY_READ, NULL);
-       if (error)
-               return error;
-
-       return gfs2_ea_get_i(ip, er);
-}
-
-static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
-{
-       struct inode *inode = &ip->i_inode;
-       int error = permission(inode, MAY_WRITE, NULL);
-       if (error)
-               return error;
-
-       return gfs2_ea_set_i(ip, er);
-}
-
-static int security_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
-{
-       struct inode *inode = &ip->i_inode;
-       int error = permission(inode, MAY_WRITE, NULL);
-       if (error)
-               return error;
-
-       return gfs2_ea_remove_i(ip, er);
-}
-
-static struct gfs2_eattr_operations gfs2_user_eaops = {
-       .eo_get = user_eo_get,
-       .eo_set = user_eo_set,
-       .eo_remove = user_eo_remove,
+static const struct gfs2_eattr_operations gfs2_user_eaops = {
+       .eo_get = gfs2_ea_get_i,
+       .eo_set = gfs2_ea_set_i,
+       .eo_remove = gfs2_ea_remove_i,
        .eo_name = "user",
 };
 
-struct gfs2_eattr_operations gfs2_system_eaops = {
+const struct gfs2_eattr_operations gfs2_system_eaops = {
        .eo_get = system_eo_get,
        .eo_set = system_eo_set,
        .eo_remove = system_eo_remove,
        .eo_name = "system",
 };
 
-static struct gfs2_eattr_operations gfs2_security_eaops = {
-       .eo_get = security_eo_get,
-       .eo_set = security_eo_set,
-       .eo_remove = security_eo_remove,
+static const struct gfs2_eattr_operations gfs2_security_eaops = {
+       .eo_get = gfs2_ea_get_i,
+       .eo_set = gfs2_ea_set_i,
+       .eo_remove = gfs2_ea_remove_i,
        .eo_name = "security",
 };
 
-struct gfs2_eattr_operations *gfs2_ea_ops[] = {
+const struct gfs2_eattr_operations *gfs2_ea_ops[] = {
        NULL,
        &gfs2_user_eaops,
        &gfs2_system_eaops,