mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 03:20:53 +07:00
initramfs: use vfs_utimes in do_copy
Don't bother saving away the pathname and just use the new struct path based utimes helper instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
fd5ad30c78
commit
38b082236e
@ -202,7 +202,6 @@ static inline void __init eat(unsigned n)
|
|||||||
byte_count -= n;
|
byte_count -= n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __initdata char *vcollected;
|
|
||||||
static __initdata char *collected;
|
static __initdata char *collected;
|
||||||
static long remains __initdata;
|
static long remains __initdata;
|
||||||
static __initdata char *collect;
|
static __initdata char *collect;
|
||||||
@ -345,7 +344,6 @@ static int __init do_name(void)
|
|||||||
vfs_fchmod(wfile, mode);
|
vfs_fchmod(wfile, mode);
|
||||||
if (body_len)
|
if (body_len)
|
||||||
vfs_truncate(&wfile->f_path, body_len);
|
vfs_truncate(&wfile->f_path, body_len);
|
||||||
vcollected = kstrdup(collected, GFP_KERNEL);
|
|
||||||
state = CopyFile;
|
state = CopyFile;
|
||||||
}
|
}
|
||||||
} else if (S_ISDIR(mode)) {
|
} else if (S_ISDIR(mode)) {
|
||||||
@ -368,11 +366,15 @@ static int __init do_name(void)
|
|||||||
static int __init do_copy(void)
|
static int __init do_copy(void)
|
||||||
{
|
{
|
||||||
if (byte_count >= body_len) {
|
if (byte_count >= body_len) {
|
||||||
|
struct timespec64 t[2] = { };
|
||||||
if (xwrite(wfile, victim, body_len, &wfile_pos) != body_len)
|
if (xwrite(wfile, victim, body_len, &wfile_pos) != body_len)
|
||||||
error("write error");
|
error("write error");
|
||||||
|
|
||||||
|
t[0].tv_sec = mtime;
|
||||||
|
t[1].tv_sec = mtime;
|
||||||
|
vfs_utimes(&wfile->f_path, t);
|
||||||
|
|
||||||
fput(wfile);
|
fput(wfile);
|
||||||
do_utime(vcollected, mtime);
|
|
||||||
kfree(vcollected);
|
|
||||||
eat(body_len);
|
eat(body_len);
|
||||||
state = SkipIt;
|
state = SkipIt;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user