Lines Matching defs:xattr

3   File: fs/xattr.c
15 #include <linux/xattr.h>
41 * In order to implement different sets of xattr operations for each xattr
84 * may_write_xattr - check whether inode allows writing xattr
86 * @inode: the inode on which to set an xattr
211 * @name: xattr name to set
267 * @name: xattr name to set
369 * before retrieving the extended attribute. The xattr value buffer should
461 * vfs_listxattr - retrieve \0 separated list of xattr names
462 * @dentry: the dentry from whose inode the xattr names are retrieved
463 * @list: buffer to store xattr names into
529 * @name: name of xattr to remove
988 * generic_listxattr - run through a dentry's xattr list() operations
1023 * The get and set xattr handler operations are called with the remainder of
1028 * Note: the list xattr handler operation when called from the vfs is passed a
1042 * simple_xattr_space - estimate the memory used by a simple xattr
1043 * @name: the full name of the xattr
1050 * Return: The approximate number of bytes of memory used by such an xattr.
1062 * simple_xattr_free - free an xattr object
1063 * @xattr: the xattr object
1065 * Free the xattr object. Can handle @xattr being NULL.
1067 void simple_xattr_free(struct simple_xattr *xattr)
1069 if (xattr)
1070 kfree(xattr->name);
1071 kvfree(xattr);
1075 * simple_xattr_alloc - allocate new xattr object
1076 * @value: value of the xattr object
1079 * Allocate a new xattr object and initialize respective members. The caller is
1080 * responsible for handling the name of the xattr.
1082 * Return: On success a new xattr object is returned. On failure NULL is
1105 * rbtree_simple_xattr_cmp - compare xattr name with current rbtree xattr entry
1106 * @key: xattr name
1109 * Compare the xattr name with the xattr name attached to @node in the rbtree.
1112 * if the xattr attached to @node matches @key.
1117 const struct simple_xattr *xattr;
1119 xattr = rb_entry(node, struct simple_xattr, rb_node);
1120 return strcmp(xattr->name, xattr_name);
1124 * rbtree_simple_xattr_node_cmp - compare two xattr rbtree nodes
1128 * Compare the xattr attached to @new_node with the xattr attached to @node.
1131 * if the xattr attached to @new_node matches the xattr attached to @node.
1136 struct simple_xattr *xattr;
1137 xattr = rb_entry(new_node, struct simple_xattr, rb_node);
1138 return rbtree_simple_xattr_cmp(xattr->name, node);
1142 * simple_xattr_get - get an xattr object
1143 * @xattrs: the header of the xattr object
1144 * @name: the name of the xattr to retrieve
1148 * Try to find and retrieve the xattr object associated with @name.
1149 * If @buffer is provided store the value of @xattr in @buffer
1153 * Return: On success the length of the xattr value is returned. On error a
1159 struct simple_xattr *xattr = NULL;
1166 xattr = rb_entry(rbp, struct simple_xattr, rb_node);
1167 ret = xattr->size;
1169 if (size < xattr->size)
1172 memcpy(buffer, xattr->value, xattr->size);
1180 * simple_xattr_set - set an xattr object
1181 * @xattrs: the header of the xattr object
1182 * @name: the name of the xattr to retrieve
1183 * @value: the value to store along the xattr
1185 * @flags: the flags determining how to set the xattr
1187 * Set a new xattr object.
1188 * If @value is passed a new xattr object will be allocated. If XATTR_REPLACE
1189 * is specified in @flags a matching xattr object for @name must already exist.
1190 * If it does it will be replaced with the new xattr object. If it doesn't we
1191 * fail. If XATTR_CREATE is specified and a matching xattr does already exist
1192 * we fail. If it doesn't we create a new xattr. If @flags is zero we simply
1193 * insert the new xattr replacing any existing one.
1195 * If @value is empty and a matching xattr object is found we delete it if
1198 * If @value is empty and no matching xattr object for @name is found we do
1202 * Return: On success, the removed or replaced xattr is returned, to be freed
1242 /* Fail if XATTR_CREATE is requested and the xattr exists. */
1254 /* Fail if XATTR_REPLACE is requested but no xattr is found. */
1271 * old or new xattr exist then we don't need to do anything.
1289 * simple_xattr_list - list all xattr objects
1291 * @xattrs: the header of the xattr object
1299 * Note, the number of xattr names that can be listed with listxattr(2) is
1301 * then vfs_listxattr() caps it to XATTR_LIST_MAX and if more xattr names
1311 struct simple_xattr *xattr;
1322 xattr = rb_entry(rbp, struct simple_xattr, rb_node);
1325 if (!trusted && xattr_is_trusted(xattr->name))
1328 err = xattr_list_one(&buffer, &remaining_size, xattr->name);
1338 * rbtree_simple_xattr_less - compare two xattr rbtree nodes
1342 * Compare the xattr attached to @new_node with the xattr attached to @node.
1354 * simple_xattr_add - add xattr objects
1355 * @xattrs: the header of the xattr object
1356 * @new_xattr: the xattr object to add
1358 * Add an xattr object to @xattrs. This assumes no replacement or removal
1371 * simple_xattrs_init - initialize new xattr header
1374 * Initialize relevant fields of a an xattr header.
1384 * @xattrs: xattr header whose xattrs to destroy
1387 * Destroy all xattrs in @xattr. When this is called no one can hold a
1398 struct simple_xattr *xattr;
1402 xattr = rb_entry(rbp, struct simple_xattr, rb_node);
1403 rb_erase(&xattr->rb_node, &xattrs->rb_root);
1405 *freed_space += simple_xattr_space(xattr->name,
1406 xattr->size);
1407 simple_xattr_free(xattr);