[BusyBox 0001066]: New tool: raidautorun
bugs at busybox.net
bugs at busybox.net
Tue Oct 24 20:07:54 UTC 2006
The following issue has been CLOSED
======================================================================
http://busybox.net/bugs/view.php?id=1066
======================================================================
Reported By: Thomas Jarosch
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 1066
Category: New Features
Reproducibility: always
Severity: minor
Priority: normal
Status: closed
Resolution: open
Fixed in Version:
======================================================================
Date Submitted: 10-05-2006 05:13 PDT
Last Modified: 10-24-2006 13:07 PDT
======================================================================
Summary: New tool: raidautorun
Description:
Hello,
we use busybox as part of a initramfs based boot system.
After loading SATA/SCSI/IDE drivers, we have to tell the kernel
to autodetect md based RAID devices. This is done by calling an ioctl.
Here's a patch for busybox to add a "raidautorun" tool.
Best regards,
Thomas Jarosch
======================================================================
----------------------------------------------------------------------
vda - 10-15-06 11:25
----------------------------------------------------------------------
+int raidautorun_main(int argc, char *argv[])
+{
+ int fd;
+
+ if (argc != 2)
+ bb_show_usage();
+
+ if ((fd = open(argv[1], O_RDONLY)) == -1) {
+ bb_error_msg("Can't open md device %s\n", argv[1]);
+ return EXIT_FAILURE;
+ }
+
+ if (ioctl(fd, RAID_AUTORUN, NULL) != 0) {
+ bb_error_msg("RAID_AUTORUN ioctl failed\n");
+ close (fd);
+ return EXIT_FAILURE;
+ }
+
+ close (fd);
+
+ return EXIT_SUCCESS;
+}
Please indent using tabs.
Please use xopen(), XXXXerror_msg_and_die()
Please do not place assignment in if().
----------------------------------------------------------------------
Thomas Jarosch - 10-19-06 01:00
----------------------------------------------------------------------
Ok, will do. Might take some time.
----------------------------------------------------------------------
bernhardf - 10-19-06 04:41
----------------------------------------------------------------------
raidautorun.01c.patch
added a version that takes vda's comment into account. Still way too big
;)
text data bss dec hex filename
79 0 0 79 4f miscutils/raidautorun.o
----------------------------------------------------------------------
bernhardf - 10-19-06 07:01
----------------------------------------------------------------------
busybox-raidautorun.01d.patch
Is what i'd check in;
text data bss dec hex filename
60 0 0 60 3c miscutils/raidautorun.o
thanks,
Bernhard
----------------------------------------------------------------------
bernhardf - 10-21-06 05:11
----------------------------------------------------------------------
Thomas,
vda did check the applet in, please test if it's ok for you and report
back so
i can close this issue.
After 2006-11-01, this issue will be closed if i don't hear anything
back.
Thanks,
----------------------------------------------------------------------
Thomas Jarosch - 10-23-06 06:27
----------------------------------------------------------------------
Hello Bernhard,
Thanks for doing the modifications. I'll test the new code tomorrow.
There are two concerns about the 01d revision:
1. You can't distinguish if it's a permission problem (/dev/md0 open
failed)
or if the ioctl() failed.
2. Does is still show the usage if you call it without parameters?
I'll test this tomorrow.
Cheers,
Thomas
----------------------------------------------------------------------
Thomas Jarosch - 10-24-06 09:28
----------------------------------------------------------------------
Hello Bernhard,
the new code runs fine. My only suggestion is to add the
if (argc != 2)
bb_show_usage();
part back in. Otherwise argv[1] could point to invalid memory.
Or does busybox somehow handle this magically?
Cheers,
Thomas
----------------------------------------------------------------------
bernhardf - 10-24-06 13:07
----------------------------------------------------------------------
We don't handle this magically, no.
Added the check, fwiw.
text data bss dec hex filename
53 0 0 53 35 miscutils/raidautorun.o.r16429
65 0 0 65 41 miscutils/raidautorun.o
Fixed in r16430
Issue History
Date Modified Username Field Change
======================================================================
10-05-06 05:13 Thomas Jarosch New Issue
10-05-06 05:13 Thomas Jarosch Status new => assigned
10-05-06 05:13 Thomas Jarosch Assigned To => BusyBox
10-05-06 05:13 Thomas Jarosch File Added: busybox-raidautorun.patch
10-15-06 11:25 vda Note Added: 0001704
10-19-06 01:00 Thomas Jarosch Note Added: 0001708
10-19-06 04:40 bernhardf File Added: busybox-raidautorun.01c.patch
10-19-06 04:41 bernhardf Note Added: 0001709
10-19-06 07:00 bernhardf File Added: busybox-raidautorun.01d.patch
10-19-06 07:01 bernhardf Note Added: 0001710
10-21-06 05:11 bernhardf Note Added: 0001713
10-23-06 06:27 Thomas Jarosch Note Added: 0001714
10-24-06 09:28 Thomas Jarosch Note Added: 0001716
10-24-06 13:07 bernhardf Status assigned => closed
10-24-06 13:07 bernhardf Note Added: 0001717
======================================================================
More information about the busybox-cvs
mailing list