summaryrefslogtreecommitdiffstats
path: root/fs/init.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-21 16:05:31 +0200
committerChristoph Hellwig <hch@lst.de>2020-07-31 08:17:54 +0200
commit235e57935bf328c4cce371ffc4dd1d8fab4885cd (patch)
treeab0b81c6689fe72425b5c560e9b9b74a40b37265 /fs/init.c
parentinit: add an init_stat helper (diff)
downloadlinux-235e57935bf328c4cce371ffc4dd1d8fab4885cd.tar.xz
linux-235e57935bf328c4cce371ffc4dd1d8fab4885cd.zip
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>
Diffstat (limited to 'fs/init.c')
-rw-r--r--fs/init.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/init.c b/fs/init.c
index 51646ba38099..db5c48a85644 100644
--- a/fs/init.c
+++ b/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;
+}