]> git.pld-linux.org Git - packages/busybox.git/blob - busybox-raid_start.patch
- more things enabled
[packages/busybox.git] / busybox-raid_start.patch
1 diff -urN busybox-1.00-pre2.org/include/applets.h busybox-1.00-pre2/include/applets.h
2 --- busybox-1.00-pre2.org/include/applets.h     2003-08-02 23:46:48.000000000 +0200
3 +++ busybox-1.00-pre2/include/applets.h 2003-08-03 00:32:31.000000000 +0200
4 @@ -457,6 +457,9 @@
5  #ifdef CONFIG_PWD
6         APPLET(pwd, pwd_main, _BB_DIR_BIN, _BB_SUID_NEVER)
7  #endif
8 +#ifdef CONFIG_RAID_START
9 +       APPLET(raid_start, raid_start_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
10 +#endif
11  #ifdef CONFIG_RDATE
12         APPLET(rdate, rdate_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
13  #endif
14 diff -urN busybox-1.00-pre2.org/include/usage.h busybox-1.00-pre2/include/usage.h
15 --- busybox-1.00-pre2.org/include/usage.h       2003-08-02 23:46:48.000000000 +0200
16 +++ busybox-1.00-pre2/include/usage.h   2003-08-03 00:32:31.000000000 +0200
17 @@ -1924,6 +1924,12 @@
18         "$ pwd\n" \
19         "/root\n"
20  
21 +#define raid_start_trivial_usage \
22 +       "MD_DEVICE DISK_DEVICES..."
23 +#define raid_start_full_usage \
24 +       "Start MD_DEVICE, taking superblock from DISK_DEVICES.\n" \
25 +       "Example: raid_start /dev/md0 /dev/sdb /dev/sdc2"
26 +       
27  #define rdate_trivial_usage \
28         "[-sp] HOST"
29  #define rdate_full_usage \
30 diff -urN busybox-1.00-pre2.org/sysdeps/linux/defconfig busybox-1.00-pre2/sysdeps/linux/defconfig
31 --- busybox-1.00-pre2.org/sysdeps/linux/defconfig       2003-08-02 23:46:49.000000000 +0200
32 +++ busybox-1.00-pre2/sysdeps/linux/defconfig   2003-08-03 00:32:31.000000000 +0200
33 @@ -290,6 +290,7 @@
34  # CONFIG_FEATURE_USE_DEVPS_PATCH is not set
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
41 diff -urN busybox-1.00-pre2.org/util-linux/Config.in busybox-1.00-pre2/util-linux/Config.in
42 --- busybox-1.00-pre2.org/util-linux/Config.in  2003-08-02 23:46:49.000000000 +0200
43 +++ busybox-1.00-pre2/util-linux/Config.in      2003-08-03 00:32:31.000000000 +0200
44 @@ -285,6 +285,12 @@
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
55         bool "  Support mounting nfs file systems"
56         default n
57 diff -urN busybox-1.00-pre2.org/util-linux/Makefile.in busybox-1.00-pre2/util-linux/Makefile.in
58 --- busybox-1.00-pre2.org/util-linux/Makefile.in        2003-08-02 23:46:49.000000000 +0200
59 +++ busybox-1.00-pre2/util-linux/Makefile.in    2003-08-03 00:32:31.000000000 +0200
60 @@ -38,6 +38,7 @@
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
68 diff -urN busybox-1.00-pre2.org/util-linux/raid_start.c busybox-1.00-pre2/util-linux/raid_start.c
69 --- busybox-1.00-pre2.org/util-linux/raid_start.c       1970-01-01 01:00:00.000000000 +0100
70 +++ busybox-1.00-pre2/util-linux/raid_start.c   2003-08-03 00:34:47.000000000 +0200
71 @@ -0,0 +1,72 @@
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;
108 +       int i;
109 +       struct stat st;
110 +       
111 +       if (argc < 3) {
112 +           bb_show_usage();
113 +               return 0;
114 +       }
115 +
116 +       fd_md = open(argv[1], O_RDWR, 0);
117 +       if (fd_md < 0)
118 +               bb_perror_msg_and_die("error opening raid device `%s'", argv[1]);
119 +
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 +               }
125 +
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 +               }
130 +
131 +               return 0;
132 +       }
133 +
134 +       return 1;
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.074359 seconds and 3 git commands to generate.