Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:d_namespace_path - lookup a name associated with a given path*@path: path to lookup (NOT NULL)*@buf: buffer to store path to (NOT NULL)*@name: Returns - pointer for start of path name with in @buf (NOT NULL)*@flags: flags controlling path

Proto:static int d_namespace_path(const struct path *path, char *buf, char **name, int flags, const char *disconnected)

Type:int

Parameter:

TypeParameterName
const struct path *path
char *buf
char **name
intflags
const char *disconnected
92  error = 0
93  connected = 1
94  isdir = If flags & path is a directory Then 1 Else 0
95  buflen = aa_g_path_max - isdir
97  If mnt_flags & MNT_INTERNAL Then
99  res = dentry_path(dentry, buf, buflen)
100  name = res
101  If IS_ERR(res) Then
102  name = buf
103  Return PTR_ERR(res)
105  If s_magic == PROC_SUPER_MAGIC && strncmp( * name, "/sys/", 5) == 0 Then
111  Go to out
112  Else error = If the path is not connected to the expected root,* check if it is a sysctl and handle specially else remove any* leading / that __d_path may have returned
115  Go to out
119  If flags & do path lookup relative to chroot Then
121  get_fs_root(fs, & root)
122  res = __d_path(path, & root, buf, buflen)
123  path_put( & root)
124  Else
125  res = d_absolute_path(path, buf, buflen)
126  If Not our_mnt(mnt) Then connected = 0
133  If Not res || IS_ERR(res) Then
134  If PTR_ERR(res) == -ENAMETOOLONG Then
135  error = -ENAMETOOLONG
136  name = buf
137  Go to out
139  connected = 0
140  res = dentry_path_raw(dentry, buf, buflen)
141  If IS_ERR(res) Then
142  error = PTR_ERR(res)
143  name = buf
144  Go to out
146  Else if Not our_mnt(mnt) Then connected = 0
149  name = res
151  If Not connected Then error = If the path is not connected to the expected root,* check if it is a sysctl and handle specially else remove any* leading / that __d_path may have returned
160  If d_unlinked(dentry) && d_is_positive(dentry) && Not (flags & ( mediate deleted paths | delegate deleted files )) Then
162  error = -ENOENT
163  Go to out
166  out :
171  If (!error && isdir && () != '\0' || ) != '/')) Then strcpy( & buf[aa_g_path_max - 2], "/")
174  Return error
Caller
NameDescribe
aa_path_nameaa_path_name - get the pathname to a buffer ensure dir / is appended*@path: path the file (NOT NULL)*@flags: flags controlling path name generation*@buffer: buffer to put name in (NOT NULL)*@name: Returns - the generated path name if !error (NOT