Package: hdparm Version: 6.9-2 When using `hdparm -t' on a non-ATA/SATA, non-SCSI block device, it prints the following error message:
| HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device According to the hdparm sources, hdparm expects the HDIO_DRIVE_CMD(null) ioctl to either succeed, or to fail with errno EINVAL. Apparently handling of ioctls is different for the different device types: - ATA/SATA handle HDIO_DRIVE_CMD(null) (and a few other variants) => fine for hdparm - SCSI doesn't handle HDIO_DRIVE_CMD(null), and returns EINVAL => fine for hdparm - If a block device doesn't support the ioctl, the block layer return ENOTTY => hdparm error message According to the discussion started with http://lkml.org/lkml/2007/5/10/250, both EINVAL and ENOTTY are correct. Hence hdparm should accept ENOTTY, too. The same bug is present in version 7.1-2. Below are patches for both versions. Thanks! --- hdparm-6.9/hdparm.c.orig 2007-05-10 15:14:33.000000000 +0200 +++ hdparm-6.9/hdparm.c 2007-05-10 15:14:29.000000000 +0200 @@ -327,7 +327,9 @@ if (ioctl(fd, BLKFLSBUF, NULL)) /* do it again, big time */ perror("BLKFLSBUF failed"); #ifdef HDIO_DRIVE_CMD - if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL) /* await completion */ + /* await completion */ + if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL && + errno != ENOTTY) perror("HDIO_DRIVE_CMD(null) (wait for flush complete) failed"); #endif } --- hdparm-7.1/hdparm.c.orig 2007-05-10 15:11:12.000000000 +0200 +++ hdparm-7.1/hdparm.c 2007-05-10 15:10:36.000000000 +0200 @@ -271,7 +271,8 @@ fsync (fd); /* flush buffers */ if (ioctl(fd, BLKFLSBUF, NULL)) /* do it again, big time */ perror("BLKFLSBUF failed"); - if (do_drive_cmd(fd, NULL) && errno != EINVAL) /* await completion */ + /* await completion */ + if (do_drive_cmd(fd, NULL) && errno != EINVAL && errno != ENOTTY) perror("HDIO_DRIVE_CMD(null) (wait for flush complete) failed"); } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE) [EMAIL PROTECTED] ------- The Corporate Village, Da Vincilaan 7-D1 Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]