Sorry for the double-post, I'm trying to get Outlook to send the attachment
correctly.

---

Hi, guys. This is my first post, so please let me know if I'm doing this
wrong.

There seems to be a bug in the current busybox "hdparm" applet.

Here is an example of the problem ...

        [EMAIL PROTECTED]:/usr/src/busybox-1.8.2/_install/bin# ./busybox hdparm
/dev/hda

        /dev/hda:
         multcount      =  0 (off)
         IO_support     =  0 (default 16-bit)
        hdparm: HDIO_GET_UNMASKINTR: Bad address
         using_dma      =  1 (on)
        hdparm: HDIO_GET_KEEPSETTINGS: Bad address
        hdparm: BLKROGET: Bad address
        hdparm: BLKRAGET: Bad address
         geometry       = 30515/255/63, sectors = 490234752, start = 0

I’ve tracked it down to a bunch of calls in miscutils/hdparm.c like ...

        if(!ioctl_or_warn(fd, HDIO_GET_UNMASKINTR, (unsigned long *)parm))

instead of ...

        if(!ioctl_or_warn(fd, HDIO_GET_UNMASKINTR, &parm))

I've patched all the suspect function calls, and now get the proper result
...

        [EMAIL PROTECTED]:/usr/src/busybox-1.8.2/_install/bin# ./busybox hdparm
/dev/hda

        /dev/hda:
         multcount      =  0 (off)
         IO_support     =  0 (default 16-bit)
         unmaskirq      =  0 (off)
         using_dma      =  1 (on)
         keepsettings   =  0 (off)
         readonly       =  0 (off)
         readahead      = 256 (on)
         geometry       = 30515/255/63, sectors = 490234752, start = 0

I've looked back as far as the busybox 1.6.2 release, and the problem goes
back at least that long.

I'm attaching a patch that works for the 1.7.4, 1.8.2, 1.9.0 and current
source trees.

The problem also appears in the 1.6.2 source, but the source code changes in
miscutils/hdparm.c between 1.6.2 and 1.7 were too great for the patch to
apply successfully.

Thanks,

John Brandwood


No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.19.2/1221 - Release Date: 1/12/2008
2:04 PM
 
  
diff -Naur busybox-1.8.2-original/miscutils/hdparm.c 
busybox-1.8.2/miscutils/hdparm.c
--- busybox-1.8.2-original/miscutils/hdparm.c   2007-11-09 17:40:53.000000000 
-0800
+++ busybox-1.8.2/miscutils/hdparm.c    2008-01-10 22:41:28.595203000 -0800
@@ -1763,7 +1763,7 @@
                }
        }
        if (get_unmask) {
-               if(!ioctl_or_warn(fd, HDIO_GET_UNMASKINTR, (unsigned long 
*)parm))
+               if(!ioctl_or_warn(fd, HDIO_GET_UNMASKINTR, &parm))
                        print_value_on_off("unmaskirq", parm);
        }
 
@@ -1780,24 +1780,24 @@
        }
 #endif
        if (get_dma_q) {
-               if(!ioctl_or_warn(fd, HDIO_GET_QDMA, (unsigned long *)parm))
+               if(!ioctl_or_warn(fd, HDIO_GET_QDMA, &parm))
                        print_value_on_off("queue_depth", parm);
        }
        if (get_keep) {
-               if(!ioctl_or_warn(fd, HDIO_GET_KEEPSETTINGS, (unsigned long 
*)parm))
+               if(!ioctl_or_warn(fd, HDIO_GET_KEEPSETTINGS, &parm))
                        print_value_on_off("keepsettings", parm);
        }
 
        if (get_nowerr) {
-               if(!ioctl_or_warn(fd, HDIO_GET_NOWERR, (unsigned long *)parm))
+               if(!ioctl_or_warn(fd, HDIO_GET_NOWERR, &parm))
                        print_value_on_off("nowerr", parm);
        }
        if (get_readonly) {
-               if(!ioctl_or_warn(fd, BLKROGET, (unsigned long *)parm))
+               if(!ioctl_or_warn(fd, BLKROGET, &parm))
                        print_value_on_off("readonly", parm);
        }
        if (get_readahead) {
-               if(!ioctl_or_warn(fd, BLKRAGET, (unsigned long *)parm))
+               if(!ioctl_or_warn(fd, BLKRAGET, &parm))
                        print_value_on_off("readahead", parm);
        }
        if (get_geom) {
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to