Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 May 2005 16:30:09 GMT
From:      arnaud de prelle <arnaud@pnzone.net>
To:        freebsd-i386@FreeBSD.org
Subject:   Re: i386/81438: Ataidle seems broken + problem with ATA wakeup
Message-ID:  <200505241630.j4OGU9mw082107@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/81438; it has been noted by GNATS.

From: arnaud de prelle <arnaud@pnzone.net>
To: bug-followup@FreeBSD.org, support@pnzone.net
Cc:  
Subject: Re: i386/81438: Ataidle seems broken + problem with ATA wakeup
Date: Tue, 24 May 2005 18:28:52 +0200

 I made little c program for manually setting idle a disk but now there 
 appears errors in the /usr/include/sys/ata.h !
 
 root@pnserver# cat sleep.c
 #include <sys/ioctl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/ata.h>
 
 int main (int argc, char *argv[]) {
         int fd;
         char *dev = argv[argc-1];
 
         if (argc != 2) {
                 printf("Error with number of args, usage:\n");
                 printf("$ sleep /dev/device_node\n");
                 exit(EXIT_FAILURE);
         }
 
         if ( (fd = open(dev, O_RDONLY)) == -1) {
                 printf("Error while trying to open %s\n", dev);
                 exit(EXIT_FAILURE);
         }
         if ( ioctl (fd, ATA_IDLE_IMMEDIATE, sizeof(ATA_IDLE_IMMEDIATE)) 
 == -1 ) {
                 printf("Error while trying to idle the disk\n");
                 printf("-> ATA_IDLE_IMMEDIATE Code: %d\n", 
 ATA_IDLE_IMMEDIATE);
                 printf("-> Error Code: %s\n", strerror (errno));
                 exit(EXIT_FAILURE);
         }
         else
                 printf("Disk is now idle\n");
         exit(EXIT_SUCCESS);
 }
 root@pnserver# cc sleep.c
 In file included from sleep.c:6:
 /usr/include/sys/ata.h:38: error: syntax error before "u_int16_t"
 /usr/include/sys/ata.h:130: error: syntax error before "u_int16_t"
 /usr/include/sys/ata.h:164: error: syntax error before "u_int16_t"
 /usr/include/sys/ata.h:349: error: syntax error before "u_int8_t"
 /usr/include/sys/ata.h:358: error: syntax error before "caddr_t"
 
 And when I manually set up ATA_IDLE_IMMEDIATE as seen in sys/ata.h:
 #define ATA_IDLE_IMMEDIATE              0xe1
 
 Here is the result:
 root@pnserver# cc sleep.c -o sleep
 root@pnserver# ./sleep /dev/ad1
 Error while trying to idle the disk
 -> ATA_IDLE_IMMEDIATE Code: 225
 -> Error Code: Inappropriate ioctl for device
 root@pnserver# df -h
 Filesystem     Size    Used   Avail Capacity  Mounted on
 /dev/ad0s1a    9.7G    4.5G    4.4G    50%    /
 devfs          1.0K    1.0K      0B   100%    /dev
 /dev/ad0s1f     45G     13G     29G    31%    /home
 /dev/ad0s1e     15G    2.5G     11G    19%    /net
 /dev/ad0s1d    3.9G    212M    3.4G     6%    /var
 /dev/ad1s1a    5.9G    4.3G    1.1G    80%    /dd3
 /dev/ad1s1f    2.9G    1.8G    871M    68%    /dd3/home
 /dev/ad1s1e    989M    346M    564M    38%    /dd3/var
 /dev/ad1s1d    2.9G    2.1G    554M    80%    /dd3/net
 /dev/ad2s1d    184G    101G     68G    60%    /dd2
 procfs         4.0K    4.0K      0B   100%    /proc
 devfs          1.0K    1.0K      0B   100%    /var/named/de
 
 So it tells me that 0xe1 is an Inappropriate ioctl for device. I dont 
 understand anything of this !
 ps: When trying with ATA_STANDBY_IMMEDIATE it's the same problem.
 ps2: I cant open the device in O_WRONLY maybe it's there the problem, I 
 don't know well.
 
 Does ata.h and all stuffes related to ata still in development on the 
 6.0-Current ?
 Will ata idle be repaired on 5.4-Release in future (see first post) or 
 must I shift to another distribution (I hope not!!) ?
 
 -- 
 Arnaud de Prelle
 arnaud@pnzone.net
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505241630.j4OGU9mw082107>