diff options
Diffstat (limited to 'init')
-rw-r--r-- | init/do_mounts.c | 26 | ||||
-rw-r--r-- | init/do_mounts.h | 4 | ||||
-rw-r--r-- | init/do_mounts_initrd.c | 42 | ||||
-rw-r--r-- | init/do_mounts_md.c | 29 | ||||
-rw-r--r-- | init/do_mounts_rd.c | 40 | ||||
-rw-r--r-- | init/initramfs.c | 52 | ||||
-rw-r--r-- | init/main.c | 9 | ||||
-rw-r--r-- | init/noinitramfs.c | 6 |
8 files changed, 105 insertions, 103 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c index 7cf4f6dafd5f..2c71dabe5626 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -363,11 +363,11 @@ static void __init get_fs_names(char *page) static int __init do_mount_root(char *name, char *fs, int flags, void *data) { struct super_block *s; - int err = sys_mount(name, "/root", fs, flags, data); + int err = ksys_mount(name, "/root", fs, flags, data); if (err) return err; - sys_chdir("/root"); + ksys_chdir("/root"); s = current->fs->pwd.dentry->d_sb; ROOT_DEV = s->s_dev; printk(KERN_INFO @@ -489,21 +489,21 @@ void __init change_floppy(char *fmt, ...) va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); - fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0); + fd = ksys_open("/dev/root", O_RDWR | O_NDELAY, 0); if (fd >= 0) { - sys_ioctl(fd, FDEJECT, 0); - sys_close(fd); + ksys_ioctl(fd, FDEJECT, 0); + ksys_close(fd); } printk(KERN_NOTICE "VFS: Insert %s and press ENTER\n", buf); - fd = sys_open("/dev/console", O_RDWR, 0); + fd = ksys_open("/dev/console", O_RDWR, 0); if (fd >= 0) { - sys_ioctl(fd, TCGETS, (long)&termios); + ksys_ioctl(fd, TCGETS, (long)&termios); termios.c_lflag &= ~ICANON; - sys_ioctl(fd, TCSETSF, (long)&termios); - sys_read(fd, &c, 1); + ksys_ioctl(fd, TCSETSF, (long)&termios); + ksys_read(fd, &c, 1); termios.c_lflag |= ICANON; - sys_ioctl(fd, TCSETSF, (long)&termios); - sys_close(fd); + ksys_ioctl(fd, TCSETSF, (long)&termios); + ksys_close(fd); } } #endif @@ -599,8 +599,8 @@ void __init prepare_namespace(void) mount_root(); out: devtmpfs_mount("dev"); - sys_mount(".", "/", NULL, MS_MOVE, NULL); - sys_chroot("."); + ksys_mount(".", "/", NULL, MS_MOVE, NULL); + ksys_chroot("."); } static bool is_tmpfs; diff --git a/init/do_mounts.h b/init/do_mounts.h index 5b05c8f93f47..0bb0806de4ce 100644 --- a/init/do_mounts.h +++ b/init/do_mounts.h @@ -16,8 +16,8 @@ extern int root_mountflags; static inline int create_dev(char *name, dev_t dev) { - sys_unlink(name); - return sys_mknod(name, S_IFBLK|0600, new_encode_dev(dev)); + ksys_unlink(name); + return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev)); } static inline u32 bstat(char *name) diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index 53d4f0f326e7..5a91aefa7305 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -36,16 +36,16 @@ __setup("noinitrd", no_initrd); static int init_linuxrc(struct subprocess_info *info, struct cred *new) { - sys_unshare(CLONE_FS | CLONE_FILES); + ksys_unshare(CLONE_FS | CLONE_FILES); /* stdin/stdout/stderr for /linuxrc */ - sys_open("/dev/console", O_RDWR, 0); - sys_dup(0); - sys_dup(0); + ksys_open("/dev/console", O_RDWR, 0); + ksys_dup(0); + ksys_dup(0); /* move initrd over / and chdir/chroot in initrd root */ - sys_chdir("/root"); - sys_mount(".", "/", NULL, MS_MOVE, NULL); - sys_chroot("."); - sys_setsid(); + ksys_chdir("/root"); + ksys_mount(".", "/", NULL, MS_MOVE, NULL); + ksys_chroot("."); + ksys_setsid(); return 0; } @@ -60,8 +60,8 @@ static void __init handle_initrd(void) create_dev("/dev/root.old", Root_RAM0); /* mount initrd on rootfs' /root */ mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY); - sys_mkdir("/old", 0700); - sys_chdir("/old"); + ksys_mkdir("/old", 0700); + ksys_chdir("/old"); /* try loading default modules from initrd */ load_default_modules(); @@ -81,37 +81,37 @@ static void __init handle_initrd(void) current->flags &= ~PF_FREEZER_SKIP; /* move initrd to rootfs' /old */ - sys_mount("..", ".", NULL, MS_MOVE, NULL); + ksys_mount("..", ".", NULL, MS_MOVE, NULL); /* switch root and cwd back to / of rootfs */ - sys_chroot(".."); + ksys_chroot(".."); if (new_decode_dev(real_root_dev) == Root_RAM0) { - sys_chdir("/old"); + ksys_chdir("/old"); return; } - sys_chdir("/"); + ksys_chdir("/"); ROOT_DEV = new_decode_dev(real_root_dev); mount_root(); printk(KERN_NOTICE "Trying to move old root to /initrd ... "); - error = sys_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL); + error = ksys_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL); if (!error) printk("okay\n"); else { - int fd = sys_open("/dev/root.old", O_RDWR, 0); + int fd = ksys_open("/dev/root.old", O_RDWR, 0); if (error == -ENOENT) printk("/initrd does not exist. Ignored.\n"); else printk("failed\n"); printk(KERN_NOTICE "Unmounting old root\n"); - sys_umount("/old", MNT_DETACH); + ksys_umount("/old", MNT_DETACH); printk(KERN_NOTICE "Trying to free ramdisk memory ... "); if (fd < 0) { error = fd; } else { - error = sys_ioctl(fd, BLKFLSBUF, 0); - sys_close(fd); + error = ksys_ioctl(fd, BLKFLSBUF, 0); + ksys_close(fd); } printk(!error ? "okay\n" : "failed\n"); } @@ -128,11 +128,11 @@ bool __init initrd_load(void) * mounted in the normal path. */ if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) { - sys_unlink("/initrd.image"); + ksys_unlink("/initrd.image"); handle_initrd(); return true; } } - sys_unlink("/initrd.image"); + ksys_unlink("/initrd.image"); return false; } diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c index 3f733c760a8c..7d85d172bc7e 100644 --- a/init/do_mounts_md.c +++ b/init/do_mounts_md.c @@ -181,17 +181,17 @@ static void __init md_setup_drive(void) partitioned ? "_d" : "", minor, md_setup_args[ent].device_names); - fd = sys_open(name, 0, 0); + fd = ksys_open(name, 0, 0); if (fd < 0) { printk(KERN_ERR "md: open failed - cannot start " "array %s\n", name); continue; } - if (sys_ioctl(fd, SET_ARRAY_INFO, 0) == -EBUSY) { + if (ksys_ioctl(fd, SET_ARRAY_INFO, 0) == -EBUSY) { printk(KERN_WARNING "md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n", minor); - sys_close(fd); + ksys_close(fd); continue; } @@ -210,7 +210,7 @@ static void __init md_setup_drive(void) ainfo.state = (1 << MD_SB_CLEAN); ainfo.layout = 0; ainfo.chunk_size = md_setup_args[ent].chunk; - err = sys_ioctl(fd, SET_ARRAY_INFO, (long)&ainfo); + err = ksys_ioctl(fd, SET_ARRAY_INFO, (long)&ainfo); for (i = 0; !err && i <= MD_SB_DISKS; i++) { dev = devices[i]; if (!dev) @@ -220,7 +220,8 @@ static void __init md_setup_drive(void) dinfo.state = (1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC); dinfo.major = MAJOR(dev); dinfo.minor = MINOR(dev); - err = sys_ioctl(fd, ADD_NEW_DISK, (long)&dinfo); + err = ksys_ioctl(fd, ADD_NEW_DISK, + (long)&dinfo); } } else { /* persistent */ @@ -230,11 +231,11 @@ static void __init md_setup_drive(void) break; dinfo.major = MAJOR(dev); dinfo.minor = MINOR(dev); - sys_ioctl(fd, ADD_NEW_DISK, (long)&dinfo); + ksys_ioctl(fd, ADD_NEW_DISK, (long)&dinfo); } } if (!err) - err = sys_ioctl(fd, RUN_ARRAY, 0); + err = ksys_ioctl(fd, RUN_ARRAY, 0); if (err) printk(KERN_WARNING "md: starting md%d failed\n", minor); else { @@ -243,11 +244,11 @@ static void __init md_setup_drive(void) * boot a kernel with devfs compiled in from partitioned md * array without it */ - sys_close(fd); - fd = sys_open(name, 0, 0); - sys_ioctl(fd, BLKRRPART, 0); + ksys_close(fd); + fd = ksys_open(name, 0, 0); + ksys_ioctl(fd, BLKRRPART, 0); } - sys_close(fd); + ksys_close(fd); } } @@ -294,10 +295,10 @@ static void __init autodetect_raid(void) wait_for_device_probe(); - fd = sys_open("/dev/md0", 0, 0); + fd = ksys_open("/dev/md0", 0, 0); if (fd >= 0) { - sys_ioctl(fd, RAID_AUTORUN, raid_autopart); - sys_close(fd); + ksys_ioctl(fd, RAID_AUTORUN, raid_autopart); + ksys_close(fd); } } diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index 99e0b649fc0e..12c159824c7b 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c @@ -90,8 +90,8 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) /* * Read block 0 to test for compressed kernel */ - sys_lseek(fd, start_block * BLOCK_SIZE, 0); - sys_read(fd, buf, size); + ksys_lseek(fd, start_block * BLOCK_SIZE, 0); + ksys_read(fd, buf, size); *decompressor = decompress_method(buf, size, &compress_name); if (compress_name) { @@ -136,8 +136,8 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) /* * Read 512 bytes further to check if cramfs is padded */ - sys_lseek(fd, start_block * BLOCK_SIZE + 0x200, 0); - sys_read(fd, buf, size); + ksys_lseek(fd, start_block * BLOCK_SIZE + 0x200, 0); + ksys_read(fd, buf, size); if (cramfsb->magic == CRAMFS_MAGIC) { printk(KERN_NOTICE @@ -150,8 +150,8 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) /* * Read block 1 to test for minix and ext2 superblock */ - sys_lseek(fd, (start_block+1) * BLOCK_SIZE, 0); - sys_read(fd, buf, size); + ksys_lseek(fd, (start_block+1) * BLOCK_SIZE, 0); + ksys_read(fd, buf, size); /* Try minix */ if (minixsb->s_magic == MINIX_SUPER_MAGIC || @@ -178,7 +178,7 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor) start_block); done: - sys_lseek(fd, start_block * BLOCK_SIZE, 0); + ksys_lseek(fd, start_block * BLOCK_SIZE, 0); kfree(buf); return nblocks; } @@ -196,11 +196,11 @@ int __init rd_load_image(char *from) char rotator[4] = { '|' , '/' , '-' , '\\' }; #endif - out_fd = sys_open("/dev/ram", O_RDWR, 0); + out_fd = ksys_open("/dev/ram", O_RDWR, 0); if (out_fd < 0) goto out; - in_fd = sys_open(from, O_RDONLY, 0); + in_fd = ksys_open(from, O_RDONLY, 0); if (in_fd < 0) goto noclose_input; @@ -218,7 +218,7 @@ int __init rd_load_image(char *from) * NOTE NOTE: nblocks is not actually blocks but * the number of kibibytes of data to load into a ramdisk. */ - if (sys_ioctl(out_fd, BLKGETSIZE, (unsigned long)&rd_blocks) < 0) + if (ksys_ioctl(out_fd, BLKGETSIZE, (unsigned long)&rd_blocks) < 0) rd_blocks = 0; else rd_blocks >>= 1; @@ -232,7 +232,7 @@ int __init rd_load_image(char *from) /* * OK, time to copy in the data */ - if (sys_ioctl(in_fd, BLKGETSIZE, (unsigned long)&devblocks) < 0) + if (ksys_ioctl(in_fd, BLKGETSIZE, (unsigned long)&devblocks) < 0) devblocks = 0; else devblocks >>= 1; @@ -257,20 +257,20 @@ int __init rd_load_image(char *from) if (i && (i % devblocks == 0)) { printk("done disk #%d.\n", disk++); rotate = 0; - if (sys_close(in_fd)) { + if (ksys_close(in_fd)) { printk("Error closing the disk.\n"); goto noclose_input; } change_floppy("disk #%d", disk); - in_fd = sys_open(from, O_RDONLY, 0); + in_fd = ksys_open(from, O_RDONLY, 0); if (in_fd < 0) { printk("Error opening disk.\n"); goto noclose_input; } printk("Loading disk #%d... ", disk); } - sys_read(in_fd, buf, BLOCK_SIZE); - sys_write(out_fd, buf, BLOCK_SIZE); + ksys_read(in_fd, buf, BLOCK_SIZE); + ksys_write(out_fd, buf, BLOCK_SIZE); #if !defined(CONFIG_S390) if (!(i % 16)) { pr_cont("%c\b", rotator[rotate & 0x3]); @@ -283,12 +283,12 @@ int __init rd_load_image(char *from) successful_load: res = 1; done: - sys_close(in_fd); + ksys_close(in_fd); noclose_input: - sys_close(out_fd); + ksys_close(out_fd); out: kfree(buf); - sys_unlink("/dev/ram"); + ksys_unlink("/dev/ram"); return res; } @@ -307,7 +307,7 @@ static int crd_infd, crd_outfd; static long __init compr_fill(void *buf, unsigned long len) { - long r = sys_read(crd_infd, buf, len); + long r = ksys_read(crd_infd, buf, len); if (r < 0) printk(KERN_ERR "RAMDISK: error while reading compressed data"); else if (r == 0) @@ -317,7 +317,7 @@ static long __init compr_fill(void *buf, unsigned long len) static long __init compr_flush(void *window, unsigned long outcnt) { - long written = sys_write(crd_outfd, window, outcnt); + long written = ksys_write(crd_outfd, window, outcnt); if (written != outcnt) { if (decompress_error == 0) printk(KERN_ERR diff --git a/init/initramfs.c b/init/initramfs.c index 7e99a0038942..13643c46ebab 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -27,7 +27,7 @@ static ssize_t __init xwrite(int fd, const char *p, size_t count) /* sys_write only can write MAX_RW_COUNT aka 2G-4K bytes at most */ while (count) { - ssize_t rv = sys_write(fd, p, count); + ssize_t rv = ksys_write(fd, p, count); if (rv < 0) { if (rv == -EINTR || rv == -EAGAIN) @@ -306,7 +306,7 @@ static int __init maybe_link(void) if (nlink >= 2) { char *old = find_link(major, minor, ino, mode, collected); if (old) - return (sys_link(old, collected) < 0) ? -1 : 1; + return (ksys_link(old, collected) < 0) ? -1 : 1; } return 0; } @@ -317,9 +317,9 @@ static void __init clean_path(char *path, umode_t fmode) if (!vfs_lstat(path, &st) && (st.mode ^ fmode) & S_IFMT) { if (S_ISDIR(st.mode)) - sys_rmdir(path); + ksys_rmdir(path); else - sys_unlink(path); + ksys_unlink(path); } } @@ -340,28 +340,28 @@ static int __init do_name(void) int openflags = O_WRONLY|O_CREAT; if (ml != 1) openflags |= O_TRUNC; - wfd = sys_open(collected, openflags, mode); + wfd = ksys_open(collected, openflags, mode); if (wfd >= 0) { - sys_fchown(wfd, uid, gid); - sys_fchmod(wfd, mode); + ksys_fchown(wfd, uid, gid); + ksys_fchmod(wfd, mode); if (body_len) - sys_ftruncate(wfd, body_len); + ksys_ftruncate(wfd, body_len); vcollected = kstrdup(collected, GFP_KERNEL); state = CopyFile; } } } else if (S_ISDIR(mode)) { - sys_mkdir(collected, mode); - sys_chown(collected, uid, gid); - sys_chmod(collected, mode); + ksys_mkdir(collected, mode); + ksys_chown(collected, uid, gid); + ksys_chmod(collected, mode); dir_add(collected, mtime); } else if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) { if (maybe_link() == 0) { - sys_mknod(collected, mode, rdev); - sys_chown(collected, uid, gid); - sys_chmod(collected, mode); + ksys_mknod(collected, mode, rdev); + ksys_chown(collected, uid, gid); + ksys_chmod(collected, mode); do_utime(collected, mtime); } } @@ -373,7 +373,7 @@ static int __init do_copy(void) if (byte_count >= body_len) { if (xwrite(wfd, victim, body_len) != body_len) error("write error"); - sys_close(wfd); + ksys_close(wfd); do_utime(vcollected, mtime); kfree(vcollected); eat(body_len); @@ -392,8 +392,8 @@ static int __init do_symlink(void) { collected[N_ALIGN(name_len) + body_len] = '\0'; clean_path(collected, 0); - sys_symlink(collected + N_ALIGN(name_len), collected); - sys_lchown(collected, uid, gid); + ksys_symlink(collected + N_ALIGN(name_len), collected); + ksys_lchown(collected, uid, gid); do_utime(collected, mtime); state = SkipIt; next_state = Reset; @@ -567,19 +567,19 @@ static void __init clean_rootfs(void) struct linux_dirent64 *dirp; int num; - fd = sys_open("/", O_RDONLY, 0); + fd = ksys_open("/", O_RDONLY, 0); WARN_ON(fd < 0); if (fd < 0) return; buf = kzalloc(BUF_SIZE, GFP_KERNEL); WARN_ON(!buf); if (!buf) { - sys_close(fd); + ksys_close(fd); return; } dirp = buf; - num = sys_getdents64(fd, dirp, BUF_SIZE); + num = ksys_getdents64(fd, dirp, BUF_SIZE); while (num > 0) { while (num > 0) { struct kstat st; @@ -589,9 +589,9 @@ static void __init clean_rootfs(void) WARN_ON_ONCE(ret); if (!ret) { if (S_ISDIR(st.mode)) - sys_rmdir(dirp->d_name); + ksys_rmdir(dirp->d_name); else - sys_unlink(dirp->d_name); + ksys_unlink(dirp->d_name); } num -= dirp->d_reclen; @@ -599,10 +599,10 @@ static void __init clean_rootfs(void) } dirp = buf; memset(buf, 0, BUF_SIZE); - num = sys_getdents64(fd, dirp, BUF_SIZE); + num = ksys_getdents64(fd, dirp, BUF_SIZE); } - sys_close(fd); + ksys_close(fd); kfree(buf); } #endif @@ -629,7 +629,7 @@ static int __init populate_rootfs(void) } printk(KERN_INFO "rootfs image is not initramfs (%s)" "; looks like an initrd\n", err); - fd = sys_open("/initrd.image", + fd = ksys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); if (fd >= 0) { ssize_t written = xwrite(fd, (char *)initrd_start, @@ -639,7 +639,7 @@ static int __init populate_rootfs(void) pr_err("/initrd.image: incomplete write (%zd != %ld)\n", written, initrd_end - initrd_start); - sys_close(fd); + ksys_close(fd); free_initrd(); } done: diff --git a/init/main.c b/init/main.c index 21efbf6ace93..e4a3160991ea 100644 --- a/init/main.c +++ b/init/main.c @@ -1074,11 +1074,11 @@ static noinline void __init kernel_init_freeable(void) do_basic_setup(); /* Open the /dev/console on the rootfs, this should never fail */ - if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) + if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) pr_err("Warning: unable to open an initial console.\n"); - (void) sys_dup(0); - (void) sys_dup(0); + (void) ksys_dup(0); + (void) ksys_dup(0); /* * check if there is an early userspace init. If yes, let it do all * the work @@ -1087,7 +1087,8 @@ static noinline void __init kernel_init_freeable(void) if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; - if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { + if (ksys_access((const char __user *) + ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } diff --git a/init/noinitramfs.c b/init/noinitramfs.c index 267739d85179..f4bad8436c93 100644 --- a/init/noinitramfs.c +++ b/init/noinitramfs.c @@ -29,17 +29,17 @@ static int __init default_rootfs(void) { int err; - err = sys_mkdir((const char __user __force *) "/dev", 0755); + err = ksys_mkdir((const char __user __force *) "/dev", 0755); if (err < 0) goto out; - err = sys_mknod((const char __user __force *) "/dev/console", + err = ksys_mknod((const char __user __force *) "/dev/console", S_IFCHR | S_IRUSR | S_IWUSR, new_encode_dev(MKDEV(5, 1))); if (err < 0) goto out; - err = sys_mkdir((const char __user __force *) "/root", 0700); + err = ksys_mkdir((const char __user __force *) "/root", 0700); if (err < 0) goto out; |