|
|
1.1 root 1: %start input
2:
3: %{
4:
5: #include "scsi.h"
6:
7: %}
8:
9: %token DISK ID RELEASE HELP SET EJECT INQUIRY READ CAPACITY SENSE
10: %token NUMBER EXT SIDEA SIDEB ALL RESET SLEEP START STOP STATUS
11: %token ECHO ERROR MEDIA WORM WRITE DIAGNOSTIC STRING COPY CONFIG
12: %token TEST INTERNAL ALTERNATE
13:
14: %type <str> STRING
15: %type <num> NUMBER drive side shelf optdrive
16:
17: %union {
18: char *str;
19: int num; /* 32 bits */
20: }
21:
22: %%
23:
24: input : /* nothing */
25: | input line error '\n'
26: | input line '\n'
27: | input line ';'
28: | input line error ';'
29: ;
30:
31: /*
32: help can be done explicitly by :help info::
33: */
34: line : /* nothing */
35: | ALTERNATE optdrive { s_alternate($2); }
36: | CAPACITY optdrive { s_capacity($2, (long *)0, (long *)0); }
37: | CONFIG { s_config(); }
38: | COPY drive NUMBER NUMBER drive NUMBER {/*:COPY sdrive sstart nblocks ddrive dstart:: */
39: s_copy($2, $3, $4, $5, $6);
40: }
41: | DISK EJECT drive { s_diskeject($3); }
42: | DISK ID drive { s_diskid($3); }
43: | DISK RELEASE drive shelf side { s_diskrelease($4, $5, $3, 1); }
44: | DISK RELEASE drive { s_diskrelease(-1, A, $3, 1); }
45: | DISK SET shelf side drive { s_diskset($3, $4, $5, 1); }
46: | ECHO NUMBER { print(">> %d <<\n", $2); }
47: | HELP { help(); }
48: | ID drive { scsiid($2); }
49: | INQUIRY {
50: int i;
51: for(i = 0; i<8; i++)
52: s_inquiry(scsi_id, i);
53: }
54: | INQUIRY drive { s_inquiry(scsi_id, $2); }
55: | INTERNAL { s_internal(-1, 0); }
56: | INTERNAL NUMBER optdrive { s_internal($2, $3); }
57: | MEDIA drive NUMBER NUMBER { s_media($2, $3, $4, 0); }
58: | MEDIA drive NUMBER NUMBER STRING { s_mediaf($2, $3, $4, $5); } /*:MEDIA drive start nblocks \"filename\"::*/
59: | EXT MEDIA drive NUMBER NUMBER { s_media($3, $4, $5, 1); }
60: | READ drive NUMBER {
61: struct scsi_o output;
62: s_read($2, $3, 1, &output);
63: scsiodump(output.data, 1024);
64: }
65: | READ ID drive {
66: char name[256];
67: ;
68: s_readid($3, name);
69: print("id='%s'\n", name);
70: }
71: | RESET { s_reset(); }
72: | SENSE drive { s_sense($2, 0); }
73: | EXT SENSE drive { s_sense($3, 1); }
74: | SLEEP NUMBER { sleep($2); }
75: | START drive { s_start($2); }
76: | STATUS drive { s_status($2, (struct scsi_o *)0); }
77: | STATUS { s_status(0, (struct scsi_o *)0); }
78: | STOP drive { s_stop($2); }
79: | TEST drive { s_testunit(scsi_id, $2); }
80: | WORM drive { s_worm($2, 1); }
81: | WORM drive NUMBER { s_worm($2, $3); } /*:WORM drive start:: */
82: | WRITE drive NUMBER { s_write($2, $3, 1); }
83: | WRITE drive NUMBER NUMBER { s_write($2, $3, $4); } /*:WRITE drive start n:: */
84: ;
85:
86: drive : NUMBER
87: ;
88:
89: optdrive: NUMBER
90: | { $$ = 0; }
91: ;
92:
93: shelf : NUMBER
94: ;
95:
96: side : SIDEA { $$ = 0; }
97: | SIDEB { $$ = 1; }
98: ;
99:
100: %%
101:
102: yywrap()
103: {
104: return(1);
105: }
106:
107: yyerror(s1, s2)
108: char *s1, *s2;
109: {
110: fprint(2, s1, s2);
111: fprint(2, "\n");
112: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.