[BusyBox 0001066]: New tool: raidautorun

bugs at busybox.net bugs at busybox.net
Mon Oct 23 13:27:38 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
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:                     assigned
====================================================================== 
Date Submitted:             10-05-2006 05:13 PDT
Last Modified:              10-23-2006 06:27 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 

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                          
======================================================================




More information about the busybox-cvs mailing list