Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:securityfs_create_dentry - create a dentry in the securityfs filesystem*@name: a pointer to a string containing the name of the file to create.*@mode: the permission that the file should have*@parent: a pointer to the parent dentry for this file

Proto:static struct dentry *securityfs_create_dentry(const char *name, umode_t mode, struct dentry *parent, void *data, const struct file_operations *fops, const struct inode_operations *iops)

Type:struct dentry

Parameter:

TypeParameterName
const char *name
umode_tmode
struct dentry *parent
void *data
const struct file_operations *fops
const struct inode_operations *iops
116  If Not (mode & S_IFMT) Then mode = mode & S_IALLUGO | S_IFREG
119  pr_debug("securityfs: creating file '%s'\n", name)
121  error = simple_pin_fs( & fs_type, & mount, & mount_count)
122  If error Then Return ERR_PTR(error)
125  If Not parent Then parent = root of the mounted tree
128  dir = 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.
130  inode_lock(dir)
131  dentry = lookup_one_len(name, parent, strlen - Find the length of a string*@s: The string to be sized)
132  If IS_ERR(dentry) Then Go to out
135  If d_really_is_positive - Determine if a dentry is really positive (ignoring fallthroughs)*@dentry: The dentry in question* Returns true if the dentry represents a name that maps to an inode* (ie Then
136  error = -EEXIST
137  Go to out1
140  inode = obtain an inode
141  If Not inode Then
142  error = -ENOMEM
143  Go to out1
146  Stat data, not accessed from path walking = get_next_ino()
147  i_mode = mode
148  i_atime = i_mtime = i_ctime = current_time(inode)
149  s or device private pointer = data
150  If S_ISDIR(mode) Then
151  i_op = simple_dir_inode_operations
152  rmer ->i_op->default_file_ops = simple_dir_operations
153  inc_nlink(inode)
154  inc_nlink(dir)
155  Else if S_ISLNK(mode) Then
156  i_op = If iops Then iops Else simple_symlink_inode_operations
157  i_link = data
158  Else
159  rmer ->i_op->default_file_ops = fops
161  These are the low-level FS interfaces to the dcache..
162  get a reference to a dentry
163  inode_unlock(dir)
164  Return dentry
166  out1 :
167  dput(dentry)
168  dentry = ERR_PTR(error)
169  out :
170  inode_unlock(dir)
171  simple_release_fs( & mount, & mount_count)
172  Return dentry
Caller
NameDescribe
securityfs_create_filesecurityfs_create_file - create a file in the securityfs filesystem*@name: a pointer to a string containing the name of the file to create.*@mode: the permission that the file should have*@parent: a pointer to the parent dentry for this file
securityfs_create_symlinksecurityfs_create_symlink - create a symlink in the securityfs filesystem*@name: a pointer to a string containing the name of the symlink to* create.*@parent: a pointer to the parent dentry for the symlink. This should be a* directory dentry if set