Re: Changes to ide-probe.c in 2.6.9-rc2 causing improper detection

From: Jens Axboe
Date: Tue Sep 14 2004 - 02:18:41 EST


On Tue, Sep 14 2004, Jens Axboe wrote:
> They do support it, they just don't flag the support in the capability
> flags. And of course some don't support it at all, you can try this on
> your drives if you want to know for sure.

Forgot to attach the code, here it is...

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/hdreg.h>

int main(int argc, char *argv[])
{
char args[7];
int fd;

if (argc < 2) {
printf("%s: <dev>\n", argv[0]);
return 1;
}

fd = open(argv[1], O_RDONLY | O_NONBLOCK);
if (fd == -1) {
perror("open");
return 2;
}

memset(args, 0, 7);
args[0] = 0xE7;

printf("issuing FLUSH_CACHE: ");
if (ioctl(fd, HDIO_DRIVE_TASK, args) == -1)
printf("failed 0x%x/0x%x!\n", args[0], args[1]);
else
printf("worked\n");

memset(args, 0, 7);
args[0] = 0xEA;

printf("issuing FLUSH_CACHE_EXT: ");
if (ioctl(fd, HDIO_DRIVE_TASK, args) == -1)
printf("failed 0x%x/0x%x!\n", args[0], args[1]);
else
printf("worked\n");

close(fd);
return 0;
}

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/