Just like the NFS and CIFS root code this better lives with the driver it is tightly integrated with.
Unified · Split
| @@ -43,6 +43,9 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o · 42 unmodified lines | ||
| 43 | 43 | obj-$(CONFIG_MD_CLUSTER) += md-cluster.o |
| 44 | 44 | obj-$(CONFIG_BCACHE) += bcache/ |
| 45 | 45 | obj-$(CONFIG_BLK_DEV_MD) += md-mod.o |
| 46 | +ifeq ($(CONFIG_BLK_DEV_MD),y) | |
| 47 | +obj-y += md-autodetect.o | |
| 48 | +endif | |
| 46 | 49 | obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o |
| 47 | 50 | obj-$(CONFIG_BLK_DEV_DM_BUILTIN) += dm-builtin.o |
| 48 | 51 | obj-$(CONFIG_DM_UNSTRIPED) += dm-unstripe.o |
| @@ -1,10 +1,15 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | +#include <linux/kernel.h> | |
| 3 | +#include <linux/blkdev.h> | |
| 4 | +#include <linux/init.h> | |
| 5 | +#include <linux/syscalls.h> | |
| 6 | +#include <linux/mount.h> | |
| 7 | +#include <linux/major.h> | |
| 2 | 8 | #include <linux/delay.h> |
| 9 | +#include <linux/raid/detect.h> | |
| 3 | 10 | #include <linux/raid/md_u.h> |
| 4 | 11 | #include <linux/raid/md_p.h> |
| 5 | 12 | |
| 6 | −#include "do_mounts.h" | |
| 7 | − | |
| 8 | 13 | /* |
| 9 | 14 | * When md (and any require personalities) are compiled into the kernel |
| 10 | 15 | * (not a module), arrays can be assembles are boot time using with AUTODETECT |
| @@ -114,6 +119,12 @@ static int __init md_setup(char *str) · 103 unmodified lines | ||
| 114 | 119 | return 1; |
| 115 | 120 | } |
| 116 | 121 | |
| 122 | +static inline int create_dev(char *name, dev_t dev) | |
| 123 | +{ | |
| 124 | + ksys_unlink(name); | |
| 125 | + return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev)); | |
| 126 | +} | |
| 127 | + | |
| 117 | 128 | static void __init md_setup_drive(void) |
| 118 | 129 | { |
| 119 | 130 | int minor, i, ent, partitioned; |
| @@ -1,3 +1,11 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | 2 | |
| 3 | 3 | void md_autodetect_dev(dev_t dev); |
| 4 | + | |
| 5 | +#ifdef CONFIG_BLK_DEV_MD | |
| 6 | +void md_run_setup(void); | |
| 7 | +#else | |
| 8 | +static inline void md_run_setup(void) | |
| 9 | +{ | |
| 10 | +} | |
| 11 | +#endif | |
| @@ -18,7 +18,6 @@ obj-y += init_task.o · 17 unmodified lines | ||
| 18 | 18 | mounts-y := do_mounts.o |
| 19 | 19 | mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o |
| 20 | 20 | mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o |
| 21 | −mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o | |
| 22 | 21 | |
| 23 | 22 | # dependencies on generated files need to be listed explicitly |
| 24 | 23 | $(obj)/version.o: include/generated/compile.h |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/nfs_fs.h> |
| 24 | 24 | #include <linux/nfs_fs_sb.h> |
| 25 | 25 | #include <linux/nfs_mount.h> |
| 26 | +#include <linux/raid/detect.h> | |
| 26 | 27 | #include <uapi/linux/mount.h> |
| 27 | 28 | |
| 28 | 29 | #include "do_mounts.h" |
| @@ -41,13 +41,3 @@ bool __init initrd_load(void); · 40 unmodified lines | ||
| 41 | 41 | static inline bool initrd_load(void) { return false; } |
| 42 | 42 | |
| 43 | 43 | #endif |
| 44 | − | |
| 45 | −#ifdef CONFIG_BLK_DEV_MD | |
| 46 | − | |
| 47 | −void md_run_setup(void); | |
| 48 | − | |
| 49 | −#else | |
| 50 | − | |
| 51 | −static inline void md_run_setup(void) {} | |
| 52 | − | |
| 53 | −#endif | |