mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
init: add an init_eaccess helper
Add a simple helper to check if a file exists based on kernel space file name and switch the early init code over to it. Note that this theoretically changes behavior as it always is based on the effective permissions. But during early init that doesn't make a difference. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
1097742efc
commit
eb9d7d390e
5 changed files with 17 additions and 10 deletions
13
fs/init.c
13
fs/init.c
|
@ -109,6 +109,19 @@ int __init init_chmod(const char *filename, umode_t mode)
|
|||
return error;
|
||||
}
|
||||
|
||||
int __init init_eaccess(const char *filename)
|
||||
{
|
||||
struct path path;
|
||||
int error;
|
||||
|
||||
error = kern_path(filename, LOOKUP_FOLLOW, &path);
|
||||
if (error)
|
||||
return error;
|
||||
error = inode_permission(d_inode(path.dentry), MAY_ACCESS);
|
||||
path_put(&path);
|
||||
return error;
|
||||
}
|
||||
|
||||
int __init init_unlink(const char *pathname)
|
||||
{
|
||||
return do_unlinkat(AT_FDCWD, getname_kernel(pathname));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue