mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
87c4e19262
Using the fs-internal do_mknodat() helper allows us to get rid of fs-internal calls to the sys_mknodat() syscall. Introducing the ksys_mknod() wrapper allows us to avoid the in-kernel calls to sys_mknod() syscall. The ksys_ prefix denotes that this function is meant as a drop-in replacement for the syscall. In particular, it uses the same calling convention as sys_mknod(). This patch is part of a series which removes in-kernel calls to syscalls. On this basis, the syscall entry path can be streamlined. For details, see http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
64 lines
1.1 KiB
C
64 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#include <linux/kernel.h>
|
|
#include <linux/blkdev.h>
|
|
#include <linux/init.h>
|
|
#include <linux/syscalls.h>
|
|
#include <linux/unistd.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/mount.h>
|
|
#include <linux/major.h>
|
|
#include <linux/root_dev.h>
|
|
|
|
void change_floppy(char *fmt, ...);
|
|
void mount_block_root(char *name, int flags);
|
|
void mount_root(void);
|
|
extern int root_mountflags;
|
|
|
|
static inline int create_dev(char *name, dev_t dev)
|
|
{
|
|
ksys_unlink(name);
|
|
return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
|
|
}
|
|
|
|
static inline u32 bstat(char *name)
|
|
{
|
|
struct kstat stat;
|
|
if (vfs_stat(name, &stat) != 0)
|
|
return 0;
|
|
if (!S_ISBLK(stat.mode))
|
|
return 0;
|
|
return stat.rdev;
|
|
}
|
|
|
|
#ifdef CONFIG_BLK_DEV_RAM
|
|
|
|
int __init rd_load_disk(int n);
|
|
int __init rd_load_image(char *from);
|
|
|
|
#else
|
|
|
|
static inline int rd_load_disk(int n) { return 0; }
|
|
static inline int rd_load_image(char *from) { return 0; }
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_BLK_DEV_INITRD
|
|
|
|
bool __init initrd_load(void);
|
|
|
|
#else
|
|
|
|
static inline bool initrd_load(void) { return false; }
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_BLK_DEV_MD
|
|
|
|
void md_run_setup(void);
|
|
|
|
#else
|
|
|
|
static inline void md_run_setup(void) {}
|
|
|
|
#endif
|