1 /****^  ***********************************************************
  2         *                                                         *
  3         * Copyright, (C) Honeywell Bull Inc., 1987                *
  4         *                                                         *
  5         * Copyright, (C) Honeywell Information Systems Inc., 1983 *
  6         *                                                         *
  7         *********************************************************** */
  8 accept_rpv:
  9      procedure;
 10 
 11 /****^  HISTORY COMMENTS:
 12   1) change(86-05-13,GJohnson), approve(86-05-13,MCR7387),
 13      audit(86-05-13,Martinson), install(86-05-14,MR12.0-1056):
 14      Correct error message documentation.
 15   2) change(86-05-19,Lippard), approve(85-12-02,MCR7309),
 16      audit(86-05-21,Coppola), install(86-07-17,MR12.0-1097):
 17      Modified by Jim Lippard to base determination of whether this volume is a
 18      root PV on the new root_lv flag in the pvt rather than on hc_part_used,
 19      since root PVs need not have hardcore partitions now.
 20   3) change(86-05-20,Fawcett), approve(86-04-11,MCR7383),
 21      audit(86-05-21,Coppola), install(86-07-17,MR12.0-1097):
 22      Add subvolume support.
 23   4) change(87-01-08,Farley), approve(87-01-12,MECR0008),
 24      audit(87-01-09,GDixon), install(87-01-12,MR12.0-1268):
 25      Changed to reset pvt$rpvs_requested after successfully accepting all the
 26      rlv. This will then allow system_startup_ to do a salvage_dirs when
 27      required.
 28   5) change(87-01-14,Farley), approve(87-01-14,MCR7608),
 29      audit(87-01-14,GDixon), install(87-01-14,MR12.0-1279):
 30      Offical installation of above corrections.
 31                                                    END HISTORY COMMENTS */
 32 /*
 33    This procedure accepts the RPV during system initialization.
 34 
 35    Stolen from accept_fs_disk August 1980 by C. Hornig
 36    Modified March 1982, J. Bongiovanni, to eliminate use of FSDCT
 37    Modified '82 for english error codes.
 38    Modified 1985-03-28, BIM: pre-accept non-partition volumes.
 39 */
 40 
 41           dcl     pvt$n_entries          fixed bin external;
 42           dcl     pvt$root_lvid          bit (36) aligned external;
 43           dcl     pvt$root_pvtx          fixed bin external;
 44           dcl     pvt$rlv_needs_salv     bit (1) aligned external;
 45           dcl     pvt$rpv_needs_salv     bit (1) aligned external;
 46           dcl     pvt$rpvs_requested     bit (1) aligned external;
 47           dcl     salv_data$rpv          bit (1) aligned external;
 48 
 49           dcl     accept_fs_disk         entry (fixed bin, fixed bin (35));
 50           dcl     config_$find           entry (char (4) aligned, ptr);
 51           dcl     config_$find_parm      entry (char (4) aligned, ptr);
 52           dcl     make_sdw$reset_hcp     entry;
 53           dcl     read_disk              entry (fixed bin, fixed bin, ptr, fixed bin (35));
 54           dcl     salvager$volume_salvage entry (fixed bin, bit (36) aligned, fixed bin (35));
 55           dcl     (syserr, syserr$error_code) entry options (variable);
 56           dcl     wired_shutdown$enable  entry;
 57 
 58           dcl     all_root_vols_accepted bit (1);
 59           dcl     code                   fixed bin (35);
 60           dcl     i                      fixed bin;
 61           dcl     pvtx                   fixed bin;
 62           dcl     severity               fixed bin;
 63           dcl     n_hc_volmap_pages      fixed bin;
 64           dcl     salv_rlv_request       bit (1);
 65           dcl     1 buffer               aligned like label;
 66 
 67           dcl     (addr, hbound, null, string) builtin;
 68 %page;
 69           labelp = addr (buffer);
 70           pvt_arrayp = addr (pvt$array);
 71 
 72           call config_$find_parm ("hcpt", intk_cardp);
 73           if intk_cardp = null ()
 74           then severity = LOG;
 75           else severity = ANNOUNCE;
 76 
 77 /* Check all the claimed "RLV" volumes for brotherhood of the RPV. */
 78 
 79           do pvtx = 1 to pvt$n_entries;                     /* Scan the PVT */
 80                pvtep = addr (pvt_array (pvtx));
 81                if pvte.hc_part_used & ^pvte.rpv then do;
 82                          call read_disk (pvtx, LABEL_ADDR, labelp, code);
 83                          if code ^= 0
 84                          then call syserr$error_code (CRASH, code, "accept_rpv: Cannot read label of ^a.", name (pvte));
 85 
 86                          if label.lvid ^= pvt$root_lvid
 87                          then call syserr (CRASH, "accept_rpv: pv ^a lv ^a (^a) is not part of root.", label.pv_name,
 88                                    label.lv_name, name (pvte));
 89                     end;
 90           end;
 91 
 92 /* With this in hand, deal with the RPV personally. */
 93 
 94           pvt$rpvs_requested = "0"b;
 95           salv_rlv_request = "0"b;
 96           intk_cardp = null ();                             /* search config deck */
 97           call config_$find ("intk", intk_cardp);           /* for the INTK card */
 98           if intk_cardp ^= null ()
 99           then do i = 1 to hbound (intk_card.parms, 1);     /* search the card for RPVS and RLVS */
