millert@ wrote a diff earlier for scanffs, so that leaves atactl as the
only opendisk() caller in the tree. With this diff, the following works:

# atactl b9b455bd99e393cd

Model: C300-CTFDDAC256MAG, Rev: 0001, Serial #: 0000000010150000C860
Device type: ATA, fixed
Cylinders: 16383, heads: 16, sec/track: 63, total sectors: 500118192
Device capabilities:
        ATA standby timer values
        IORDY operation
        IORDY disabling
Device supports the following standards:
ATA-4 ATA-5 ATA-6 ATA-7 ATA-8 
Device supports the following command sets:
        NOP command
        READ BUFFER command
        WRITE BUFFER command
        Host Protected Area feature set
        Read look-ahead
        Write cache
        Power Management feature set
        Security Mode feature set
        SMART feature set
        Flush Cache Ext command
        Flush Cache command
        Device Configuration Overlay feature set
        48bit address feature set
        Set Max security extension commands
        Power-up in standby feature set
        Advanced Power Management feature set
        DOWNLOAD MICROCODE command
        IDLE IMMEDIATE with UNLOAD FEATURE
        SMART self-test
        SMART error logging
Device has enabled the following command sets/features:
        NOP command
        READ BUFFER command
        WRITE BUFFER command
        Host Protected Area feature set
        Read look-ahead
        Write cache
        Power Management feature set
        SMART feature set
        Flush Cache Ext command
        Flush Cache command
        Device Configuration Overlay feature set
        48bit address feature set
        DOWNLOAD MICROCODE command

To my testing normal usage still works.

ok?

-0-

Index: sbin/atactl/atactl.c
===================================================================
RCS file: /cvs/src/sbin/atactl/atactl.c,v
retrieving revision 1.43
diff -u -p -r1.43 atactl.c
--- sbin/atactl/atactl.c        6 Apr 2011 11:36:25 -0000       1.43
+++ sbin/atactl/atactl.c        4 May 2011 19:45:53 -0000
@@ -355,7 +355,6 @@ int
 main(int argc, char *argv[])
 {
        struct command  *cmdp;
-       char dvname_store[MAXPATHLEN];
 
        if (argc < 2)
                usage();
@@ -363,23 +362,8 @@ main(int argc, char *argv[])
        /*
         * Open the device
         */
-       fd = opendisk(argv[1], O_RDWR, dvname_store, sizeof(dvname_store), 0);
-       if (fd == -1) {
-               if (errno == ENOENT) {
-                       /*
-                        * Device doesn't exist.  Probably trying to open
-                        * a device which doesn't use disk semantics for
-                        * device name.  Try again, specifying "cooked",
-                        * which leaves off the "r" in front of the device's
-                        * name.
-                        */
-                       fd = opendisk(argv[1], O_RDWR, dvname_store,
-                           sizeof(dvname_store), 1);
-                       if (fd == -1)
-                               err(1, "%s", argv[1]);
-               } else
-                       err(1, "%s", argv[1]);
-       }
+       if ((fd = opendev(argv[1], O_RDWR, OPENDEV_PART, NULL)) == -1)
+               err(1, "%s", argv[1]);
 
        /* Skip program name and device name. */
        if (argc != 2) {
-- 
Jone's Motto:
        Friends come and go, but enemies accumulate.

Reply via email to