Lines Matching refs:xattr

3   File: fs/xattr.c
15 #include <linux/xattr.h>
47 * In order to implement different sets of xattr operations for each xattr
90 * may_write_xattr - check whether inode allows writing xattr
92 * @inode: the inode on which to set an xattr
234 * @name: xattr name to set
290 * @name: xattr name to set
392 * before retrieving the extended attribute. The xattr value buffer should
484 * vfs_listxattr - retrieve \0 separated list of xattr names
485 * @dentry: the dentry from whose inode the xattr names are retrieved
486 * @list: buffer to store xattr names into
555 * @name: name of xattr to remove
1139 * generic_listxattr - run through a dentry's xattr list() operations
1175 * The get and set xattr handler operations are called with the remainder of
1180 * Note: the list xattr handler operation when called from the vfs is passed a
1194 * simple_xattr_space - estimate the memory used by a simple xattr
1195 * @name: the full name of the xattr
1202 * Return: The approximate number of bytes of memory used by such an xattr.
1214 * simple_xattr_free - free an xattr object
1215 * @xattr: the xattr object
1217 * Free the xattr object. Can handle @xattr being NULL.
1219 void simple_xattr_free(struct simple_xattr *xattr)
1221 if (xattr)
1222 kfree(xattr->name);
1223 kvfree(xattr);
1228 struct simple_xattr *xattr = container_of(head, struct simple_xattr, rcu);
1230 simple_xattr_free(xattr);
1234 * simple_xattr_free_rcu - free an xattr object with RCU delay
1235 * @xattr: the xattr object
1237 * Free the xattr object after an RCU grace period. This must be used when
1238 * the xattr was removed from a data structure that concurrent RCU readers
1239 * may still be traversing. Can handle @xattr being NULL.
1241 void simple_xattr_free_rcu(struct simple_xattr *xattr)
1243 if (xattr)
1244 call_rcu(&xattr->rcu, simple_xattr_rcu_free);
1248 * simple_xattr_alloc - allocate new xattr object
1249 * @value: value of the xattr object
1252 * Allocate a new xattr object and initialize respective members. The caller is
1253 * responsible for handling the name of the xattr.
1255 * Return: New xattr object on success, NULL if @value is NULL, ERR_PTR on
1294 const struct simple_xattr *xattr = obj;
1296 return sx_hashfn(xattr->name, xattr->parent, seed);
1302 const struct simple_xattr *xattr = obj;
1305 return xattr->parent != key->parent || strcmp(xattr->name, key->name);
1317 * simple_xattr_get - get an xattr object
1319 * @xattrs: the header of the xattr object
1320 * @name: the name of the xattr to retrieve
1324 * Try to find and retrieve the xattr object associated with @name.
1325 * If @buffer is provided store the value of @xattr in @buffer
1329 * Return: On success the length of the xattr value is returned. On error a
1335 struct simple_xattr *xattr;
1344 xattr = rhashtable_lookup(ht, &key, simple_xattr_params);
1345 if (xattr) {
1346 ret = xattr->size;
1348 if (size < xattr->size)
1351 memcpy(buffer, xattr->value, xattr->size);
1394 * simple_xattr_set - set an xattr object
1396 * @xattrs: the header of the xattr object
1397 * @name: the name of the xattr to retrieve
1398 * @value: the value to store along the xattr
1400 * @flags: the flags determining how to set the xattr
1402 * Set a new xattr object.
1403 * If @value is passed a new xattr object will be allocated. If XATTR_REPLACE
1404 * is specified in @flags a matching xattr object for @name must already exist.
1405 * If it does it will be replaced with the new xattr object. If it doesn't we
1406 * fail. If XATTR_CREATE is specified and a matching xattr does already exist
1407 * we fail. If it doesn't we create a new xattr. If @flags is zero we simply
1408 * insert the new xattr replacing any existing one.
1410 * If @value is empty and a matching xattr object is found we delete it if
1413 * If @value is empty and no matching xattr object for @name is found we do
1422 * Return: On success, the removed or replaced xattr is returned, to be freed
1456 /* Fail if XATTR_CREATE is requested and the xattr exists. */
1479 /* Fail if XATTR_REPLACE is requested but no xattr is found. */
1499 * old or new xattr exist then we don't need to do anything.
1530 * simple_xattr_set_limited - set an xattr with per-inode user.* limits
1532 * @xattrs: the header of the xattr object
1534 * @name: the name of the xattr to set or remove
1588 * simple_xattr_list - list all xattr objects
1590 * @xattrs: the header of the xattr object
1598 * Note, the number of xattr names that can be listed with listxattr(2) is
1600 * then vfs_listxattr() caps it to XATTR_LIST_MAX and if more xattr names
1610 struct simple_xattr *xattr;
1634 list_for_each_entry_rcu(xattr, xattrs, node) {
1636 if (!trusted && xattr_is_trusted(xattr->name))
1640 if (xattr_is_maclabel(xattr->name))
1643 err = xattr_list_one(&buffer, &remaining_size, xattr->name);
1653 * simple_xattr_add - add xattr objects
1655 * @xattrs: the header of the xattr object
1656 * @new_xattr: the xattr object to add
1658 * Add an xattr object to @xattrs. This assumes no replacement or removal
1685 * simple_xattr_add_limited - add an xattr object, charging per-inode limits
1687 * @xattrs: the header of the xattr object
1689 * @new_xattr: the xattr object to add
1720 * @xattrs: xattr header whose xattrs to destroy
1733 struct simple_xattr *xattr = list_first_entry(xattrs, typeof(*xattr), node);
1735 rhashtable_remove_fast(cache->ht, &xattr->hash_node, simple_xattr_params);
1736 list_del(&xattr->node);
1738 *freed_space += simple_xattr_space(xattr->name, xattr->size);
1740 * Free with RCU, since the xattr might still get accessed by
1743 simple_xattr_free_rcu(xattr);
1751 * Destroy the cache table, which was lazily allocated on adding the first xattr.