|
|
1.1 root 1: #include <libc.h>
2: #include "worm.h"
3: #include <sys/types.h>
4: #include <sys/udaioc.h>
5:
6: main(argc, argv)
7: char **argv;
8: {
9: Superblock s;
10: char *e, *vol_id = 0;
11: char buf[1024];
12: char *dev = "/dev/worm0";
13: int c;
14: extern char *optarg;
15: extern int optind;
16:
17: while((c = getopt(argc, argv, "f:")) != -1)
18: switch(c)
19: {
20: case 'f': dev = optarg; break;
21: case '?': usage();
22: }
23: if(optind != argc)
24: usage();
25: dev = mapdev(dev);
26: if((s.fd = open(dev, 2)) < 0){
27: if(!vol_id)
28: perror(dev);
29: exit(2);
30: }
31: /*
32: normally, you have to read to bring the drive online.
33: however, when you are likely to call reset, the drive
34: is online and blocked so skip the read
35: */
36: /*lseek(s.fd, 1024L, 0);
37: read(s.fd, buf, sizeof buf);/**/
38: if(ioctl(s.fd, UIORST) < 0)
39: perror("reset ioctl");
40: exit(0);
41: }
42:
43: usage()
44: {
45: print("Usage: worm reset [-fdevice]\n");
46: exit(2);
47: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.