]> git.pld-linux.org Git - packages/busybox.git/blob - busybox-raid_start.patch
- missing include (needed on big-endians)
[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/sysdeps/linux/defconfig busybox-1.00-pre2/sysdeps/linux/defconfig
15 --- busybox-1.00-pre2.org/sysdeps/linux/defconfig       2003-08-02 23:46:49.000000000 +0200
16 +++ busybox-1.00-pre2/sysdeps/linux/defconfig   2003-08-03 00:32:31.000000000 +0200
17 @@ -290,6 +290,7 @@
18  # CONFIG_FEATURE_USE_DEVPS_PATCH is not set
19  CONFIG_UMOUNT=y
20  # CONFIG_FEATURE_MOUNT_FORCE is not set
21 +CONFIG_RAID_START=y
22  
23  #
24  # Common options for mount/umount
25 diff -urN busybox-1.00-pre2.org/util-linux/Config.in busybox-1.00-pre2/util-linux/Config.in
26 --- busybox-1.00-pre2.org/util-linux/Config.in  2003-08-02 23:46:49.000000000 +0200
27 +++ busybox-1.00-pre2/util-linux/Config.in      2003-08-03 00:32:31.000000000 +0200
28 @@ -285,6 +285,12 @@
29           NFS filesystems.  Most people using BusyBox will also want to enable
30           the 'mount' utility.
31  
32 +config CONFIG_RAID_START
33 +       bool "raid_start"
34 +       default y
35 +       help
36 +         Enable support for RAID starting.
37 +
38  config CONFIG_NFSMOUNT
39         bool "  Support mounting nfs file systems"
40         default n
41 diff -urN busybox-1.00-pre2.org/util-linux/Makefile.in busybox-1.00-pre2/util-linux/Makefile.in
42 --- busybox-1.00-pre2.org/util-linux/Makefile.in        2003-08-02 23:46:49.000000000 +0200
43 +++ busybox-1.00-pre2/util-linux/Makefile.in    2003-08-03 00:32:31.000000000 +0200
44 @@ -38,6 +38,7 @@
45  UTILLINUX-$(CONFIG_MKSWAP)             += mkswap.o
46  UTILLINUX-$(CONFIG_MORE)               += more.o
47  UTILLINUX-$(CONFIG_MOUNT)              += mount.o
48 +UTILLINUX-$(CONFIG_RAID_START)         += raid_start.o
49  UTILLINUX-$(CONFIG_NFSMOUNT)           += nfsmount.o
50  UTILLINUX-$(CONFIG_PIVOT_ROOT) += pivot_root.o
51  UTILLINUX-$(CONFIG_RDATE)              += rdate.o
52 diff -urN busybox-1.00-pre2.org/util-linux/raid_start.c busybox-1.00-pre2/util-linux/raid_start.c
53 --- busybox-1.00-pre2.org/util-linux/raid_start.c       1970-01-01 01:00:00.000000000 +0100
54 +++ busybox-1.00-pre2/util-linux/raid_start.c   2003-08-03 00:34:47.000000000 +0200
55 @@ -0,0 +1,72 @@
56 +/* vi: set sw=4 ts=4: */
57 +/*
58 + * raid_start implementation for busybox
59 + *
60 + * Copyright (C) 2003 by Michal Moskal <malekith@pld-linux.org>
61 + *
62 + * This program is free software; you can redistribute it and/or modify
63 + * it under the terms of the GNU General Public License as published by
64 + * the Free Software Foundation; either version 2 of the License, or
65 + * (at your option) any later version.
66 + *
67 + * This program is distributed in the hope that it will be useful,
68 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
69 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
70 + * General Public License for more details.
71 + *
72 + * You should have received a copy of the GNU General Public License
73 + * along with this program; if not, write to the Free Software
74 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
75 + *
76 + */
77 +
78 +#include <sys/types.h>
79 +#include <sys/stat.h>
80 +#include <sys/ioctl.h>
81 +#include <fcntl.h>
82 +#include <unistd.h>
83 +
84 +#include "busybox.h"
85 +
86 +#define MD_MAJOR        9
87 +#define START_ARRAY             _IO (MD_MAJOR, 0x31)
88 +
89 +extern int raid_start_main(int argc, char **argv)
90 +{
91 +       int fd_md;
92 +       int i;
93 +       struct stat st;
94 +       
95 +       if (argc < 3) {
96 +           bb_show_usage();
97 +               return 0;
98 +       }
99 +
100 +       fd_md = open(argv[1], O_RDWR, 0);
101 +       if (fd_md < 0)
102 +               bb_perror_msg_and_die("error opening raid device `%s'", argv[1]);
103 +
104 +       for (i = 2; i < argc; i++) {
105 +       if (stat(argv[i], &st)) {
106 +                       bb_perror_msg("error stating raid builing device `%s'", argv[i]);
107 +                       continue;
108 +               }
109 +
110 +               if (ioctl(fd_md, START_ARRAY, (unsigned long) st.st_rdev) == -1) {
111 +                       bb_perror_msg("error starting raid device `%s:%s'", argv[1], argv[i]);
112 +                       continue;
113 +               }
114 +
115 +               return 0;
116 +       }
117 +
118 +       return 1;
119 +}
120 +
121 +/*
122 +Local Variables:
123 +c-file-style: "linux"
124 +c-basic-offset: 4
125 +tab-width: 4
126 +End:
127 +*/
This page took 0.03561 seconds and 3 git commands to generate.