1
2
3
4
5
6
7
8
9
10
11
12
13 salv_caller: procedure;
14 return;
15
16
17
18
19
20 dcl cu_$arg_count entry returns (fixed bin);
21 dcl cu_$arg_ptr entry (fixed bin, ptr, fixed bin, fixed bin (35));
22 dcl code fixed bin (35);
23 dcl arg char (argl) based (argp);
24 dcl argp ptr, argl fixed bin;
25 dcl SALV_RING fixed bin static init (1);
26 dcl cv_dec_check_ entry (char (*), fixed bin (35), fixed bin);
27 dcl i fixed bin;
28 dcl n fixed bin;
29
30
31 dcl disk_table_$general_mhv entry (fixed bin (35));
32 dcl disk_table_$accept_rlv entry (fixed bin (35));
33 dcl disk_table_$rbld_disk entry (char (*), char (*), char (*), bit (36) aligned, fixed bin (35));
34 dcl disk_table_$volsalv entry (char (*), char (*), bit (36) aligned, fixed bin (35));
35 dcl disk_table_$volsalvall entry (bit (36) aligned, fixed bin (35));
36 dcl disk_table_$volrlvcheck entry (char (*), char (*), char (*), bit (36) aligned, fixed bin (35));
37 dcl initializer_gate_$salvager entry (bit (36) aligned, fixed bin, fixed bin (35));
38
39 dcl cu_$level_get entry returns (fixed bin);
40 dcl (ioa_, com_err_) entry options (variable);
41 dcl isvol bit (1);
42 dcl (copysw, allsw, drivesw, packsw, rbldsw) bit (1) init ("0"b);
43 dcl (drive, copyarg, pvname) char (32);
44
45 dcl (error_table_$action_not_performed, error_table_$badopt, error_table_$noarg) fixed bin (35) ext;
46 dcl active_all_rings_data$max_tree_depth fixed bin ext;
47
48
49 ^L
50
51 %include salv_options;
52
53 dirsalv: entry;
54 isvol = "0"b;
55 go to join;
56 packsalv: entry;
57 isvol = "1"b;
58 go to join;
59 rbld_disk: entry;
60 isvol = "1"b;
61 rbldsw = "1"b;
62 join: salv_opt_bits = "0"b;
63 if ^isvol then do;
64 if cu_$level_get () > SALV_RING then do;
65 call com_err_ (0, "salvage_dirs", "must be in ring ^d for dir salv", SALV_RING);
66 return;
67 end;
68 n = active_all_rings_data$max_tree_depth;
69 end;
70
71 do i = 1 to cu_$arg_count ();;
72 call cu_$arg_ptr (i, argp, argl, code);
73 if arg = "-console" then salv_opts.console = "1"b;
74 else if arg = "-debug" | arg = "-db" then salv_opts.debug = "1"b;
75 else if arg = "-dump" then salv_opts.dump = "1"b;
76 else if arg = "-nodump" then salv_opts.ndump = "1"b;
77 else if arg = "-nodebug" then salv_opts.ndebug = "1"b;
78 else if arg = "-noconsole" then salv_opts.nconsole = "1"b;
79 else if isvol then do;
80 if arg = "-all" then do;
81 if ^rbldsw then allsw = "1"b;
82 else do;
83 call com_err_ (error_table_$badopt, "rebuild disk", arg);
84 return;
85 end;
86 end;
87 else if arg = "-copy" then do;
88 i = i + 1;
89 call cu_$arg_ptr (i, argp, argl, code);
90 if code ^= 0 then do;
91 nocopyarg:
92 call com_err_ (code, "salvage_vol", "need copy drive name");
93 return;
94 end;
95 if substr (arg, 1, 1) = "-" then do;
96 code = error_table_$noarg;
97 go to nocopyarg;
98 end;
99 copyarg = arg;
100 copysw = "1"b;
101 end;
102 else if i = 1 & substr (arg, 1, 1) ^= "-" then do;
103 pvname = arg;
104 packsw = "1"b;
105 end;
106 else if i = 2 & packsw & substr (arg, 1, 1) ^= "-" then do;
107 drive = arg;
108 drivesw = "1"b;
109 end;
110 else do;
111 call com_err_ (error_table_$badopt, "salvage_vol", arg);
112 return;
113 end;
114 end;
115 else do;
116 if arg = "-rebuild" then salv_opts.rbld = "1"b;
117 else if arg = "-pathname" then salv_opts.pnames = "1"b;
118 else if arg = "-long" then salv_opts.rbld, salv_opts.check, salv_opts.pnames = "1"b;
119 else if arg = "-check_vtoce" then salv_opts.check = "1"b;
120 else if arg = "-delete_connection_failure" | arg = "-dcf" then salv_opts.dcf = "1"b;
121 else if arg = "-norebuild" then salv_opts.nrbld = "1"b;
122 else if arg = "-nopathname" then salv_opts.npnames = "1"b;
123 else if arg = "-nocheck_vtoce" then salv_opts.ncheck = "1"b;
124 else if arg = "-nodelete_connection_failure" | arg = "-nodcf" then salv_opts.ndcf = "1"b;
125 else if arg = "-level" then do;
126 i = i + 1;
127 call cu_$arg_ptr (i, argp, argl, code);
128 if code ^= 0 then do;
129 levnoarg: call com_err_ (code, "salvage_dirs", "level number required");
130 return;
131 end;
132 if substr (arg, 1, 1) = "-" then do;
133 code = error_table_$noarg;
134 go to levnoarg;
135 end;
136 call cv_dec_check_ (arg, code, n);
137 if code ^= 0 then do;
138 call com_err_ (0, "salvage_dirs", "decimal number required for level, not ^a", arg);
139 return;
140 end;
141 if n < 0 | n > active_all_rings_data$max_tree_depth then do;
142 call com_err_ (0, "salvage_dirs", "depth must be between ^d and ^d", 0,
143 active_all_rings_data$max_tree_depth);
144 return;
145 end;
146 end;
147 else do;
148 call com_err_ (error_table_$badopt, "salvage_dirs", arg);
149 return;
150 end;
151 end;
152 end;
153
154
155 if substr (salv_opt_bits, 1, 18) & substr (salv_opt_bits, 19, 18) then do;
156 if isvol then call com_err_ (0, "salvage_vol", "Inconsistent arguments have been specified");
157 else call com_err_ (0, "salvage_dirs", "Inconsistent arguments have been specified");
158 return;
159 end;
160
161 if salv_opts.ncheck & salv_opts.dcf then do;
162
163 call com_err_ (0, "salvage_dirs", "VTOC checking is required for connection failure deletion.");
164 return;
165 end;
166 salv_opts.check = salv_opts.check | salv_opts.dcf;
167
168
169 if ^isvol then do;
170 call disk_table_$accept_rlv (code);
171 if code ^= 0 then do;
172 call com_err_ (0, "salvage_dirs", "will not salvage until root complete");
173 return;
174 end;
175 if salv_opts.check then do;
176 call disk_table_$general_mhv (code);
177 if code ^= 0 then do;
178 call com_err_ (0, "salvage_dirs", "Will not salvage");
179 return;
180 end;
181 end;
182 end;
183
184 if copysw & allsw then do;
185 call com_err_ (0, "salvage_vol", "-all and -copy arguments cannot be used together");
186 return;
187 end;
188
189 if allsw & drivesw then do;
190 call com_err_ (0, "salvage_vol", "no drive may be specified for -all");
191 return;
192 end;
193
194 if isvol & ^allsw & ^(packsw & drivesw) then do;
195 call com_err_ (error_table_$noarg, "salvage_vol", "first two args must be phys vol name and drive name");
196 return;
197 end;
198
199
200 if rbldsw & ^(drivesw & copysw) then do;
201 call com_err_ (error_table_$noarg, "rebuild_disk",
202 "args are: pack name dirve name -copy drive name");
203 return;
204 end;
205
206 if rbldsw then call disk_table_$rbld_disk (pvname, drive, copyarg, salv_opt_bits, code);
207 else if copysw then call disk_table_$volrlvcheck (pvname, drive, copyarg, salv_opt_bits, code);
208 else if allsw then call disk_table_$volsalvall (salv_opt_bits, code);
209 else if isvol then call disk_table_$volsalv (pvname, drive, salv_opt_bits, code);
210 else call initializer_gate_$salvager (salv_opt_bits, n, code);
211
212 if code ^= 0 then do;
213 if code < 100 then code = error_table_$action_not_performed;
214 if isvol then call com_err_ (code, "salvage_vol");
215 else call com_err_ (code, "salvage_dirs");
216 end;
217 return;
218
219 test: entry;
220 SALV_RING = cu_$level_get ();
221 return;
222
223 ^L
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456 end;