blob: 15e372b00ce704bc1b1e5db6514db3a4dcd654a4 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#include <linux/kernel.h>
NeilBrownbff61972009-03-31 14:33:13 +11003#include <linux/blkdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <linux/init.h>
5#include <linux/syscalls.h>
6#include <linux/unistd.h>
7#include <linux/slab.h>
8#include <linux/mount.h>
9#include <linux/major.h>
10#include <linux/root_dev.h>
Christoph Hellwigc60166f2020-07-21 11:12:08 +020011#include <linux/init_syscalls.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
Christoph Hellwigc8643c72023-05-31 14:55:19 +020013void mount_root_generic(char *name, char *pretty_name, int flags);
14void mount_root(char *root_device_name);
Linus Torvalds1da177e2005-04-16 15:20:36 -070015extern int root_mountflags;
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Christoph Hellwig09cbcec2020-07-21 12:20:16 +020017static inline __init int create_dev(char *name, dev_t dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070018{
Christoph Hellwig8fb9f732020-07-23 08:23:40 +020019 init_unlink(name);
Christoph Hellwig5fee64f2020-07-22 11:41:20 +020020 return init_mknod(name, S_IFBLK | 0600, new_encode_dev(dev));
Linus Torvalds1da177e2005-04-16 15:20:36 -070021}
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#ifdef CONFIG_BLK_DEV_RAM
24
25int __init rd_load_disk(int n);
26int __init rd_load_image(char *from);
27
28#else
29
30static inline int rd_load_disk(int n) { return 0; }
31static inline int rd_load_image(char *from) { return 0; }
32
33#endif
34
35#ifdef CONFIG_BLK_DEV_INITRD
Christoph Hellwigc8643c72023-05-31 14:55:19 +020036bool __init initrd_load(char *root_device_name);
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#else
Christoph Hellwigc8643c72023-05-31 14:55:19 +020038static inline bool initrd_load(char *root_device_name)
39{
40 return false;
41 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
43#endif