Skip to content

Commit 8fb9f73

Browse files
author
Christoph Hellwig
committed
init: add an init_unlink helper
Add a simple helper to unlink with a kernel space file name and switch the early init code over to it. Remove the now unused ksys_unlink. Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 09267de commit 8fb9f73

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

fs/init.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ int __init init_umount(const char *name, int flags)
3737
return ret;
3838
return path_umount(&path, flags);
3939
}
40+
41+
int __init init_unlink(const char *pathname)
42+
{
43+
return do_unlinkat(AT_FDCWD, getname_kernel(pathname));
44+
}

include/linux/init_syscalls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
int __init init_mount(const char *dev_name, const char *dir_name,
44
const char *type_page, unsigned long flags, void *data_page);
55
int __init init_umount(const char *name, int flags);
6+
int __init init_unlink(const char *pathname);

include/linux/syscalls.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,13 +1273,6 @@ int compat_ksys_ipc(u32 call, int first, int second,
12731273
* The following kernel syscall equivalents are just wrappers to fs-internal
12741274
* functions. Therefore, provide stubs to be inlined at the callsites.
12751275
*/
1276-
extern long do_unlinkat(int dfd, struct filename *name);
1277-
1278-
static inline long ksys_unlink(const char __user *pathname)
1279-
{
1280-
return do_unlinkat(AT_FDCWD, getname(pathname));
1281-
}
1282-
12831276
long do_rmdir(int dfd, struct filename *name);
12841277

12851278
static inline long ksys_rmdir(const char __user *pathname)

init/do_mounts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extern int root_mountflags;
1616

1717
static inline __init int create_dev(char *name, dev_t dev)
1818
{
19-
ksys_unlink(name);
19+
init_unlink(name);
2020
return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
2121
}
2222

init/do_mounts_initrd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ bool __init initrd_load(void)
137137
* mounted in the normal path.
138138
*/
139139
if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) {
140-
ksys_unlink("/initrd.image");
140+
init_unlink("/initrd.image");
141141
handle_initrd();
142142
return true;
143143
}
144144
}
145-
ksys_unlink("/initrd.image");
145+
init_unlink("/initrd.image");
146146
return false;
147147
}

init/do_mounts_rd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ int __init rd_load_image(char *from)
272272
fput(out_file);
273273
out:
274274
kfree(buf);
275-
ksys_unlink("/dev/ram");
275+
init_unlink("/dev/ram");
276276
return res;
277277
}
278278

init/initramfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/file.h>
1313
#include <linux/memblock.h>
1414
#include <linux/namei.h>
15+
#include <linux/init_syscalls.h>
1516

1617
static ssize_t __init xwrite(struct file *file, const char *p, size_t count,
1718
loff_t *pos)
@@ -301,7 +302,7 @@ static void __init clean_path(char *path, umode_t fmode)
301302
if (S_ISDIR(st.mode))
302303
ksys_rmdir(path);
303304
else
304-
ksys_unlink(path);
305+
init_unlink(path);
305306
}
306307
}
307308

0 commit comments

Comments
 (0)