]> git.pld-linux.org Git - packages/busybox.git/blame - busybox-raid_start.patch
- 1.01
[packages/busybox.git] / busybox-raid_start.patch
CommitLineData
c4f88021 1diff -urN busybox-1.00.orig/include/applets.h busybox-1.00/include/applets.h
2--- busybox-1.00.orig/include/applets.h 2004-08-27 01:01:34.000000000 +0200
3+++ busybox-1.00/include/applets.h 2005-02-02 21:20:49.047901536 +0100
4@@ -454,6 +454,9 @@
1d62e784
AM
5 #ifdef CONFIG_PWD
6 APPLET(pwd, pwd_main, _BB_DIR_BIN, _BB_SUID_NEVER)
ab2882b2 7 #endif
1d62e784 8+#ifdef CONFIG_RAID_START
5286e124 9+ APPLET(raid_start, raid_start_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
ab2882b2 10+#endif
1d62e784
AM
11 #ifdef CONFIG_RDATE
12 APPLET(rdate, rdate_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
ab2882b2 13 #endif
c4f88021 14diff -urN busybox-1.00.orig/include/usage.h busybox-1.00/include/usage.h
15--- busybox-1.00.orig/include/usage.h 2004-09-14 18:23:56.000000000 +0200
16+++ busybox-1.00/include/usage.h 2005-02-02 21:35:31.165799232 +0100
17@@ -1977,6 +1977,12 @@
18 "$ pwd\n" \
19 "/root\n"
20
21+#define raid_start_trivial_usage \
22+ "MD_DEVICE DISK_DEVICE"
23+#define raid_start_full_usage \
24+ "Start MD_DEVICE, taking superblock from DISK_DEVICE.\n" \
25+ "Example: raid_start /dev/md0 /dev/sdb"
26+
27 #define rdate_trivial_usage \
28 "[-sp] HOST"
29 #define rdate_full_usage \
30diff -urN busybox-1.00.orig/sysdeps/linux/defconfig busybox-1.00/sysdeps/linux/defconfig
31--- busybox-1.00.orig/sysdeps/linux/defconfig 2004-07-20 08:06:56.000000000 +0200
32+++ busybox-1.00/sysdeps/linux/defconfig 2005-02-02 21:20:49.049901232 +0100
33@@ -408,6 +408,7 @@
34 # CONFIG_NFSMOUNT is not set
1d62e784
AM
35 CONFIG_UMOUNT=y
36 # CONFIG_FEATURE_MOUNT_FORCE is not set
37+CONFIG_RAID_START=y
38
39 #
40 # Common options for mount/umount
c4f88021 41diff -urN busybox-1.00.orig/util-linux/Config.in busybox-1.00/util-linux/Config.in
42--- busybox-1.00.orig/util-linux/Config.in 2004-05-19 13:06:20.000000000 +0200
43+++ busybox-1.00/util-linux/Config.in 2005-02-02 21:20:49.050901080 +0100
44@@ -292,6 +292,12 @@
1d62e784
AM
45 NFS filesystems. Most people using BusyBox will also want to enable
46 the 'mount' utility.
47
48+config CONFIG_RAID_START
49+ bool "raid_start"
50+ default y
51+ help
52+ Enable support for RAID starting.
53+
54 config CONFIG_NFSMOUNT
c4f88021 55 bool " Support mounting NFS file systems"
1d62e784 56 default n
c4f88021 57diff -urN busybox-1.00.orig/util-linux/Makefile.in busybox-1.00/util-linux/Makefile.in
58--- busybox-1.00.orig/util-linux/Makefile.in 2004-10-08 09:46:08.000000000 +0200
59+++ busybox-1.00/util-linux/Makefile.in 2005-02-02 21:20:49.051900928 +0100
60@@ -39,6 +39,7 @@
4d68ce46 61 UTILLINUX-$(CONFIG_MKSWAP) +=mkswap.o
62 UTILLINUX-$(CONFIG_MORE) +=more.o
63 UTILLINUX-$(CONFIG_MOUNT) +=mount.o
64+UTILLINUX-$(CONFIG_RAID_START) +=raid_start.o
65 UTILLINUX-$(CONFIG_NFSMOUNT) +=nfsmount.o
66 UTILLINUX-$(CONFIG_PIVOT_ROOT) +=pivot_root.o
67 UTILLINUX-$(CONFIG_RDATE) +=rdate.o
c4f88021 68diff -urN busybox-1.00.orig/util-linux/raid_start.c busybox-1.00/util-linux/raid_start.c
69--- busybox-1.00.orig/util-linux/raid_start.c 1970-01-01 01:00:00.000000000 +0100
70+++ busybox-1.00/util-linux/raid_start.c 2005-02-02 21:20:49.053900624 +0100
92db87e7 71@@ -0,0 +1,72 @@
ab2882b2
MM
72+/* vi: set sw=4 ts=4: */
73+/*
74+ * raid_start implementation for busybox
75+ *
76+ * Copyright (C) 2003 by Michal Moskal <malekith@pld-linux.org>
77+ *
78+ * This program is free software; you can redistribute it and/or modify
79+ * it under the terms of the GNU General Public License as published by
80+ * the Free Software Foundation; either version 2 of the License, or
81+ * (at your option) any later version.
82+ *
83+ * This program is distributed in the hope that it will be useful,
84+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
85+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
86+ * General Public License for more details.
87+ *
88+ * You should have received a copy of the GNU General Public License
89+ * along with this program; if not, write to the Free Software
90+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
91+ *
92+ */
93+
94+#include <sys/types.h>
95+#include <sys/stat.h>
96+#include <sys/ioctl.h>
97+#include <fcntl.h>
98+#include <unistd.h>
99+
100+#include "busybox.h"
101+
102+#define MD_MAJOR 9
103+#define START_ARRAY _IO (MD_MAJOR, 0x31)
104+
105+extern int raid_start_main(int argc, char **argv)
106+{
107+ int fd_md;
92db87e7 108+ int i;
ab2882b2
MM
109+ struct stat st;
110+
92db87e7 111+ if (argc < 3) {
62f3184c
AM
112+ bb_show_usage();
113+ return 0;
114+ }
ab2882b2
MM
115+
116+ fd_md = open(argv[1], O_RDWR, 0);
117+ if (fd_md < 0)
62f3184c 118+ bb_perror_msg_and_die("error opening raid device `%s'", argv[1]);
ab2882b2 119+
92db87e7
MM
120+ for (i = 2; i < argc; i++) {
121+ if (stat(argv[i], &st)) {
122+ bb_perror_msg("error stating raid builing device `%s'", argv[i]);
123+ continue;
124+ }
ab2882b2 125+
92db87e7
MM
126+ if (ioctl(fd_md, START_ARRAY, (unsigned long) st.st_rdev) == -1) {
127+ bb_perror_msg("error starting raid device `%s:%s'", argv[1], argv[i]);
128+ continue;
129+ }
ab2882b2 130+
92db87e7
MM
131+ return 0;
132+ }
133+
134+ return 1;
ab2882b2
MM
135+}
136+
137+/*
138+Local Variables:
139+c-file-style: "linux"
140+c-basic-offset: 4
141+tab-width: 4
142+End:
143+*/
This page took 0.056184 seconds and 4 git commands to generate.