Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Extended attribute SET operations

Proto:static long setxattr(struct dentry *d, const char __user *name, const void __user *value, size_t size, int flags)

Type:long

Parameter:

TypeParameterName
struct dentry *d
const char __user *name
const void __user *value
size_tsize
intflags
418  void * kvalue = NULL
421  If flags & ~(set value, fail if attr already exists | set value, fail if attr does not exist ) Then Return -EINVAL
424  error = Copy a NUL terminated string from userspace
425  If error == 0 || error == size of kname Then error = -ERANGE
427  If error < 0 Then Return error
430  If size Then
431  If size > size of an extended attribute value (64k) Then Return -E2BIG
433  kvalue = kvmalloc(size, GFP_KERNEL)
434  If Not kvalue Then Return -ENOMEM
436  If copy_from_user(kvalue, value, size) Then
437  error = -EFAULT
438  Go to out
440  If strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0 || strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0 Then posix_acl_fix_xattr_from_user(kvalue, size)
443  Else if strcmp(kname, XATTR_NAME_CAPS) == 0 Then
445  If error < 0 Then Go to out
447  size = error
451  error = vfs_setxattr(d, kname, kvalue, size, flags)
452  out :
453  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
455  Return error
Caller
NameDescribe
path_setxattr
SYSCALL_DEFINE5