aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/xattr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 15:04:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 15:04:02 -0500
commitbac5e54c29f352d962a2447d22735316b347b9f1 (patch)
tree7642993fa93164835ffaa2dacd341388193f1979 /fs/gfs2/xattr.c
parent529e89430d6c0d64db8ac474cb95e68e2527c79a (diff)
parentc05c4edd876b7ae92787d1295868afcb89b6a348 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (38 commits) direct I/O fallback sync simplification ocfs: stop using do_sync_mapping_range cleanup blockdev_direct_IO locking make generic_acl slightly more generic sanitize xattr handler prototypes libfs: move EXPORT_SYMBOL for d_alloc_name vfs: force reval of target when following LAST_BIND symlinks (try #7) ima: limit imbalance msg Untangling ima mess, part 3: kill dead code in ima Untangling ima mess, part 2: deal with counters Untangling ima mess, part 1: alloc_file() O_TRUNC open shouldn't fail after file truncation ima: call ima_inode_free ima_inode_free IMA: clean up the IMA counts updating code ima: only insert at inode creation time ima: valid return code from ima_inode_alloc fs: move get_empty_filp() deffinition to internal.h Sanitize exec_permission_lite() Kill cached_lookup() and real_lookup() Kill path_lookup_open() ... Trivial conflicts in fs/direct-io.c
Diffstat (limited to 'fs/gfs2/xattr.c')
-rw-r--r--fs/gfs2/xattr.c69
1 files changed, 26 insertions, 43 deletions
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 912f5cbc4740..8a04108e0c22 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -567,18 +567,17 @@ out:
567/** 567/**
568 * gfs2_xattr_get - Get a GFS2 extended attribute 568 * gfs2_xattr_get - Get a GFS2 extended attribute
569 * @inode: The inode 569 * @inode: The inode
570 * @type: The type of extended attribute
571 * @name: The name of the extended attribute 570 * @name: The name of the extended attribute
572 * @buffer: The buffer to write the result into 571 * @buffer: The buffer to write the result into
573 * @size: The size of the buffer 572 * @size: The size of the buffer
573 * @type: The type of extended attribute
574 * 574 *
575 * Returns: actual size of data on success, -errno on error 575 * Returns: actual size of data on success, -errno on error
576 */ 576 */
577 577static int gfs2_xattr_get(struct dentry *dentry, const char *name,
578int gfs2_xattr_get(struct inode *inode, int type, const char *name, 578 void *buffer, size_t size, int type)
579 void *buffer, size_t size)
580{ 579{
581 struct gfs2_inode *ip = GFS2_I(inode); 580 struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
582 struct gfs2_ea_location el; 581 struct gfs2_ea_location el;
583 int error; 582 int error;
584 583
@@ -1119,7 +1118,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1119 1118
1120/** 1119/**
1121 * gfs2_xattr_remove - Remove a GFS2 extended attribute 1120 * gfs2_xattr_remove - Remove a GFS2 extended attribute
1122 * @inode: The inode 1121 * @ip: The inode
1123 * @type: The type of the extended attribute 1122 * @type: The type of the extended attribute
1124 * @name: The name of the extended attribute 1123 * @name: The name of the extended attribute
1125 * 1124 *
@@ -1130,9 +1129,8 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1130 * Returns: 0, or errno on failure 1129 * Returns: 0, or errno on failure
1131 */ 1130 */
1132 1131
1133static int gfs2_xattr_remove(struct inode *inode, int type, const char *name) 1132static int gfs2_xattr_remove(struct gfs2_inode *ip, int type, const char *name)
1134{ 1133{
1135 struct gfs2_inode *ip = GFS2_I(inode);
1136 struct gfs2_ea_location el; 1134 struct gfs2_ea_location el;
1137 int error; 1135 int error;
1138 1136
@@ -1156,24 +1154,24 @@ static int gfs2_xattr_remove(struct inode *inode, int type, const char *name)
1156} 1154}
1157 1155
1158/** 1156/**
1159 * gfs2_xattr_set - Set (or remove) a GFS2 extended attribute 1157 * __gfs2_xattr_set - Set (or remove) a GFS2 extended attribute
1160 * @inode: The inode 1158 * @ip: The inode
1161 * @type: The type of the extended attribute
1162 * @name: The name of the extended attribute 1159 * @name: The name of the extended attribute
1163 * @value: The value of the extended attribute (NULL for remove) 1160 * @value: The value of the extended attribute (NULL for remove)
1164 * @size: The size of the @value argument 1161 * @size: The size of the @value argument
1165 * @flags: Create or Replace 1162 * @flags: Create or Replace
1163 * @type: The type of the extended attribute
1166 * 1164 *
1167 * See gfs2_xattr_remove() for details of the removal of xattrs. 1165 * See gfs2_xattr_remove() for details of the removal of xattrs.
1168 * 1166 *
1169 * Returns: 0 or errno on failure 1167 * Returns: 0 or errno on failure
1170 */ 1168 */
1171 1169
1172int gfs2_xattr_set(struct inode *inode, int type, const char *name, 1170int __gfs2_xattr_set(struct inode *inode, const char *name,
1173 const void *value, size_t size, int flags) 1171 const void *value, size_t size, int flags, int type)
1174{ 1172{
1175 struct gfs2_sbd *sdp = GFS2_SB(inode);
1176 struct gfs2_inode *ip = GFS2_I(inode); 1173 struct gfs2_inode *ip = GFS2_I(inode);
1174 struct gfs2_sbd *sdp = GFS2_SB(inode);
1177 struct gfs2_ea_location el; 1175 struct gfs2_ea_location el;
1178 unsigned int namel = strlen(name); 1176 unsigned int namel = strlen(name);
1179 int error; 1177 int error;
@@ -1184,7 +1182,7 @@ int gfs2_xattr_set(struct inode *inode, int type, const char *name,
1184 return -ERANGE; 1182 return -ERANGE;
1185 1183
1186 if (value == NULL) 1184 if (value == NULL)
1187 return gfs2_xattr_remove(inode, type, name); 1185 return gfs2_xattr_remove(ip, type, name);
1188 1186
1189 if (ea_check_size(sdp, namel, size)) 1187 if (ea_check_size(sdp, namel, size))
1190 return -ERANGE; 1188 return -ERANGE;
@@ -1224,6 +1222,13 @@ int gfs2_xattr_set(struct inode *inode, int type, const char *name,
1224 return error; 1222 return error;
1225} 1223}
1226 1224
1225static int gfs2_xattr_set(struct dentry *dentry, const char *name,
1226 const void *value, size_t size, int flags, int type)
1227{
1228 return __gfs2_xattr_set(dentry->d_inode, name, value,
1229 size, flags, type);
1230}
1231
1227static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip, 1232static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
1228 struct gfs2_ea_header *ea, char *data) 1233 struct gfs2_ea_header *ea, char *data)
1229{ 1234{
@@ -1529,40 +1534,18 @@ out_alloc:
1529 return error; 1534 return error;
1530} 1535}
1531 1536
1532static int gfs2_xattr_user_get(struct inode *inode, const char *name,
1533 void *buffer, size_t size)
1534{
1535 return gfs2_xattr_get(inode, GFS2_EATYPE_USR, name, buffer, size);
1536}
1537
1538static int gfs2_xattr_user_set(struct inode *inode, const char *name,
1539 const void *value, size_t size, int flags)
1540{
1541 return gfs2_xattr_set(inode, GFS2_EATYPE_USR, name, value, size, flags);
1542}
1543
1544static int gfs2_xattr_security_get(struct inode *inode, const char *name,
1545 void *buffer, size_t size)
1546{
1547 return gfs2_xattr_get(inode, GFS2_EATYPE_SECURITY, name, buffer, size);
1548}
1549
1550static int gfs2_xattr_security_set(struct inode *inode, const char *name,
1551 const void *value, size_t size, int flags)
1552{
1553 return gfs2_xattr_set(inode, GFS2_EATYPE_SECURITY, name, value, size, flags);
1554}
1555
1556static struct xattr_handler gfs2_xattr_user_handler = { 1537static struct xattr_handler gfs2_xattr_user_handler = {
1557 .prefix = XATTR_USER_PREFIX, 1538 .prefix = XATTR_USER_PREFIX,
1558 .get = gfs2_xattr_user_get, 1539 .flags = GFS2_EATYPE_USR,
1559 .set = gfs2_xattr_user_set, 1540 .get = gfs2_xattr_get,
1541 .set = gfs2_xattr_set,
1560}; 1542};
1561 1543
1562static struct xattr_handler gfs2_xattr_security_handler = { 1544static struct xattr_handler gfs2_xattr_security_handler = {
1563 .prefix = XATTR_SECURITY_PREFIX, 1545 .prefix = XATTR_SECURITY_PREFIX,
1564 .get = gfs2_xattr_security_get, 1546 .flags = GFS2_EATYPE_SECURITY,
1565 .set = gfs2_xattr_security_set, 1547 .get = gfs2_xattr_get,
1548 .set = gfs2_xattr_set,
1566}; 1549};
1567 1550
1568struct xattr_handler *gfs2_xattr_handlers[] = { 1551struct xattr_handler *gfs2_xattr_handlers[] = {