1 /****^  ***********************************************************
   2         *                                                         *
   3         * Copyright, (C) BULL HN Information Systems Inc., 1989   *
   4         *                                                         *
   5         * Copyright, (C) Honeywell Bull Inc., 1987                *
   6         *                                                         *
   7         * Copyright, (C) Honeywell Information Systems Inc., 1982 *
   8         *                                                         *
   9         * Copyright (c) 1972 by Massachusetts Institute of        *
  10         * Technology and Honeywell Information Systems, Inc.      *
  11         *                                                         *
  12         *********************************************************** */
  13 
  14 
  15 /*
  16 
  17 
  18 
  19    salvage_pv (pvtx, code);
  20 
  21 
  22    INPUT ASSUMPTIONS.
  23 
  24    1. There is a segment header for each of the following segments:
  25 
  26    salv_abs_seg_00 to n, where n is the no. of 256k segs required to
  27    to linearly address the entire vtoc.
  28    pv_salv_seg
  29 
  30    2. This procedure can be executed by any process. However a given physical
  31    volume can be salvaged by only one process at a time.
  32 
  33    3. The physical volume being salvaged is not available for normal vtoc_man
  34    operations.
  35 
  36    4. The following items are supposed to have been checked prior to calling
  37    this procedure and are assumed to have a correct value:
  38 
  39    label.vol_size
  40    label.vtoc_size
  41 
  42    vol_map.n_rec
  43    vol_map.base_add
  44    vol_map.bit_map_n_words
  45 
  46    vtoc_header.n_vtoce
  47 
  48    pvte.being_salvaged = 0
  49    pvte.vtoc_segno     = 0
  50    pvte.vtoc_size      = 0
  51 
  52    Written by Andre Bensoussan 1976
  53    Extensively modified by Andrew Kobziar, who integrated it with rest of salvager, 1976.
  54    5/13/76 by Greenberg for seg-by-seg PD flusher.
  55    6/25/76 by Greenberg for last n bits of bit map being zero.
  56    11/1/76 by Greenberg for fixing disk_rebuild-created problems,
  57    pc$truncate_deposit_all, summary report.
  58    03/22/81, W. Olin Sibert, for ADP PTW formats
  59    03/07/82, J. Bongiovanni, for new PVTE, validate vtoce.trp, vtoce.trp_time,
  60              convert_vtoc, VTOC map
  61    06/15/82, J. Bongiovanni, to free per-bootload VTOCEs and print summary of
  62              damaged segments
  63    10/26/82, J. Bongiovanni, for fm_damaged
  64 
  65 */
  66 
  67 
  68 /****^  HISTORY COMMENTS:
  69   1) change(86-01-16,Fawcett), approve(86-04-11,MCR7383),
  70      audit(86-06-17,Beattie), install(86-07-17,MR12.0-1097):
  71      Add support for 512_WORD_IO devices, 3380 and 3390.
  72   2) change(89-08-14,Farley), approve(89-09-18,MCR8134),
  73      audit(89-09-21,WAAnderson), install(89-09-29,MR12.3-1075):
  74      Corrected the VTOCE.records adjustment in the RESOLVE_CONFLICT procedure.
  75      It was using (vtoce.records - 1), which was causing an incorrect records
  76      setting, resulting in et$invalid_vtoce errors.
  77                                                    END HISTORY COMMENTS */
  78 
  79 
  80 
  81 ^L
  82 salvage_pv : procedure (a_pvtx, a_code);
  83 
  84 
  85 dcl (a_pvtx, pvtx) fixed bin;                               /* Physical volume table index of vol to be salvaged */
  86 dcl (a_code, code) fixed bin (35);                          /* Error code */
  87 
  88 dcl  no_free_aste_err fixed bin (35) internal static init (1);
  89 dcl  get_vtocep_err fixed bin (35) internal static init (3);
  90 
  91 dcl  table1p ptr;                                           /* Pointer to table1, i.e. bit_table */
  92 dcl  table2p ptr;                                           /* Pointer to table2, i.e. vtocx_table */
  93 dcl  table3p ptr;                                           /* Pointer to table3, i.e. new_bit_map */
  94 dcl  table4p ptr;                                           /* Pointer to incremental dump table */
  95 dcl  table5p ptr;                                           /* Pointer to consolidated dump table */
  96 dcl  table6p ptr;                                           /* Pointer to VTOC map */
  97 
  98 dcl  s_ptr ptr;
  99 
 100 dcl  r0 fixed bin;                                          /* First record number used for paging on this volume */
 101 dcl  r1 fixed bin;                                          /* Last record number used for paging on this volume */
 102 dcl  ptp pointer;                                           /* Pointer to page table in aste */
 103 dcl  vtocx fixed bin;                                       /* Index of the vtoc entry being processed */
 104 dcl  pvid bit (36) aligned;                                 /* ID of volume being processed */
 105 dcl  n_used_rec fixed bin;                                  /* Number of records used */
 106 dcl  n_free_vtoce fixed bin;                                /* Number of free vtoc entries */
 107 dcl  max_n_vtoc_seg fixed bin internal static init (4);
 108 dcl  damaged_count fixed bin;                               /* Count damaged segments */
 109 dcl  damaged_by_me fixed bin;                               /* Count of segments damaged by this salvage */
 110 dcl  salvage_call bit (1);                                  /* TRUE is called for salvage */
 111 dcl  previous_damaged_sw bit (1);                           /* TRUE if vtoce.damaged on at top of loop */
 112 dcl  complained bit (1);                                    /* TRUE if set damaged and wrote message */
 113 dcl  not_enabled_sw bit (1) aligned;                        /* dumper threading operational? */
 114 dcl  free_count fixed bin;                                  /* count of free vtoces added to consolidated list */
 115 dcl  comp_time fixed bin (71);                              /* fb time */
 116 dcl  hdr_time (2) bit (36) aligned;                         /* bit time in label */
 117 dcl  root_pack bit (1) aligned;                             /* set to indicate directories ok on this pack */
 118 dcl  salv_mode char (32) var;                               /* mode of volsalv */
 119 dcl  p99 pic "99";
 120 dcl  curtime bit (36);                                      /* Current file system time */
 121 dcl  trp_bad bit (1) aligned;                               /* Flag for trp validation */
 122 
 123 
 124 dcl 1 table1 based (table1p) aligned,
 125     2 bit_table (0 : label.vol_size - 1) bit (1) unaligned;
 126 
 127 dcl 1 table2 based (table2p) aligned,
 128     2 vtocx_table (0 : label.vol_size - 1) fixed bin (17) unaligned;
 129 
 130 dcl 1 table3 based (table3p) aligned,
 131     2 new_map (1 : vol_map.map_n_words) bit (36) aligned;
 132 
 133 dcl 1 table4 based (table4p) aligned,
 134     2 incr_map (0 : vtoc_header.n_vtoce -1) bit (1) unaligned;
 135 
 136 dcl 1 table5 based (table5p) aligned,
 137     2 cons_map (0 : vtoc_header.n_vtoce -1) bit (1) unaligned;
 138 
 139 dcl  1 salv_vtoc_map aligned based (table6p) like vtoc_map;
 140 
 141 dcl  sst$astl bit (36) aligned external;
 142 dcl  sst$astsize fixed bin external;
 143 dcl  sst$damaged_ct fixed bin external;
 144 dcl  1 sst$level (0 : 3) aligned external,
 145      2 ausedp bit (18) unaligned,
 146      2 no_aste bit (18) unaligned;
 147 dcl  sst$pts (0 : 3) fixed bin external;
 148 dcl  sst$root_pvtx fixed bin external;
 149 
 150 dcl  pds$processid ext bit (36) aligned;
 151 
 152 dcl  dseg$ (0 : 1023) fixed bin (71) external static;
 153 dcl  pv_salv_seg$ ext;
 154 
 155 dcl  dir_dump$vtoce ext entry (ptr);
 156 dcl  get_aste entry (fixed bin) returns (ptr);
 157 dcl  get_ptrs_$given_astep entry (ptr) returns (fixed bin (71) aligned);
 158 dcl  get_ptrs_$given_segno entry (fixed bin) returns (ptr);
 159 dcl  get_pvtx$hold_pvtx entry (bit (36) aligned, fixed bin, fixed bin (35));
 160 dcl  get_pvtx$release_pvtx entry (bit (36) aligned, fixed bin (35));
 161 dcl  lock$lock_ast entry;
 162 dcl  lock$unlock_ast entry;
 163 dcl  page$cam entry;
 164 dcl  pc$truncate_deposit_all entry (ptr);
 165 dcl  pc_wired$write_wait entry (ptr, fixed bin, fixed bin);
 166 dcl  ptw_util_$make_null entry (pointer, bit (22) aligned);
 167 dcl  put_aste entry (ptr);
 168 dcl  salv_err_msg entry options (variable);
 169 dcl  salv_err_msg$code entry options (variable);
 170 dcl  syserr entry options (variable);
 171 dcl  syserr$binary ext entry options (variable);
 172 dcl  thread$out entry (ptr, bit (18));
 173 dcl  vm_vio$clean_up entry (fixed bin);
 174 dcl  vm_vio$get_vtocep entry (fixed bin, fixed bin) returns (ptr);
 175 dcl  vm_vio$init entry (fixed bin, fixed bin (35)) returns (ptr);
 176 
 177 dcl  cleanup condition;
 178 dcl  (addr, addrel, baseno, bin, bit, ceil, clock, convert, divide, fixed, max, mod, null, ptr, rel, substr, unspec) builtin;
 179 
 180 ^L
 181 /* MAIN PROGRAM */
 182 
 183           salvage_call = "1"b;
 184           salv_mode = "Volume salvage";
 185           goto COMMON;
 186 
 187 convert_vtoc:
 188           entry (a_pvtx, a_code);
 189 
 190           salvage_call = "0"b;
 191           salv_mode = "VTOC conversion";
 192 
 193 COMMON:
 194           pvtx = a_pvtx;
 195           code = 0;
 196           pvt_arrayp = addr (pvt$array);
 197           pvtep = addr (pvt_array (pvtx));
 198           curtime = substr (bit (bin (clock (), 71), 71), 20, 36);
 199 
 200           on cleanup call CLEAN_UP;
 201 
 202           s_ptr = vm_vio$init (pvtx, code); if code ^= 0 then goto RTN;
 203 
 204           labelp = ptr (s_ptr, LABEL_ADDR * 1024);
 205           vol_mapp = ptr (s_ptr, VOLMAP_ADDR * 1024);
 206           vtoc_headerp = ptr (s_ptr, DUMPER_BIT_MAP_ADDR * 1024);
 207           vtoc_mapp = ptr (s_ptr, VTOC_MAP_ADDR * 1024);
 208 
 209           pvid = label.pvid;
 210 
 211 
 212           call salv_err_msg (SALV_ANNOUNCE, "salvage_pv: ^a of ^a_^a, volume ^a of logical vol ^a.",
 213                salv_mode, pvte.devname, (convert (p99, pvte.logical_area_number) || pvte.sv_name),
 214                label.pv_name, label.lv_name);
 215 
 216           comp_time = clock ();
 217 
 218           if salvage_call then do;
 219                call CHECK_LABEL_VOLMAP_HEADER (code); if code ^= 0 then goto CLEAN;
 220                n_used_rec = 0;
 221                free_count = 0;
 222 
 223                r0 = vol_map.base_add;
 224                r1 = vol_map.n_rec - 1 + r0;
 225           end;
 226 
 227           damaged_count = 0;
 228           damaged_by_me = 0;
 229 
 230           call INIT_TABLES (table1p, table2p, table3p, table4p, table5p, table6p, code); if code ^= 0 then goto CLEAN;
 231 
 232           n_free_vtoce = 0;
 233 
 234           if label.volmap_version = 1
 235                | label.volmap_version = 2                   /* VTOC Map exists */
 236                then do;
 237                salv_vtoc_map.n_vtoce = vtoc_map.n_vtoce;
 238                salv_vtoc_map.n_free_vtoce = vtoc_map.n_free_vtoce;
 239                salv_vtoc_map.bit_map_n_words = vtoc_map.bit_map_n_words;
 240                salv_vtoc_map.vtoc_last_recno = vtoc_map.vtoc_last_recno;
 241           end;
 242           else do;
 243                salv_vtoc_map.n_vtoce = vtoc_header.n_vtoce;
 244                salv_vtoc_map.n_free_vtoce = vtoc_header.n_free_vtoce;
 245                salv_vtoc_map.bit_map_n_words
 246                     = divide (vtoc_header.n_vtoce + 31, 32, 17);
 247                salv_vtoc_map.vtoc_last_recno = vtoc_header.vtoc_last_recno;
 248           end;
 249 
 250 
 251           do vtocx = 0 to vtoc_header.n_vtoce - 1;
 252 
 253                vtocep = vm_vio$get_vtocep (pvtx, vtocx);
 254                if vtocep = null then do;
 255                     code = get_vtocep_err;
 256                     goto CLEAN;
 257                end;
 258 
 259 
 260                if vtoce.uid = "0"b then do;
 261                     vtoce.pad_free_vtoce_chain = ""b;       /* Clean out old field */
 262                     if vtoce_parts (1) ^= "0"b then call salv_err_msg (SALV_DEBUG,
 263                          "salvage_pv: vtoce ^oo free but not zero", vtocx);
 264                     call FREE_VTOCE;
 265                end;
 266                else if salvage_call then do;
 267                     complained = "0"b;                      /* Only report damage if we didn't set it ourself */
 268                     previous_damaged_sw = vtoce.damaged;
 269                     if ^vtoce.dirsw then do;
 270                          if vtoce.per_process then do;
 271                               if salv_data$debug then call salv_err_msg (SALV_DEBUG,
 272                                    "salvage_pv: freeing ^w per process vtocx ^oo: ^a",
 273                                    vtoce.uid, vtocx, vtoce.primary_name);
 274                               call FREE_VTOCE;
 275                               go to NEXT_VTOCE;
 276                          end;
 277                          else if vtoce.deciduous then do;
 278                               if salv_data$debug then call salv_err_msg (SALV_DEBUG,
 279                                    "salvage_pv: freeing ^w deciduous vtocx ^oo: ^a",
 280                                    vtoce.uid, vtocx, vtoce.primary_name);
 281                               call FREE_VTOCE;
 282                               go to NEXT_VTOCE;
 283                          end;
 284                          else if vtoce.perm_flags.per_bootload then do;
 285                               if salv_data$debug then call salv_err_msg (SALV_DEBUG,
 286                                    "salvage_pv: freeing ^w per-bootload vtocx ^oo: ^a",
 287                                    vtoce.uid, vtocx, vtoce.primary_name);
 288                               call FREE_VTOCE;
 289                               goto NEXT_VTOCE;
 290                          end;
 291                     end;
 292                     call CHECK_VTOCE;
 293                     if previous_damaged_sw & ^complained
 294                     then call salv_err_msg (SALV_DEBUG, "salvage_pv: damaged switch found on for ^w vtocx ^oo: ^a",
 295                          vtoce.uid, vtocx, vtoce.primary_name);
 296                     if vtoce.damaged then do;
 297                          damaged_count = damaged_count + 1;
 298                          if ^previous_damaged_sw
 299                               then damaged_by_me = damaged_by_me + 1;
 300                          if complained then do;
 301                               segdamage.pvid = label.pvid;
 302                               segdamage.lvid = label.lvid;
 303                               segdamage.uid = vtoce.uid;
 304                               segdamage.vtocx = vtocx;
 305                               segdamage.pno = -1;
 306                               segdamage.uid_path = vtoce.uid_path;
 307                               call syserr$binary (SALV_LOG, addr (segdamage), SB_vtoc_salv_dam, SBL_vtoc_salv_dam,
 308                                    "salvage_pv: setting damaged switch on ^a (^oo) on pv ^a.",
 309                                    vtoce.primary_name, vtocx, label.pv_name);
 310                               sst$damaged_ct = sst$damaged_ct + 1;
 311                          end;
 312                     end;
 313 
 314                end;
 315 NEXT_VTOCE:
 316           end;
 317 
 318           if salvage_call
 319                then do;
 320                call UPDATE_VOL_MAP;
 321                pvte.vol_trouble_count = 0;
 322           end;
 323 
 324           call UPDATE_VTOC_MAP;
 325 
 326           call FORCE_VTOC_ON_DISK;
 327 
 328           call UPDATE_LABEL;
 329 
 330           call FORCE_LABEL_ON_DISK;
 331 
 332           if free_count > 0 then call salv_err_msg (SALV_DEBUG, "salvage_pv: ^d free vtoces added to free list.", free_count);
 333           if damaged_count > 0
 334                then call salv_err_msg (SALV_ANNOUNCE,
 335                "salvage_pv: ^d damaged segments on volume ^a (^d damaged in this salvage)",
 336                damaged_count, label.pv_name, damaged_by_me);
 337 CLEAN:    if code = 0 then call salv_err_msg (SALV_DEBUG, "salvage_pv: ^a finished.", salv_mode);
 338           else call salv_err_msg$code (SALV_DEBUG, "", "salvage_pv: ^a finished with error.", code, salv_mode);
 339           call CLEAN_UP;
 340 
 341 RTN:      a_code = code;
 342 
 343           return;
 344 ^L
 345 CHECK_VTOCE : proc;
 346 
 347 dcl (records, csl, msl, i, r, conflict) fixed bin;
 348 
 349                csl, records, conflict = 0;
 350                msl = 256;
 351 
 352                do i = 0 to msl - 1;
 353 
 354 SAME_I:             if substr (vtoce.fm (i), 1, 1) = "1"b then goto NEXT_I; /* Null address */
 355 
 356                     r = fixed (substr (vtoce.fm (i), 2, 17), 17);
 357 
 358                     if r < r0 | r > r1 then
 359                          do;
 360                          call report_out_of_range;
 361                          vtoce.fm (i) = pv_salv_null_addr; goto NEXT_I;
 362                     end;
 363 
 364                     if bit_table (r) = "1"b then
 365                          do;
 366                          conflict = 1; call RESOLVE_CONFLICT (i); goto SAME_I;
 367                     end;
 368 
 369                     vtocx_table (r) = vtocx;
 370                     bit_table (r) = "1"b;
 371                     records = records + 1;
 372                     csl = i + 1;
 373 NEXT_I:
 374                end;
 375 
 376                do i = msl to 255;
 377                     if substr (vtoce.fm (i), 1, 1) = "0"b then vtoce.fm (i) = pv_salv_null_addr;
 378                end;
 379 
 380                if conflict ^= 0 then do; csl = RECOMPUTE_CSL (vtocep); records = RECOMPUTE_RECORDS (vtocep); end;
 381 
 382                n_used_rec = n_used_rec + records;
 383 
 384                if fixed (vtoce.records, 9) ^= records then
 385                     do;
 386                     call report_records;
 387                     vtoce.records = bit (fixed (records, 9));
 388                end;
 389 
 390                if fixed (vtoce.csl, 9) ^= csl then
 391                     do;
 392                     call report_csl;
 393                     vtoce.csl = bit (fixed (csl, 9));
 394                end;
 395 
 396                if fixed (vtoce.msl, 9) > msl | fixed (vtoce.msl, 9) < csl then
 397                     do;
 398                     call report_msl;
 399                     vtoce.msl = bit (fixed (msl, 9));
 400                end;
 401 
 402                trp_bad = "0"b;
 403                do i = 0 to 1;
 404                     if vtoce.trp (i) < 0 | fixed (vtoce.trp_time (i), 36) > fixed (curtime, 36)
 405                          then trp_bad = "1"b;
 406                end;
 407                if trp_bad then do;
 408                     call report_trp;
 409                     do i = 0 to 1;
 410                          vtoce.trp (i) = 0;
 411                          vtoce.trp_time = curtime;
 412                     end;
 413                end;
 414 
 415                if vtoce.dirsw then if ^root_pack then do;
 416                          call salv_err_msg (SALV_DEBUG,
 417                               "salvage_pv: dirsw turned off for vtocx ^oo: ^a", vtocx, vtoce.primary_name);
 418                          if salv_data$dump then call dir_dump$vtoce (vtocep);
 419                          vtoce.dirsw = "0"b;
 420                          vtoce.damaged, complained = "1"b;
 421                     end;
 422 
 423                vtoce.fm_damaged = "0"b;
 424                vtoce.fm_checksum_valid = "0"b;
 425                vtoce.fm_checksum = ""b;
 426 
 427                if fixed (vtoce.dtm) > fixed (hdr_time (1)) then call THREAD_FOR_DUMPER (1);
 428                if fixed (vtoce.dtm) > fixed (hdr_time (2)) then call THREAD_FOR_DUMPER (2);
 429 
 430                return;
 431 
 432 
 433 
 434 
 435 report_out_of_range : proc;
 436                     call salv_err_msg (SALV_DEBUG, "salvage_pv: vtoce ^a at ^oo: page ^oo disk_addr ^oo bad",
 437                          vtoce.primary_name, vtocx, i, r);
 438                     vtoce.damaged, complained = "1"b;
 439                     return;
 440                end;
 441 
 442 report_records : proc;
 443                     call salv_err_msg (SALV_DEBUG, "salvage_pv: vtoce ^a at ^oo: rec used changed from ^oo to ^oo",
 444                          vtoce.primary_name, vtocx, fixed (vtoce.records), records);
 445                     vtoce.damaged, complained = "1"b;
 446                     return;
 447                end;
 448 
 449 report_csl :   proc;
 450                     call salv_err_msg (SALV_DEBUG, "salvage_pv: vtoce ^a at ^oo: cur len changed from ^oo to ^oo",
 451                          vtoce.primary_name, vtocx, fixed (vtoce.csl), csl);
 452                     vtoce.damaged, complained = "1"b;
 453                     return;
 454                end;
 455 
 456 report_msl :   proc;
 457                     call salv_err_msg (SALV_DEBUG, "salvage_pv: vtoce ^a at ^oo: max len changed from ^oo to ^oo",
 458                          vtoce.primary_name, vtocx, fixed (vtoce.msl), msl);
 459                     vtoce.damaged, complained = "1"b;
 460                     return;
 461                end;
 462 
 463 report_trp:    proc;
 464                     call salv_err_msg (SALV_DEBUG, "salvage_pv: vtoce ^a at ^oo: time-record-product reset to zero",
 465                          vtoce.primary_name, vtocx);
 466                     return;
 467                end;
 468 
 469           end CHECK_VTOCE;
 470 
 471 
 472 
 473 ^L
 474 
 475 FREE_VTOCE : proc;
 476 
 477 dcl  bit_no fixed bin;
 478 dcl  word_no fixed bin;
 479 
 480                if vtoce.uid ^= "0"b then free_count = free_count + 1;
 481 
 482                unspec (vtoce) = "0"b;
 483 
 484                n_free_vtoce = n_free_vtoce + 1;
 485 
 486                word_no = divide (vtocx, 32, 17);
 487                bit_no = mod (vtocx, 32);
 488                bit_map_wordp = addr (salv_vtoc_map.bit_map (word_no));
 489                substr (bit_map_word.bits, bit_no + 1, 1) = "1"b;
 490 
 491                call THREAD_FOR_DUMPER (2);
 492 
 493                return;
 494 
 495           end FREE_VTOCE;
 496 
 497 
 498 THREAD_FOR_DUMPER: proc (index);
 499 
 500 dcl  index fixed bin;
 501 
 502                if not_enabled_sw then return;
 503 
 504                if index = 1 then
 505                     incr_map (vtocx) = "1"b;
 506                else
 507                cons_map (vtocx) = "1"b;
 508 
 509                return;
 510 
 511           end THREAD_FOR_DUMPER;
 512 
 513 ^L
 514 RESOLVE_CONFLICT : proc (i);
 515 
 516 dcl (i, I, r, VTOCX, del, DEL) fixed bin;
 517 
 518 dcl  VTOCEP ptr;
 519 dcl 1 VTOCE like vtoce aligned based (VTOCEP);
 520 
 521 
 522 
 523                r = fixed (substr (vtoce.fm (i), 2, 17), 17);
 524 
 525                VTOCX = vtocx_table (r);
 526                VTOCEP = vm_vio$get_vtocep (pvtx, VTOCX);
 527 
 528                do I = 0 to 255 while (VTOCE.fm (I) ^= vtoce.fm (i));
 529                end;
 530 
 531                if I > 255 then go to del_eq_1;;
 532 
 533                DEL, del = 0;
 534 
 535                if vtoce.dirsw = VTOCE.dirsw then DEL, del = 1;
 536                if vtoce.dirsw & ^VTOCE.dirsw then DEL = 1;
 537                if ^vtoce.dirsw & VTOCE.dirsw then del = 1;
 538 
 539                if del = 1 then
 540 del_eq_1:           do;
 541                     call report_page_del;
 542                     vtoce.fm (i) = pv_salv_null_addr;
 543                end;
 544 
 545                if DEL = 1 then
 546                     do;
 547                     call report_page_DEL;
 548                     vtocx_table (r) = 0;
 549                     bit_table (r) = "0"b;
 550 
 551                     VTOCE.fm (I) = pv_salv_null_addr;
 552 
 553                     if vtocep ^= VTOCEP then
 554                          do;
 555                          VTOCE.csl = bit (fixed (RECOMPUTE_CSL (VTOCEP), 9));
 556                          VTOCE.records = bit (fixed (fixed (VTOCE.records, 9) - 1, 9), 9);
 557 
 558                          n_used_rec = n_used_rec - 1;
 559                     end;
 560                end;
 561 
 562                return;
 563 ^L
 564 report_page_del : proc;
 565                     call salv_err_msg (SALV_DEBUG,
 566                          "salvage_pv: vtoce ^a at ^oo: ref to pageno ^oo at addr ^oo deleted, dirsw is ^b",
 567                          vtoce.primary_name, vtocx, i, r, vtoce.dirsw);
 568                     vtoce.damaged, complained = "1"b;
 569                     return;
 570                end;
 571 
 572 report_page_DEL : proc;
 573                     call salv_err_msg (SALV_DEBUG,
 574                          "salvage_pv: vtoce ^a at ^oo: ref to pageno ^oo at addr ^oo deleted, dirsw is ^b",
 575                          VTOCE.primary_name, VTOCX, I, r, VTOCE.dirsw);
 576                     if ^VTOCE.damaged & VTOCX < vtocx then do;
 577                          damaged_count = damaged_count + 1;
 578                          damaged_by_me = damaged_by_me + 1;
 579                     end;
 580                     if VTOCE.damaged | VTOCX > vtocx then return;
 581                     segdamage.pvid = label.pvid;
 582                     segdamage.lvid = label.lvid;
 583                     segdamage.uid = VTOCE.uid;
 584                     segdamage.vtocx = VTOCX;
 585                     segdamage.pno = I;
 586                     segdamage.uid_path = VTOCE.uid_path;
 587                     call syserr$binary (SALV_LOG, addr (segdamage), SB_vtoc_salv_dam, SBL_vtoc_salv_dam,
 588                          "salvage_pv: setting damaged switch on ^a (^oo) on pv ^a.",
 589                          VTOCE.primary_name, VTOCX, label.pv_name);
 590                     sst$damaged_ct = sst$damaged_ct + 1;
 591                     VTOCE.damaged = "1"b;
 592                     return;
 593                end;
 594 
 595           end RESOLVE_CONFLICT;
 596 
 597 
 598 
 599 
 600 RECOMPUTE_CSL : proc (vtoce_ptr) returns (fixed bin);
 601 
 602 dcl  vtoce_ptr ptr;
 603 dcl (i, csl) fixed bin;
 604 
 605                csl = 0;
 606                do i = 0 to 255; if substr (vtoce_ptr -> vtoce.fm (i), 1, 1) = "0"b then csl = i + 1;
 607                end;
 608                return (csl);
 609 
 610           end RECOMPUTE_CSL;
 611 
 612 
 613 
 614 RECOMPUTE_RECORDS : proc (vtoce_ptr) returns (fixed bin);
 615 
 616 dcl  vtoce_ptr ptr;
 617 dcl (i, records) fixed bin;
 618 
 619                records = 0;
 620                do i = 0 to 255; if substr (vtoce_ptr -> vtoce.fm (i), 1, 1) = "0"b then records = records + 1;
 621                end;
 622                return (records);
 623 
 624           end RECOMPUTE_RECORDS;
 625 ^L
 626 CHECK_LABEL_VOLMAP_HEADER: proc (code);
 627 
 628 dcl  code fixed bin (35);
 629 dcl  rightsize fixed bin (24);
 630 
 631 
 632                code = 0;
 633 
 634                if label.time_last_dmp (1) = 0 then not_enabled_sw = "1"b;
 635                else do;
 636                     if comp_time < max (label.time_mounted, label.time_map_updated,
 637                     label.time_unmounted, label.time_salvaged, label.time_of_boot) then do;
 638                          call salv_err_msg (SALV_ANNOUNCE,
 639                               "salvage_pv: Label times in advance of clock. The clock may be wrong.");
 640                     end;
 641                end;
 642 
 643                hdr_time (1) = substr(bit (fixed (label.time_last_dmp (1), 52), 52),1,36);
 644                hdr_time (2) = substr(bit (fixed (label.time_last_dmp (2), 52), 52),1,36);
 645 
 646                root_pack = (label.lv_name = "root");
 647 
 648                rightsize = ceil (vol_map.n_rec/32);
 649                if vol_map.bit_map_n_words ^= rightsize then do;
 650                     call salv_err_msg (SALV_DEBUG,
 651                          "salvage_pv: Bit map size is ^d. (^oo) words, s/b ^d. (^oo), changing to latter.",
 652                          vol_map.bit_map_n_words, vol_map.bit_map_n_words, rightsize, rightsize);
 653                     vol_map.bit_map_n_words = rightsize;
 654                end;                                         /* COULD BE MAKING MISTAKE BY MAKING LARGER, OR n_rec MIGHT BE
 655                                                                WRONG. MORE POWERFUL HEURISTIC NEEDED. FIXES ERRORS CAUSED
 656                                                                BY 4.1 disk_rebuild. */
 657 
 658 
 659 
 660                return;
 661 
 662           end CHECK_LABEL_VOLMAP_HEADER;
 663 
 664 
 665 
 666 UPDATE_VOL_MAP : proc;
 667 
 668 dcl 1 old_map (vol_map.bit_map_n_words) based (addr (vol_map.bit_map)) aligned,
 669     2 pad1 bit (1) unaligned,
 670     2 bits bit (32) unaligned,
 671     2 pad2 bit (3) unaligned;
 672 
 673 dcl 1 new_map (vol_map.bit_map_n_words) based (table3p) aligned like old_map;
 674 
 675 dcl  bit_table_map (1000) bit (32) based (addr (bit_table (r0))) unaligned;
 676 
 677 dcl  w fixed bin;
 678 dcl  j fixed bin;
 679 dcl  n_free_rec fixed bin;
 680 
 681 
 682 
 683                unspec (new_map) = "0"b;
 684 
 685                do w = 1 to vol_map.bit_map_n_words;
 686                     new_map (w).bits = ^ bit_table_map (w);
 687                end;
 688 
 689                j = mod (vol_map.n_rec, 32);
 690                if j ^= 0 then substr (new_map (w - 1).bits, j + 1) = "0"b;
 691 
 692                if unspec (old_map) ^= unspec (new_map) then
 693                     do;
 694                     call report_bit_map_changed;
 695                     unspec (old_map) = unspec (new_map);
 696                end;
 697 
 698                n_free_rec = vol_map.n_rec - n_used_rec;
 699 
 700                if vol_map.n_free_rec ^= n_free_rec then
 701                     do;
 702                     call report_n_free_rec_changed;
 703                     vol_map.n_free_rec = n_free_rec;
 704                end;
 705                return;
 706 
 707 
 708 report_bit_map_changed : proc;
 709                     call salv_err_msg (SALV_DEBUG, "salvage_pv: map of assigned addresses changed");
 710                     return;
 711                end;
 712 
 713 report_n_free_rec_changed : proc;
 714                     call salv_err_msg (SALV_DEBUG, "salvage_pv: no. of free recs changed from ^d to ^d",
 715                          vol_map.n_free_rec, n_free_rec);
 716                     return;
 717                end;
 718 
 719           end UPDATE_VOL_MAP;
 720 ^L
 721 UPDATE_VTOC_MAP : proc;
 722 
 723                if (salv_vtoc_map.n_free_vtoce ^= n_free_vtoce) & salvage_call
 724                     then call report_n_free_vtoce;
 725                salv_vtoc_map.n_free_vtoce = n_free_vtoce;
 726 
 727                unspec (vtoc_map) = unspec (salv_vtoc_map);
 728 
 729                return;
 730 
 731 
 732 report_n_free_vtoce : proc;
 733                     call salv_err_msg (SALV_DEBUG, "salvage_pv: no. of free vtoces changed from ^d to ^d",
 734                          salv_vtoc_map.n_free_vtoce, n_free_vtoce);
 735                     return;
 736                end;
 737 
 738           end UPDATE_VTOC_MAP;
 739 
 740 
 741 
 742 
 743 
 744 
 745 
 746 FORCE_VTOC_ON_DISK : proc;
 747 
 748 dcl  i fixed bin;
 749 
 750 
 751                do i = 1 to max_n_vtoc_seg - 1;
 752                     astep = get_ptrs_$given_segno (fixed (baseno (s_ptr)) + i);
 753                     if astep ^= null then call pc_wired$write_wait (astep, 0, -1);
 754                end;
 755 
 756                return;
 757 
 758           end FORCE_VTOC_ON_DISK;
 759 ^L
 760 UPDATE_LABEL : proc;
 761 
 762                label.time_map_updated = comp_time;
 763                label.time_salvaged = comp_time;
 764                                                             /* copy dump maps back into label */
 765 
 766                label.vol_trouble_count = 0;                 /* Either salvage or conversion, OK in either case */
 767 
 768                if label.volmap_version ^= 1 then do;        /* Converted VTOC */
 769                     if label.volmap_version ^= 2            /* From pre-MR10 */
 770                          then do;
 771                          old_labelp = labelp;
 772                          label.time_unmounted = old_label.time_unmounted;
 773                     end;
 774                     label.volmap_version = 1;               /* Force salvage on pre-MR10 system */
 775 
 776                end;
 777 
 778                return;
 779 
 780           end UPDATE_LABEL;
 781 
 782 
 783 
 784 
 785 
 786 
 787 
 788 FORCE_LABEL_ON_DISK : proc;
 789 
 790 
 791                astep = get_ptrs_$given_segno (fixed (baseno (s_ptr)));
 792 
 793                if astep ^= null then call pc_wired$write_wait (astep, LABEL_ADDR, 1);
 794 
 795                return;
 796 
 797           end FORCE_LABEL_ON_DISK;
 798 ^L
 799 CLEAN_UP : proc;
 800 
 801 
 802 dcl segno fixed bin;
 803 
 804 
 805                segno = fixed (baseno (addr (pv_salv_seg$)), 18);
 806 
 807                astep = get_ptrs_$given_segno (segno);
 808 
 809                if astep ^= null then
 810                     do;
 811 
 812                     dseg$ (segno) = 0;
 813                     call page$cam;
 814 
 815                     call pc$truncate_deposit_all (astep);
 816                     if aste.usedf then call get_pvtx$release_pvtx ((pvt_array.pvid (aste.pvtx)), (aste.pvtx));
 817                     if sst$astl ^= pds$processid then call lock$lock_ast;
 818                     call put_aste (astep);
 819                     call lock$unlock_ast;
 820 
 821 
 822                end;
 823 
 824                call vm_vio$clean_up (pvtx);                 /* this releases printer and abs segs */
 825 
 826                return;
 827 
 828           end CLEAN_UP;
 829 ^L
 830 INIT_TABLES : proc (table1p, table2p, table3p, table4p, table5p, table6p, code);
 831 
 832 dcl  table1p ptr;
 833 dcl  table2p ptr;
 834 dcl  table3p ptr;
 835 dcl  table4p ptr;
 836 dcl  table5p ptr;
 837 dcl  table6p ptr;
 838 dcl  code fixed bin (35);
 839 
 840 dcl 1 pv_salv_seg based (addr (pv_salv_seg$)) aligned,
 841 
 842     2 table1,
 843       3 bit_table (0 : label.vol_size - 1) bit (1) unaligned,
 844 
 845     2 table2,
 846       3 vtocx_table (0 : label.vol_size - 1) fixed bin (17) unaligned,
 847 
 848     2 table3,
 849       3 new_map (1 : vol_map.bit_map_n_words) bit (36) aligned,
 850 
 851     2 table4,
 852       3 incr_map (0 : vtoc_header.n_vtoce -1) bit (1) unaligned,
 853 
 854     2 table5,
 855       3 cons_map (0 : vtoc_header.n_vtoce -1) bit (1) unaligned,
 856 
 857     2 table6 aligned like vtoc_map,
 858 
 859     2 end bit (36) aligned;
 860 
 861 dcl  segno fixed bin,                                       /* segno assigned to this segment  */
 862      pvtx fixed bin,                                        /* PVT index for this segment  */
 863      msl fixed bin;                                         /* number of pages for this segment  */
 864 
 865 dcl (i, pts, ptsi) fixed bin;
 866 
 867 dcl  tsdw fixed bin (71);
 868 
 869 
 870                code = 0;
 871 
 872                segno = fixed (baseno (addr (pv_salv_seg$)), 18);
 873                pvtx = sst$root_pvtx;
 874                msl = divide (fixed (rel (addr (pv_salv_seg.end)), 18), 1024, 17, 0) + 1;
 875 
 876 
 877 /* ALLOCATE AN ASTE OF THE APPROPRIATE SIZE */
 878 
 879                call lock$lock_ast;
 880 
 881                astep = get_aste (msl);                      /* Get an ASTE with the appropriate size PT */
 882 
 883                if astep = null then
 884                     do;
 885                     call lock$unlock_ast;
 886                     code = no_free_aste_err;
 887                     call syserr (ANNOUNCE, "salvage_pv: INIT_TABLES: aste pool ^oo too small", msl);
 888                     return;
 889                end;
 890 
 891                ptsi = fixed (aste.ptsi);
 892                pts = sst$pts (ptsi);
 893 
 894 
 895 /* ZERO THE ASTE  */
 896 
 897                astep -> aste_part.two = "0"b;               /* Zero the rest of the ASTE except ptsi and marker */
 898 
 899 
 900 /* INITIALIZE THE PAGE TABLE WITH NULL ADDRESSES AND PAGE FAULT BITS */
 901 
 902                ptp = addrel (astep, sst$astsize);           /* get a pointer to the page table */
 903 
 904                do i = 0 to pts - 1;
 905                     call ptw_util_$make_null (addrel (ptp, i), fill_page_table_null_addr); /* Make up remaining PTWS */
 906                end;
 907 
 908 
 909 /* INITIALIZE THE ASTE */
 910 
 911                astep -> aste.vtocx = -1;                    /* show there is no VTOCE for the segment */
 912                astep -> aste.dnzp = "1"b;
 913                astep -> aste.nqsw = "1"b;                   /* turn on no quota switch */
 914                astep -> aste.strp = bit (fixed (segno, 18), 18); /* store segment number in AST */
 915                astep -> aste.msl = bit (fixed (msl, 9), 9); /* set the max length */
 916                astep -> aste.pvtx = pvtx;                   /* store the root physical volume table index */
 917 
 918 
 919 /* THE CLEAN_UP OPERATION WILL DEPEND ON THE ORDER IN WHICH THE NEXT ACTIONS ARE PERFORMED */
 920 
 921                tsdw = get_ptrs_$given_astep (astep);        /* Get initial  SDW. */
 922                dseg$ (segno) = tsdw;                        /* store temp SDW in the descriptor segment */
 923                call page$cam;
 924 
 925 
 926                call get_pvtx$hold_pvtx ((pvt_array.pvid (pvtx)), pvtx, (0));    /* Hold the RPV */
 927                astep -> aste.usedf = "1"b;                  /* mark it as being used - as late as possible */
 928 
 929                call thread$out (astep, sst$level (ptsi).ausedp); /* thread the entry out of the used list */
 930 
 931                call lock$unlock_ast;
 932 
 933 
 934 /* INITIALIZE POINTERS TO TABLES */
 935 
 936                table1p = addr (pv_salv_seg.table1);
 937                table2p = addr (pv_salv_seg.table2);
 938                table3p = addr (pv_salv_seg.table3);
 939                table4p = addr (pv_salv_seg.table4);
 940                table5p = addr (pv_salv_seg.table5);
 941                table6p = addr (pv_salv_seg.table6);
 942 
 943                return;
 944 
 945           end INIT_TABLES;
 946 
 947 %page; %include aste;
 948 %page; %include disk_pack;
 949 %page; %include fs_vol_label;
 950 %page; %include null_addresses;
 951 %page; %include old_fs_vol_label;
 952 %page; %include pvte;
 953 %page; %include salv_data;
 954 %page; %include salvager_severities;
 955 %page; %include segdamage_msg;
 956 %page; %include syserr_binary_def;
 957 %page; %include syserr_constants;
 958 %page; %include vol_map;
 959 %page; %include vtoc_header;
 960 %page; %include vtoc_map;
 961 %page; %include vtoce;
 962 
 963 /* ^L */
 964 /* BEGIN MESSAGE DOCUMENTATION
 965 
 966    Message:
 967    salvage_pv: INIT_TABLES: aste pool WWWo too small.
 968 
 969    S:     $info
 970 
 971    T:     $run
 972 
 973    M:     The physical volume salvager was unable to
 974    obtain a temporary AST entry for segment requiring
 975    WWWo ptws. No salvaging was done.
 976 
 977    A:     Shut down,
 978    manually correct the SST card,
 979    and reboot.
 980    Then salvage all volumes,
 981    since the indicator that volumes need salvaging
 982    may have been lost.
 983 
 984    Message:
 985    salvage_pv: Volume salvage of dskX_NN{s}, volume PVNAME of logical vol LVNAME.
 986 
 987    S:     $salvout
 988 
 989    T:     $salvt
 990 
 991    M:     This message is printed when volume salvaging begins.
 992 
 993    A:     $ignore
 994 
 995    Message:
 996    salvage_pv: VTOC Conversion of dskX_NN{s}, volume PVNAME of logical vol LVNAME.
 997 
 998    S:     $salvout
 999 
1000    T:     $salvt
1001 
1002    M:     This message is printed when a pre-MR10 disk pack is first
1003    mounted on an MR10 or later system. The equivalent of a salvage
1004    is being done to create the VTOC Map, which did not exist prior
1005    to MR10.
1006 
1007    A:     $ignore
1008 
1009 
1010    Message:
1011    salvage_pv: Bit map size is DD. (WWo) words, s/b EE. (FFo), changing to latter.
1012 
1013    S:     $salvout
1014 
1015    T:     $salvt
1016 
1017    M:     The bit map size in the volume label was incorrect and has been corrected.
1018 
1019    A:     $ignore
1020 
1021 
1022    Message:
1023    salvage_pv: Label times in advance of clock. The clock may be wrong.
1024 
1025    S:     $salvout
1026 
1027    T:     $salvt
1028 
1029    M:     The label of the volume being salvaged
1030    contains one or more clock readings in advance of the current clock.
1031    Salvaging will proceed.
1032    The times are not corrected.
1033    If there is reason to believe that the system clock is incorrect,
1034    shut the system down as soon as possible and take steps to recover
1035    that part of the hierarchy which may have been contaminated with bad
1036    clock values.
1037 
1038    A:     $ignore
1039 
1040 
1041    Message:
1042    salvage_pv: NN free vtoces added to free list.
1043 
1044    S:     $salvout
1045 
1046    T:     $salvt
1047 
1048    M:     NN free VTOC entries
1049    were found while salvaging and added to the list of free VTOC entries.
1050    This is a normal message.
1051 
1052    A:     $ignore
1053 
1054 
1055    Message:
1056    salvage_pv: damaged switch found on for UUUU vtocx XXXo: NAME
1057 
1058    S:     $salvout
1059 
1060    T:     $salvt
1061 
1062    M:     The segment originally named NAME
1063    with unique ID UUUU at vtoc index XXXo
1064    was found to have its damaged switch on.
1065    The damaged switch can be set during the running of the system
1066    if page control encounters an I/O error.
1067    Damaged segments cannot be used until the damaged switch is reset.
1068 
1069    A:     $ignore
1070 
1071 
1072    Message:
1073    salvage_pv: dirsw turned off for vtocx XXXo: NAME
1074 
1075    S:     $salvout
1076 
1077    T:     $salvt
1078 
1079    M:     The segment originally named NAME
1080    at vtoc index XXXo
1081    has had its directory switch turned off.
1082 
1083    A:     $ignore
1084 
1085 
1086    Message:
1087    salvage_pv: freeing UUUU deciduous vtocx XXXo: NAME
1088 
1089    S:     $salvout
1090 
1091    T:     $salvt
1092 
1093    M:     The segment originally named NAME
1094    with unique ID UUUU
1095    at vtoc index XXXo
1096    was deciduous, and has been deleted from the RPV.
1097    This is debugging output
1098    printed for system programmers
1099    if a SALV DEBG card is supplied.
1100 
1101    A:     $ignore
1102 
1103 
1104    Message:
1105    salvage_pv: freeing UUUU per-bootload vtocx XXXo: NAME
1106 
1107    S:     $salvout
1108 
1109    T:     $salvt
1110 
1111    M:     The segment originally named NAME with unique ID UUU
1112    at vtoc index XXXo was per-bootload (inferior to a prior >sl1),
1113    and has been deleted. This is debugging output printed for system
1114    programmers if a SALV DEBG card is supplied.
1115 
1116    A:  $ignore
1117 
1118 
1119    Message:
1120    salvage_pv: freeing UUUU per process vtocx XXXo: NAME
1121 
1122    S:     $salvout
1123 
1124    T:     $salvt
1125 
1126    M:     The segment originally named NAME
1127    with unique ID UUUU
1128    at vtoc index XXXo
1129    was per-process
1130    and has been deleted.
1131    This is debugging output
1132    printed for system programmers
1133    if a SALV DEBG card is used.
1134 
1135    A:     $ignore
1136 
1137 
1138    Message:
1139    salvage_pv: map of assigned addresses changed.
1140 
1141    S:     $salvout
1142 
1143    T:     $salvt
1144 
1145    M:     If any corrections were made to the
1146    map on the volume
1147    which shows which addresses are free and which are in use,
1148    this message is printed.
1149    If the volume was not properly shut down, this message is to be expected.
1150 
1151    A:     $ignore
1152 
1153 
1154    Message:
1155    salvage_pv: no. of free recs changed from OLD to NEW (dec).
1156 
1157    S:     $salvout
1158 
1159    T:     $salvt
1160 
1161    M:     If the number of free records
1162    in the volume label
1163    is changed by a volume salvage,
1164    this message is printed.
1165    If the volume was not properly shut down, this message is to be expected.
1166 
1167    A:     $ignore
1168 
1169 
1170    Message:
1171    salvage_pv: no. of free vtoces changed from OLD to NEW (dec).
1172 
1173    S:     $salvout
1174 
1175    T:     $salvt
1176 
1177    M:     If the number of
1178    free VTOC entries
1179    in the volume label
1180    is changed by a volume salvage,
1181    this message is printed.
1182 
1183    A:     $ignore
1184 
1185 
1186 
1187    Message:
1188    salvage_pv: vtoce NAME at XXXo: cur len changed from OLD to NEW (octal)
1189 
1190    S:     $salvout
1191 
1192    T:     $salvt
1193 
1194    M:     The segment originally named NAME
1195    at vtoc index XXXo
1196    had a current length which did not agree
1197    with the file map.
1198    The current length was corrected
1199    and the damaged switch set on the segment.
1200    This message usually indicates that a segment was damaged before a crash
1201    by failure to write out its pages to disk before the crash.
1202    The segment may have to be recovered.
1203 
1204    A:     $ignore
1205 
1206 
1207    Message:
1208    salvage_pv: vtoce NAME at XXXo: max len changed from OLD to NEW (octal).
1209 
1210    S:     $salvout
1211 
1212    T:     $salvt
1213 
1214    M:     The segment originally named NAME
1215    at vtoc index XXXo
1216    had a maximum segment length which did not agree
1217    with the file map
1218    or was less than the current length.
1219    The maximum length was corrected
1220    and the damaged switch set.
1221 
1222    A:     $ignore
1223 
1224 
1225    Message:
1226    salvage_pv: vtoce NAME at XXXo: time-record-product reset to zero.
1227 
1228    S:     $salvout
1229 
1230    T:     $salvt
1231 
1232    M:     The segment originally named NAME at vtoc index XXXo
1233    had an invalid value for one of the time-record-product fields.
1234    All time-record-product fields have been reset to zero.
1235 
1236    A:     $ignore
1237 
1238 
1239    Message:
1240    salvage_pv: vtoce NAME at XXXo: page PPPo disk_addr DDDDo bad.
1241 
1242    S:     $salvout
1243 
1244    T:     $salvt
1245 
1246    M:     The segment originally named NAME
1247    at vtoc index XXXo
1248    had an invalid disk address DDDDo for page PPPo.
1249    The address is nulled,
1250    causing a page of zeroes,
1251    and the damaged switch set.
1252 
1253    A:     $ignore
1254 
1255 
1256    Message:
1257    salvage_pv: vtoce NAME at XXXo: rec used changed from OLD to NEW (octal).
1258 
1259    S:     $salvout
1260 
1261    T:     $salvt
1262 
1263    M:     The segment originally named NAME
1264    at vtoc index XXXo
1265    had a records used which
1266    did not agree with the file map.
1267    The records used field was corrected
1268    and the damaged switch set.
1269    This message usually indicates that a segment was damaged before a
1270    crash by failure to write out its pages to disk before the crash.
1271    The segment may have to be recovered.
1272 
1273    A:     $ignore
1274 
1275 
1276    Message:
1277    salvage_pv: vtoce NAME at XXXo: ref to pageno PPo at addr DDDDo deleted, dirsw is X.
1278 
1279    S:     $salvout
1280 
1281    T:     $salvt
1282 
1283    M:     The segment originally named NAME
1284    at vtoc index XXXo
1285    had a reused address conflict with another segment.
1286    The page reference
1287    was determined to be incorrect,
1288    and a null address placed in the segment's file map,
1289    causing a page of zeroes,
1290    and the damaged switch set.
1291    This message may be symptomatic of disk or other hardware problems.
1292 
1293    A:     $ignore
1294 
1295 
1296    Message:
1297    salvage_pv: vtoce XXXo free but not zero.
1298 
1299    S:     $salvout
1300 
1301    T:     $salvt
1302 
1303    M:     The VTOC entry with index XXXo
1304    was marked free but was not all zero.
1305    It was zeroed and made free.
1306 
1307    A:     $ignore
1308 
1309    Message:
1310    salvage_pv: setting damaged switch on PRIMARYNAME (VTOCXo) on pv PVNAME.
1311 
1312    S: $log
1313 
1314    T: $salvt
1315 
1316    M: The volume salvager has discovered possible damage to a segment and has
1317    turned on the damaged switch.
1318 
1319    A: $ignore
1320    This message is logged in order to trigger automatic processing of damaged
1321    segments.
1322 
1323 
1324    Message:
1325    salvage_pv: VTOC conversion finished.
1326 
1327    S: $salvout
1328 
1329    T: $salvt
1330 
1331    M: VTOC conversion finished.
1332 
1333    A: $ignore
1334 
1335 
1336    Message:
1337    salvage_pv: VTOC conversion finished with errors.
1338 
1339    S: $salvout
1340 
1341    T: $salvt
1342 
1343    M: VTOC conversion finished with errors.
1344 
1345    A: $inform
1346 
1347 
1348    Message:
1349    salvage_pv: Volume salvage finished.
1350 
1351    S: $salvout
1352 
1353    T: $salvt
1354 
1355    M: Volume salvage finished.
1356 
1357    A: $ignore
1358 
1359 
1360    Message:
1361    salvage_pv: Volume salvage finished with errors.
1362 
1363    S: $salvout
1364 
1365    T: $salvt
1366 
1367    M: Volume salvage finished with errors.
1368 
1369    A: $inform
1370 
1371 
1372    Message:
1373    salvage_pv: DDD damaged segments on volume PVNAME (NNN damaged in this salvage).
1374 
1375    S: $info
1376 
1377    T: $salvt
1378 
1379    M: DDD damaged segments were found on the volume PVNAME, which has
1380    just been volume-salvaged. The damaged switch was set for NNN of these
1381    segments during this volume salvage. The  damaged switch  for the
1382    other segments had been set prior to the salvage.
1383 
1384    A: Inspect the syserr and Answering Service log to identify
1385    damaged segments.  Prepare to recover them if necessary.
1386 
1387 
1388 
1389    END MESSAGE DOCUMENTATION */
1390 
1391 
1392      end salvage_pv;