Lines Matching refs: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
993 * generic_listxattr - run through a dentry's xattr list() operations
1028 * The get and set xattr handler operations are called with the remainder of
1033 * Note: the list xattr handler operation when called from the vfs is passed a
1047 * simple_xattr_space - estimate the memory used by a simple xattr
1048 * @name: the full name of the xattr
1055 * Return: The approximate number of bytes of memory used by such an xattr.
1067 * simple_xattr_free - free an xattr object
1068 * @xattr: the xattr object
1070 * Free the xattr object. Can handle @xattr being NULL.
1072 void simple_xattr_free(struct simple_xattr *xattr)
1074 if (xattr)
1075 kfree(xattr->name);
1076 kvfree(xattr);
1080 * simple_xattr_alloc - allocate new xattr object
1081 * @value: value of the xattr object
1084 * Allocate a new xattr object and initialize respective members. The caller is
1085 * responsible for handling the name of the xattr.
1087 * Return: On success a new xattr object is returned. On failure NULL is
1110 * rbtree_simple_xattr_cmp - compare xattr name with current rbtree xattr entry
1111 * @key: xattr name
1114 * Compare the xattr name with the xattr name attached to @node in the rbtree.
1117 * if the xattr attached to @node matches @key.
1122 const struct simple_xattr *xattr;
1124 xattr = rb_entry(node, struct simple_xattr, rb_node);
1125 return strcmp(xattr->name, xattr_name);
1129 * rbtree_simple_xattr_node_cmp - compare two xattr rbtree nodes
1133 * Compare the xattr attached to @new_node with the xattr attached to @node.
1136 * if the xattr attached to @new_node matches the xattr attached to @node.
1141 struct simple_xattr *xattr;
1142 xattr = rb_entry(new_node, struct simple_xattr, rb_node);
1143 return rbtree_simple_xattr_cmp(xattr->name, node);
1147 * simple_xattr_get - get an xattr object
1148 * @xattrs: the header of the xattr object
1149 * @name: the name of the xattr to retrieve
1153 * Try to find and retrieve the xattr object associated with @name.
1154 * If @buffer is provided store the value of @xattr in @buffer
1158 * Return: On success the length of the xattr value is returned. On error a
1164 struct simple_xattr *xattr = NULL;
1171 xattr = rb_entry(rbp, struct simple_xattr, rb_node);
1172 ret = xattr->size;
1174 if (size < xattr->size)
1177 memcpy(buffer, xattr->value, xattr->size);
1185 * simple_xattr_set - set an xattr object
1186 * @xattrs: the header of the xattr object
1187 * @name: the name of the xattr to retrieve
1188 * @value: the value to store along the xattr
1190 * @flags: the flags determining how to set the xattr
1192 * Set a new xattr object.
1193 * If @value is passed a new xattr object will be allocated. If XATTR_REPLACE
1194 * is specified in @flags a matching xattr object for @name must already exist.
1195 * If it does it will be replaced with the new xattr object. If it doesn't we
1196 * fail. If XATTR_CREATE is specified and a matching xattr does already exist
1197 * we fail. If it doesn't we create a new xattr. If @flags is zero we simply
1198 * insert the new xattr replacing any existing one.
1200 * If @value is empty and a matching xattr object is found we delete it if
1203 * If @value is empty and no matching xattr object for @name is found we do
1207 * Return: On success, the removed or replaced xattr is returned, to be freed
1247 /* Fail if XATTR_CREATE is requested and the xattr exists. */
1259 /* Fail if XATTR_REPLACE is requested but no xattr is found. */
1276 * old or new xattr exist then we don't need to do anything.
1294 * simple_xattr_list - list all xattr objects
1296 * @xattrs: the header of the xattr object
1304 * Note, the number of xattr names that can be listed with listxattr(2) is
1306 * then vfs_listxattr() caps it to XATTR_LIST_MAX and if more xattr names
1316 struct simple_xattr *xattr;
1327 xattr = rb_entry(rbp, struct simple_xattr, rb_node);
1330 if (!trusted && xattr_is_trusted(xattr->name))
1333 err = xattr_list_one(&buffer, &remaining_size, xattr->name);
1343 * rbtree_simple_xattr_less - compare two xattr rbtree nodes
1347 * Compare the xattr attached to @new_node with the xattr attached to @node.
1359 * simple_xattr_add - add xattr objects
1360 * @xattrs: the header of the xattr object
1361 * @new_xattr: the xattr object to add
1363 * Add an xattr object to @xattrs. This assumes no replacement or removal
1376 * simple_xattrs_init - initialize new xattr header
1379 * Initialize relevant fields of a an xattr header.
1389 * @xattrs: xattr header whose xattrs to destroy
1392 * Destroy all xattrs in @xattr. When this is called no one can hold a
1403 struct simple_xattr *xattr;
1407 xattr = rb_entry(rbp, struct simple_xattr, rb_node);
1408 rb_erase(&xattr->rb_node, &xattrs->rb_root);
1410 *freed_space += simple_xattr_space(xattr->name,
1411 xattr->size);
1412 simple_xattr_free(xattr);