100                     if intk_card.parms (i) = "rpvs" then do;
101                               intk_card.parms (i) = "";     /* clear it out */
102                               pvt$rpvs_requested = "1"b;
103                          end;
104                     else if intk_card.parms (i) = "rlvs" then do; /* Salvage all PVs in RLV */
105                               intk_card.parms (i) = "";
106                               pvt$rpvs_requested = "1"b;
107                               salv_rlv_request = "1"b;
108                          end;
109                end;
110 
111           pvtx = pvt$root_pvtx;                             /* Init_pvt left this here */
112           pvtep = addr (pvt_array (pvtx));
113 
114           salv_data$rpv = "1"b;
115 
116           if pvt$rpv_needs_salv | pvt$rpvs_requested
117           then pvt$rlv_needs_salv = "1"b;                   /* Salvage critical directories */
118 
119           if pvt$rpvs_requested                             /* Explicit salvage RPV */
120           then call salvager$volume_salvage (pvtx, ""b, code);
121 
122           do pvtx = 1 to pvt$n_entries;
123                pvtep = addr (pvt_array (pvtx));
124                if pvte.hc_part_used
125                then do;
126                          n_hc_volmap_pages = pvte.volmap_stock_ptr -> record_stock.n_volmap_pages;
127                          call syserr (severity, "accept_rpv: HC part on ^a used ^d out of ^d records.", name (pvte),
128                               (pvte.totrec - pvte.nleft + n_hc_volmap_pages), pvte.totrec + n_hc_volmap_pages);
129                     end;
130           end;
131 
132           call accept_fs_disk (pvt$root_pvtx, code);        /* Do the standard trip on the RPV */
133           if code ^= 0 then call syserr$error_code (CRASH, code, "accept_rpv: Error accepting RPV");
134 
135           call wired_shutdown$enable;                       /* Now if we crash clean it up */
136 
137           fgbxp = addr (flagbox$);                          /* Set bit in the flagbox. */
138           fgbx.ssenb = "1"b;
139 
140 /* Flush the pvt brother threads that we had been using for HC part chain. */
141 /* They tend to bother logical_volume_manager. */
142 
143           call make_sdw$reset_hcp;
144 
145           do i = 1 to pvt$n_entries;
146                pvtep = addr (pvt_array (i));
147                pvte.brother_pvtx = 0;
148           end;
149 
150 /* Now try to get all those "root volumes" accepted. */
151 
152           all_root_vols_accepted = "1"b;                    /* assume success */
153           do pvtx = 1 to pvt$n_entries;
154                pvtep = addr (pvt_array (pvtx));
155                if pvte.root_lv & ^pvte.rpv then do;
156                          if salv_rlv_request
157                          then call salvager$volume_salvage (pvtx, ""b, code);
158                          call accept_fs_disk (pvtx, code);
159                          if code ^= 0 then all_root_vols_accepted = "0"b;
160                                                             /* rlv incomplete */
161                     end;
162           end;
163 
164           salv_data$rpv = "0"b;
165 
166           if all_root_vols_accepted then pvt$rpvs_requested = "0"b; /* nolonger needed, if rlv accepted */
167 
168           return;
169 
170 /* * * * * * * * * NAME * * * * * * * * * */
171 
172 name:
173      procedure (Pvte) returns (char (8) aligned);
174 
175           dcl     1 Pvte                 aligned like pvte parameter;
176           dcl     1 dname                aligned,
177                     2 dev                char (4) unaligned,
178                     2 u                  char (1) unaligned,
179                     2 num                pic "99" unaligned,
180                     2 sv                 char (1) unaligned;
181 
182 
183           dname.dev = Pvte.devname;
184           dname.u = "_";
185           dname.num = Pvte.logical_area_number;
186           if Pvte.is_sv then dname.sv = valid_sv_array (Pvte.sv_num);
187           else dname.sv = "";
188           return (string (dname));
189      end name;
190 %page;
191 %include disk_pack;
192 %include flagbox;
193 %include fs_vol_label;
194 %include fs_dev_types;
195 %include config_intk_card;
196 %include pvte;
197 %include stock_seg;
198 %include syserr_constants;
199 %page;
200 /* BEGIN MESSAGE DOCUMENTATION
201 
202    Message:
203    accept_rpv: pv PVNAME lv LVNAME (DSKX_NN) is not part of root.
204 
205    S: $crash
206 
207    T: $init
208 
209    M: The pack on the drive DSKX_NN, with pv name and lv name as read
210    from its label, is specified on the ROOT CONFIG card, but is not
211    part of the same logical volume as the RPV.
212 
213    A: Check the ROOT CONFIG card for errors. Check for the proper
214    packs.  Reboot the system.
215 
216 
217    Message:
218    accept_rpv: Error ERRORMESSAGE accepting RPV
219 
220    S: $crash
221 
222    T: $init
223 
224    M: Some problem was encountered trying to set up the use of the RPV for
225    normal segment creation and activation.  The label of the RPV may have been
226    damaged, or encountered disk errors, as indicated by the ERRORMESSAGE.
227 
228    A: Make sure that the RPV label area (first eight records), or a dump of it,
229    is available for system programmer inspection.
230    $note
231 
232    Message:
233    accept_rpv: HC part on dskX_NN used XXX out of YYY records.
234 
235    S: This message is printed on the console if an HCPT card is in the config
236    deck. Otherwise, it is logged into the syserr_log.
237 
238    T: $init
239 
240    M: The message appears for each disk volume which contains a Hardcore
241    Partition (PART HC). It indicates how many records  were actually used
242    (XXX) in the partition, which had size YYY.
243 
244    A: $ignore
245 
246    END MESSAGE DOCUMENTATION */
247 
248      end accept_rpv;