Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:setattr_prepare - check if attribute changes to a dentry are allowed*@dentry: dentry to check*@attr: attributes to change* Check if we are allowed to change the attributes contained in @attr* in the given dentry

Proto:int setattr_prepare(struct dentry *dentry, struct iattr *attr)

Type:int

Parameter:

TypeParameterName
struct dentry *dentry
struct iattr *attr
63  inode = d_inode - Get the actual inode of this dentry*@dentry: The dentry to query* This is the helper normal filesystems should use to get at their own inodes* in their own dentries and ignore the layering superimposed upon them.
64  ia_valid = ia_valid
70  If ia_valid & ATTR_SIZE Then
71  error = de_newsize_ok - may this inode be truncated to a given size*@inode: the inode to be truncated*@offset: the new size to assign to the inode* inode_newsize_ok must be called with i_mutex held
72  If error Then Return error
77  If ia_valid & Not a change, but a change it Then Go to kill_priv
81  If ia_valid & ATTR_UID && Not chown_ok(inode, ia_uid) Then Return -EPERM
85  If ia_valid & ATTR_GID && Not chgrp_ok(inode, ia_gid) Then Return -EPERM
89  If ia_valid & Attribute flags. These should be or-ed together to figure out what* has been changed! Then
90  If Not de_owner_or_capable - check current task permissions to inode*@inode: inode being checked* Return true if current either has CAP_FOWNER in a namespace with the* inode owner uid mapped, or owns the file. Then Return -EPERM
93  If Not Check whether we're fsgid/egid or in the supplemental group.. && Not apable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped*@inode: The inode in question*@cap: The capability in question* Return true if the current task has the given capability targeted at* its own user namespace and that the given inode's Then ia_mode &= ~S_ISGID
100  If ia_valid & ( ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) Then
101  If Not de_owner_or_capable - check current task permissions to inode*@inode: inode being checked* Return true if current either has CAP_FOWNER in a namespace with the* inode owner uid mapped, or owns the file. Then Return -EPERM
105  kill_priv :
107  If ia_valid & ATTR_KILL_PRIV Then
110  error = security_inode_killpriv(dentry)
111  If error Then Return error
115  Return 0
Caller
NameDescribe
simple_setattrsimple_setattr - setattr for simple filesystem*@dentry: dentry*@iattr: iattr structure* Returns 0 on success, -error on failure
ramfs_nommu_setattrhandle a change of attributes* - we're specifically interested in a change of size