lkml.org 
[lkml]   [2020]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 11/24] init: open code do_utimes in do_utime
Date
Open code the trivial utimes case in a version that takes proper kernel
pointers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
init/initramfs.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index 3823d15e5d2619..6135b55286fc35 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -104,13 +104,20 @@ static void __init free_hash(void)
static long __init do_utime(char *filename, time64_t mtime)
{
struct timespec64 t[2];
+ struct path path;
+ int error;

t[0].tv_sec = mtime;
t[0].tv_nsec = 0;
t[1].tv_sec = mtime;
t[1].tv_nsec = 0;

- return do_utimes(AT_FDCWD, filename, t, AT_SYMLINK_NOFOLLOW);
+ error = kern_path(filename, 0, &path);
+ if (error)
+ return error;
+ error = vfs_utimes(&path, t);
+ path_put(&path);
+ return error;
}

static __initdata LIST_HEAD(dir_list);
--
2.27.0
\
 
 \ /
  Last update: 2020-07-21 18:29    [W:0.151 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site