Группа :: Система/Ядро и оборудование
Пакет: mkinitrd-busybox
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: busybox-1.00.pre8-alt-raidautorun.patch
--- include/applets.h.orig 2004-07-24 16:13:57 +0400
+++ include/applets.h 2004-07-24 16:14:28 +0400
@@ -463,6 +463,9 @@
#ifdef CONFIG_PWD
APPLET(pwd, pwd_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
+#ifdef CONFIG_RAIDAUTORUN
+ APPLET(raidautorun, raidautorun_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+#endif
#ifdef CONFIG_RDATE
APPLET(rdate, rdate_main, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)
#endif
--- include/usage.h.orig 2004-02-22 15:25:47 +0300
+++ include/usage.h 2004-07-24 16:14:56 +0400
@@ -1975,6 +1975,15 @@
"Start MD_DEVICE, taking superblock from DISK_DEVICE.\n" \
"Example: raid_start /dev/md0 /dev/sdb"
+#define raidautorun_trivial_usage \
+ "[DEVICE]"
+#define raidautorun_full_usage \
+ "Start all autodetected Software-RAID devices.\n"
+ "\n"
+ "DEVICE is used only for communication with the kernel RAID driver -\n"
+ "all detected devices are started, not only the one specified.\n"
+ "If DEVICE is omitted, /dev/md0 is used."
+
#define rdate_trivial_usage \
"[-sp] HOST"
#define rdate_full_usage \
--- miscutils/Config.in.orig 2003-12-20 10:30:35 +0300
+++ miscutils/Config.in 2004-07-24 16:19:02 +0400
@@ -188,5 +188,11 @@
certain amount of time, the watchdog device assumes the system has
hung, and will cause the hardware to reboot.
+config CONFIG_RAIDAUTORUN
+ bool "raidautorun"
+ default y
+ help
+ Start all autodetected Software-RAID devices
+
endmenu
--- miscutils/Makefile.in.orig 2003-12-20 10:30:35 +0300
+++ miscutils/Makefile.in 2004-07-24 16:19:49 +0400
@@ -37,6 +37,7 @@
MISCUTILS-$(CONFIG_STRINGS) += strings.o
MISCUTILS-$(CONFIG_TIME) += time.o
MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o
+MISCUTILS-$(CONFIG_RAIDAUTORUN) += raidautorun.o
libraries-y+=$(MISCUTILS_DIR)$(MISCUTILS_AR)
--- miscutils/raidautorun.c.alt-raidautorun 2003-07-09 15:33:46 +0400
+++ miscutils/raidautorun.c 2003-07-09 15:34:39 +0400
@@ -0,0 +1,64 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Mini raidautorun implementation for busybox
+ *
+ *
+ * Copyright (C) 2003 by Sergey Vlasov <vsu@altlinux.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA
+ *
+ */
+
+/* getopt not needed */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include <linux/major.h>
+#include <linux/raid/md_u.h>
+
+#include "busybox.h"
+
+
+int raidautorun_main(int argc, char **argv)
+{
+ const char *md_name;
+ int md_fd;
+
+ if (argc == 1) {
+ md_name = "/dev/md0";
+ } else if (argc == 2) {
+ md_name = argv[1];
+ } else {
+ bb_show_usage();
+ }
+
+ md_fd = open(md_name, O_RDWR);
+ if (md_fd == -1) {
+ bb_perror_msg_and_die("%s: open", md_name);
+ }
+
+ if (ioctl(md_fd, RAID_AUTORUN, 0L) == -1) {
+ bb_perror_msg_and_die("%s: RAID_AUTORUN", md_name);
+ }
+
+ return EXIT_SUCCESS;
+}