mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
init: add an init_utimes helper
Add a simple helper to set timestamps with a kernel space file name and switch the early init code over to it. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
716308a533
commit
235e57935b
3 changed files with 15 additions and 2 deletions
13
fs/init.c
13
fs/init.c
|
@ -238,3 +238,16 @@ int __init init_rmdir(const char *pathname)
|
|||
{
|
||||
return do_rmdir(AT_FDCWD, getname_kernel(pathname));
|
||||
}
|
||||
|
||||
int __init init_utimes(char *filename, struct timespec64 *ts)
|
||||
{
|
||||
struct path path;
|
||||
int error;
|
||||
|
||||
error = kern_path(filename, 0, &path);
|
||||
if (error)
|
||||
return error;
|
||||
error = vfs_utimes(&path, ts);
|
||||
path_put(&path);
|
||||
return error;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue