X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Fgfs2%2Feaops.c;h=cd747c00f670363db6f2dbe41164858e56b4778f;hb=cfee47f99bc14a6d7c6b0be2284db2cef310a815;hp=2243b44ecb0738c91b992ace3ce21d91081ec1b5;hpb=639b6d79b8c20cce4079fb035640c65456324d1c;p=linux-2.6 diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c index 2243b44ecb..cd747c00f6 100644 --- a/fs/gfs2/eaops.c +++ b/fs/gfs2/eaops.c @@ -4,7 +4,7 @@ * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions - * of the GNU General Public License v.2. + * of the GNU General Public License version 2. */ #include @@ -14,10 +14,10 @@ #include #include #include +#include #include #include "gfs2.h" -#include "lm_interface.h" #include "incore.h" #include "acl.h" #include "eaops.h" @@ -31,22 +31,22 @@ * Returns: GFS2_EATYPE_XXX */ -unsigned int gfs2_ea_name2type(const char *name, char **truncated_name) +unsigned int gfs2_ea_name2type(const char *name, const char **truncated_name) { unsigned int type; if (strncmp(name, "system.", 7) == 0) { type = GFS2_EATYPE_SYS; if (truncated_name) - *truncated_name = strchr(name, '.') + 1; + *truncated_name = name + sizeof("system.") - 1; } else if (strncmp(name, "user.", 5) == 0) { type = GFS2_EATYPE_USR; if (truncated_name) - *truncated_name = strchr(name, '.') + 1; + *truncated_name = name + sizeof("user.") - 1; } else if (strncmp(name, "security.", 9) == 0) { type = GFS2_EATYPE_SECURITY; if (truncated_name) - *truncated_name = strchr(name, '.') + 1; + *truncated_name = name + sizeof("security.") - 1; } else { type = GFS2_EATYPE_UNUSED; if (truncated_name) @@ -58,7 +58,7 @@ unsigned int gfs2_ea_name2type(const char *name, char **truncated_name) static int user_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) { - struct inode *inode = ip->i_vnode; + struct inode *inode = &ip->i_inode; int error = permission(inode, MAY_READ, NULL); if (error) return error; @@ -68,7 +68,7 @@ static int user_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) static int user_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) { - struct inode *inode = ip->i_vnode; + struct inode *inode = &ip->i_inode; if (S_ISREG(inode->i_mode) || (S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) { @@ -83,7 +83,7 @@ static int user_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) static int user_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er) { - struct inode *inode = ip->i_vnode; + struct inode *inode = &ip->i_inode; if (S_ISREG(inode->i_mode) || (S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) { @@ -103,7 +103,7 @@ static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) !capable(CAP_SYS_ADMIN)) return -EPERM; - if (ip->i_sbd->sd_args.ar_posix_acl == 0 && + if (GFS2_SB(&ip->i_inode)->sd_args.ar_posix_acl == 0 && (GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len) || GFS2_ACL_IS_DEFAULT(er->er_name, er->er_name_len))) return -EOPNOTSUPP; @@ -120,7 +120,7 @@ static int system_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) if (GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len)) { if (!(er->er_flags & GFS2_ERF_MODE)) { - er->er_mode = ip->i_di.di_mode; + er->er_mode = ip->i_inode.i_mode; er->er_flags |= GFS2_ERF_MODE; } error = gfs2_acl_validate_set(ip, 1, er, @@ -146,7 +146,7 @@ static int system_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) if (error == -ENODATA) error = 0; } - return error; + return error; } return -EPERM; @@ -172,7 +172,7 @@ static int system_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er) static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) { - struct inode *inode = ip->i_vnode; + struct inode *inode = &ip->i_inode; int error = permission(inode, MAY_READ, NULL); if (error) return error; @@ -182,7 +182,7 @@ static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) { - struct inode *inode = ip->i_vnode; + struct inode *inode = &ip->i_inode; int error = permission(inode, MAY_WRITE, NULL); if (error) return error; @@ -192,7 +192,7 @@ static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) static int security_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er) { - struct inode *inode = ip->i_vnode; + struct inode *inode = &ip->i_inode; int error = permission(inode, MAY_WRITE, NULL); if (error) return error; @@ -214,7 +214,7 @@ struct gfs2_eattr_operations gfs2_system_eaops = { .eo_name = "system", }; -struct gfs2_eattr_operations gfs2_security_eaops = { +static struct gfs2_eattr_operations gfs2_security_eaops = { .eo_get = security_eo_get, .eo_set = security_eo_set, .eo_remove = security_eo_remove, @@ -225,5 +225,6 @@ struct gfs2_eattr_operations *gfs2_ea_ops[] = { NULL, &gfs2_user_eaops, &gfs2_system_eaops, + &gfs2_security_eaops, };