Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\xattr.c Create Date:2022-07-28 20:10:01
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:simple_xattr_set - xattr SET operation for in-memory/pseudo filesystems*@xattrs: target simple_xattr list*@name: name of the extended attribute*@value: value of the xattr

Proto:int simple_xattr_set(struct simple_xattrs *xattrs, const char *name, const void *value, size_t size, int flags)

Type:int

Parameter:

TypeParameterName
struct simple_xattrs *xattrs
const char *name
const void *value
size_tsize
intflags
874  struct simple_xattr * new_xattr = NULL
875  err = 0
878  If value Then
879  new_xattr = Allocate new xattr and copy in the value; but leave the name to callers.
880  If Not new_xattr Then Return -ENOMEM
883  name = kstrdup - allocate space for and copy an existing string*@s: the string to duplicate*@gfp: the GFP mask used in the kmalloc() call when allocating memory* Return: newly allocated copy of @s or %NULL in case of error
884  If Not name Then
885  kfree(new_xattr)
886  Return -ENOMEM
890  spin_lock( & lock)
892  If Not strcmp(name, name) Then
894  xattr = new_xattr
895  err = -EEXIST
896  Else if new_xattr Then
898  Else
901  Go to out
904  If flags & set value, fail if attr does not exist Then
905  xattr = new_xattr
906  err = -ENODATA
907  Else
908  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
909  xattr = NULL
911  out :
912  spin_unlock( & lock)
913  If xattr Then
914  kfree(name)
915  kfree(xattr)
917  Return err