Commit 8fb9f73e5a539ab3aa4785f30fb52c65fa98600c

Authored by Christoph Hellwig
1 parent 09267defa3

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 <hch@lst.de>

Showing 7 changed files with 12 additions and 12 deletions Side-by-side Diff

... ... @@ -37,4 +37,9 @@
37 37 return ret;
38 38 return path_umount(&path, flags);
39 39 }
  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
... ... @@ -3,4 +3,5 @@
3 3 int __init init_mount(const char *dev_name, const char *dir_name,
4 4 const char *type_page, unsigned long flags, void *data_page);
5 5 int __init init_umount(const char *name, int flags);
  6 +int __init init_unlink(const char *pathname);
include/linux/syscalls.h
... ... @@ -1273,13 +1273,6 @@
1273 1273 * The following kernel syscall equivalents are just wrappers to fs-internal
1274 1274 * functions. Therefore, provide stubs to be inlined at the callsites.
1275 1275 */
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   -
1283 1276 long do_rmdir(int dfd, struct filename *name);
1284 1277  
1285 1278 static inline long ksys_rmdir(const char __user *pathname)
... ... @@ -16,7 +16,7 @@
16 16  
17 17 static inline __init int create_dev(char *name, dev_t dev)
18 18 {
19   - ksys_unlink(name);
  19 + init_unlink(name);
20 20 return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
21 21 }
22 22  
init/do_mounts_initrd.c
... ... @@ -137,12 +137,12 @@
137 137 * mounted in the normal path.
138 138 */
139 139 if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) {
140   - ksys_unlink("/initrd.image");
  140 + init_unlink("/initrd.image");
141 141 handle_initrd();
142 142 return true;
143 143 }
144 144 }
145   - ksys_unlink("/initrd.image");
  145 + init_unlink("/initrd.image");
146 146 return false;
147 147 }
... ... @@ -272,7 +272,7 @@
272 272 fput(out_file);
273 273 out:
274 274 kfree(buf);
275   - ksys_unlink("/dev/ram");
  275 + init_unlink("/dev/ram");
276 276 return res;
277 277 }
278 278  
... ... @@ -12,6 +12,7 @@
12 12 #include <linux/file.h>
13 13 #include <linux/memblock.h>
14 14 #include <linux/namei.h>
  15 +#include <linux/init_syscalls.h>
15 16  
16 17 static ssize_t __init xwrite(struct file *file, const char *p, size_t count,
17 18 loff_t *pos)
... ... @@ -301,7 +302,7 @@
301 302 if (S_ISDIR(st.mode))
302 303 ksys_rmdir(path);
303 304 else
304   - ksys_unlink(path);
  305 + init_unlink(path);
305 306 }
306 307 }
307 308