1 /****^  ***********************************************************
  2         *                                                         *
  3         * Copyright, (C) Honeywell Bull Inc., 1987                *
  4         *                                                         *
  5         * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  6         *                                                         *
  7         * Copyright (c) 1972 by Massachusetts Institute of        *
  8         * Technology and Honeywell Information Systems, Inc.      *
  9         *                                                         *
 10         *********************************************************** */
 11 
 12 
 13 salv_caller: procedure;
 14           return;
 15 
 16 /* salv_caller      -- Module to implement administrative salvager commands */
 17 /* Bernard Greenberg, April 6 1976 */
 18 /* Modified 7/77 by S.E. Barr to delete branch checking. */
 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;                                     /* directory salvage */
 55           go to join;
 56 packsalv: entry;
 57           isvol = "1"b;                                     /* pack salvage */
 58           go to join;
 59 rbld_disk: entry;
 60           isvol = "1"b;
 61           rbldsw = "1"b;
 62 join:     salv_opt_bits = "0"b;                             /* clear all flags */
 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; /* pack name */
103                          pvname = arg;
104                          packsw = "1"b;
105                     end;
106                     else if i = 2 & packsw & substr (arg, 1, 1) ^= "-" then do; /* drive name */
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;                                     /* dir salv */
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 /* BEGIN MESSAGE DOCUMENTATION
225 
226 Message:
227 rebuild_disk: Expected argument missing.
228 
229 S:        $initializer_io
230 
231 T:        $response
232 
233 M:        Incorrect arguments were specified.
234 
235 A:        $tryagn
236 
237 
238 Message:
239 rebuild_disk: Specified control argument is not implemented by this command. BLAH
240 
241 S:        $initializer_io
242 
243 T:        $response
244 
245 M:        Incorrect arguments were specified.
246 
247 A:        $tryagn
248 
249 
250 Message:
251 salvage_dirs: ERROR_MESSAGE
252 
253 S:        $initializer_io
254 
255 T:        $response
256 
257 M:        Incorrect arguments were specified.
258 
259 A:        $tryagn
260 
261 
262 Message:
263 salvage_dirs: ERROR_MESSAGE. level number required
264 
265 S:        $initializer_io
266 
267 T:        $response
268 
269 M:        Incorrect arguments were specified.
270 
271 A:        $tryagn
272 
273 
274 Message:
275 salvage_dirs: Inconsistent arguments have been specified
276 
277 S:        $initializer_io
278 
279 T:        $response
280 
281 M:        Incorrect arguments were specified.
282 
283 A:        $tryagn
284 
285 
286 Message:
287 salvage_dirs: Specified control argument is not implemented by this command. BLAH
288 
289 S:        $initializer_io
290 
291 T:        $response
292 
293 M:        Incorrect arguments were specified.
294 
295 A:        $tryagn
296 
297 
298 Message:
299 salvage_dirs: Will not salvage
300 
301 S:        $initializer_io
302 
303 T:        $response
304 
305 M:        Incorrect arguments were specified.
306 
307 A:        $tryagn
308 
309 
310 Message:
311 salvage_dirs: decimal number required for level, not BLAH
312 
313 S:        $initializer_io
314 
315 T:        $response
316 
317 M:        Incorrect arguments were specified.
318 
319 A:        $tryagn
320 
321 
322 Message:
323 salvage_dirs: depth must be between 0 and 15
324 
325 S:        $initializer_io
326 
327 T:        $response
328 
329 M:        Incorrect arguments were specified.
330 
331 A:        $tryagn
332 
333 
334 Message:
335 salvage_dirs: must be in ring 1 for dir salv
336 
337 S:        $initializer_io
338 
339 T:        $response
340 
341 M:        Incorrect arguments were specified.
342 
343 A:        $tryagn
344 
345 
346 Message:
347 salvage_dirs: will not salvage until root complete
348 
349 S:        $initializer_io
350 
351 T:        $response
352 
353 M:        Incorrect arguments were specified.
354 
355 A:        $tryagn
356 
357 
358 Message:
359 salvage_vol: -all and -copy arguments cannot be used together
360 
361 S:        $initializer_io
362 
363 T:        $response
364 
365 M:        Incorrect arguments were specified.
366 
367 A:        $tryagn
368 
369 
370 Message:
371 salvage_vol: ERROR_MESSAGE
372 
373 S:        $initializer_io
374 
375 T:        $response
376 
377 M:        Incorrect arguments were specified.
378 
379 A:        $tryagn
380 
381 
382 Message:
383 salvage_vol: ERROR_MESSAGE. need copy drive name
384 
385 S:        $initializer_io
386 
387 T:        $response
388 
389 M:        Incorrect arguments were specified.
390 
391 A:        $tryagn
392 
393 
394 Message:
395 salvage_vol: Expected argument missing. first two args must be phys vol name and drive name
396 
397 S:        $initializer_io
398 
399 T:        $response
400 
401 M:        Incorrect arguments were specified.
402 
403 A:        $tryagn
404 
405 
406 Message:
407 salvage_vol: Inconsistent arguments have been specified
408 
409 S:        $initializer_io
410 
411 T:        $response
412 
413 M:        Incorrect arguments were specified.
414 
415 A:        $tryagn
416 
417 
418 Message:
419 salvage_vol: Specified control argument is not implemented by this command. BLAH
420 
421 S:        $initializer_io
422 
423 T:        $response
424 
425 M:        Incorrect arguments were specified.
426 
427 A:        $tryagn
428 
429 
430 Message:
431 salvage_vol: no drive may be specified for -all
432 
433 S:        $initializer_io
434 
435 T:        $response
436 
437 M:        Incorrect arguments were specified.
438 
439 A:        $tryagn
440 
441 
442 
443 Message:
444 salvage_dirs: VTOC checking is required for connection failure deletion.
445 
446 S:        $initializer_io
447 
448 T:        $response
449 
450 M:        An attempt was made to specify directory salvage with connection failure
451           deletion, but no VTOC checking.
452 
453 A:        $tryagn
454 
455 END MESSAGE DOCUMENTATION */
456      end;