blob: 282d65bfd6741e51c7f341c9c4fda65a492936c6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/kernel.h>
NeilBrownbff61972009-03-31 14:33:13 +11002#include <linux/blkdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07003#include <linux/init.h>
4#include <linux/syscalls.h>
5#include <linux/unistd.h>
6#include <linux/slab.h>
7#include <linux/mount.h>
8#include <linux/major.h>
9#include <linux/root_dev.h>
10
Linus Torvalds1da177e2005-04-16 15:20:36 -070011void change_floppy(char *fmt, ...);
12void mount_block_root(char *name, int flags);
13void mount_root(void);
14extern int root_mountflags;
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Greg Kroah-Hartmanbdaf8522005-06-20 21:15:16 -070016static inline int create_dev(char *name, dev_t dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070017{
18 sys_unlink(name);
19 return sys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
20}
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022static inline u32 bstat(char *name)
23{
Arnd Bergmann046aa122017-05-08 15:57:00 -070024 struct kstat stat;
25 if (vfs_stat(name, &stat) != 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 return 0;
Arnd Bergmann046aa122017-05-08 15:57:00 -070027 if (!S_ISBLK(stat.mode))
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 return 0;
Arnd Bergmann046aa122017-05-08 15:57:00 -070029 return stat.rdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030}
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32#ifdef CONFIG_BLK_DEV_RAM
33
34int __init rd_load_disk(int n);
35int __init rd_load_image(char *from);
36
37#else
38
39static inline int rd_load_disk(int n) { return 0; }
40static inline int rd_load_image(char *from) { return 0; }
41
42#endif
43
44#ifdef CONFIG_BLK_DEV_INITRD
45
Yaowei Baif057f3b2016-01-20 14:59:29 -080046bool __init initrd_load(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48#else
49
Yaowei Baif057f3b2016-01-20 14:59:29 -080050static inline bool initrd_load(void) { return false; }
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52#endif
53
54#ifdef CONFIG_BLK_DEV_MD
55
56void md_run_setup(void);
57
58#else
59
60static inline void md_run_setup(void) {}
61
62#endif