1
2
3
4
5
6
7
8
9
10
11 init_partitions:
12 proc ();
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 dcl P99 picture "99" based;
41 dcl pvtx fixed bin;
42 dcl part_id char (4) aligned;
43 dcl part_name char (4) aligned;
44 dcl part_idx fixed bin;
45 dcl code fixed bin (35);
46 dcl problem char (64);
47 dcl drive_no fixed bin;
48 dcl sv_no fixed bin;
49 dcl sv_idx fixed bin;
50 dcl label_buffer (512) fixed bin (71) automatic;
51
52
53 dcl config_$find entry (char (4) aligned, pointer);
54 dcl read_disk_label entry (fixed bin, ptr, char (*), fixed bin (35));
55 dcl syserr entry options (variable);
56 dcl syserr$error_code entry options (variable);
57
58 dcl VALID_NUMBERS char (10) int static options (constant) init ("0123456789");
59 dcl WHOAMI char (32) internal static options (constant) init ("init_partitions:");
60
61 dcl (addr, bin, convert, index, null, rtrim, substr, verify)
62 builtin;
63 ^L
64
65 labelp = addr (label_buffer);
66 pvtp = addr (pvt$);
67 pvt_arrayp = addr (pvt.array);
68
69 part_cardp = null ();
70 GET_NEXT_PART_CARD:
71 call config_$find (PART_CARD_WORD, part_cardp);
72 if part_cardp = null ()
73 then goto FOUND_ALL_PART_CARDS;
74
75 part_id = part_card.name;
76
77 if part_card.n_fields = 4
78 then part_name = part_card.real_name;
79
80 else part_name = part_id;
81
82 if part_card.n_fields > 4
83 then call syserr (BEEP, "^a Ignoring ""^a ^d."" on ^a part card.", WHOAMI, cold_part_card.highlow,
84 cold_part_card.nrec, part_id);
85
86 sv_idx = verify (rtrim (part_card.drive), VALID_NUMBERS);
87
88 if sv_idx = 0
89 then do;
90 drive_no = bin (part_card.drive, 17);
91 sv_no = -1;
92 end;
93 else if sv_idx > 1
94 then do;
95 drive_no = bin (substr (part_card.drive, 1, sv_idx - 1), 17);
96 sv_no = index (valid_sv_string, substr (rtrim (part_card.drive), sv_idx)) - 1;
97 if sv_no = -1
98 then goto invalid_drive;
99 end;
100 else do;
101 invalid_drive:
102 call syserr (CRASH, "^a: Invalid device, ^a_^a, on ^a part card.", WHOAMI, part_card.subsystem,
103 part_card.drive, part_id);
104 goto GET_NEXT_PART_CARD;
105 end;
106
107 do pvtx = 1 to pvt.n_entries
108 while (pvt_array (pvtx).devname ^= part_card.subsystem | pvt_array (pvtx).logical_area_number ^= drive_no
109 | pvt_array (pvtx).sv_num ^= sv_no);
110 end;
111
112 if pvtx > pvt.n_entries
113 then do;
114 call syserr (CRASH, "^a Unable to locate ^a_^a for ^a partition.", WHOAMI, part_card.subsystem,
115 part_card.drive, part_id);
116 goto GET_NEXT_PART_CARD;
117 end;
118
119 READ_LABEL:
120 call read_disk_label (pvtx, labelp, problem, code);
121 if code ^= 0
122 then do;
123 call syserr$error_code (CRASH, code, "Error reading ^a_^a label. ^a", WHOAMI, part_card.subsystem,
124 part_card.drive, problem);
125 goto READ_LABEL;
126 end;
127
128 pvtep = addr (pvt_array (pvtx));
129
130 if label.nparts = 0
131 then do;
132 call syserr (CRASH, "^a There are no partitions in the label for ^a_^a^[^a^;^s^] (pvtx ^d).", WHOAMI,
133 pvte.devname, convert (P99, pvte.logical_area_number), pvte.is_sv, pvte.sv_name, pvtx);
134 goto GET_NEXT_PART_CARD;
135 end;
136
137 do part_idx = 1 to label.nparts while (part_name ^= label.parts (part_idx).part);
138
139 end;
140
141 if part_idx > label.nparts
142 then do;
143 call syserr (CRASH, "^a part ^a^[ for part ^a^;^s^] not in label of ^a_^a^[^a^;^s^] (pvtx ^d)",
144 WHOAMI, part_name, (part_name ^= part_id), part_id, pvte.devname,
145 convert (P99, pvte.logical_area_number), pvte.is_sv, pvte.sv_name, pvtx);
146 goto GET_NEXT_PART_CARD;
147 end;
148
149 pvte.permanent = "1"b;
150
151 goto GET_NEXT_PART_CARD;
152 ^L
153
154
155
156
157
158 FOUND_ALL_PART_CARDS:
159 return;
160 %page;
161 %include pvt;
162 %page;
163 %include pvte;
164 %page;
165 %include fs_dev_types;
166 %page;
167 %include fs_vol_label;
168 %page;
169 %include config_part_card;
170 %page;
171 %include syserr_constants;
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
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 end init_partitions;