1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 fs_search:
27 procedure (a_refptr, a_refname, a_MSF_sw, a_segptr, a_code);
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 dcl a_code fixed bin (35) parameter;
52
53 dcl a_pathcnt fixed bin (17) parameter;
54 dcl a_pathptr ptr parameter;
55 dcl a_refname char (*) parameter;
56 dcl a_refptr ptr parameter;
57 dcl a_segptr ptr parameter;
58 dcl a_MSF_sw bit (1) aligned parameter;
59
60 dcl a_wdir char (*) parameter;
61
62
63
64 dcl bc fixed bin (24);
65 dcl code fixed bin (35);
66 dcl dirname char (168);
67 dcl i fixed bin;
68 dcl old_ep ptr;
69 dcl pathname char (168) varying;
70 dcl refname char (32);
71 dcl refptr ptr;
72 dcl ring fixed bin (3);
73 dcl segment_number fixed bin;
74 dcl segment_uid bit (36) aligned;
75 dcl segptr ptr;
76 dcl srp ptr;
77 dcl test_stack_reference bit (36) aligned;
78 dcl type fixed bin (2);
79 dcl MSF_sw bit (1) aligned;
80 dcl wdir char (168);
81 dcl wdp ptr;
82
83
84
85 dcl based_reference bit (36) aligned based;
86 dcl dname char (168) based aligned;
87 dcl 1 sr (22) based aligned,
88 ( 2 base bit (18),
89 2 off bit (18),
90 2 uid bit (36)
91 ) unaligned;
92
93
94 dcl error_table_$dirseg ext fixed bin (35);
95 dcl error_table_$inconsistent_rnt
96 ext fixed bin (35);
97 dcl error_table_$logical_volume_not_defined
98 ext fixed bin (35);
99 dcl error_table_$moderr ext fixed bin (35);
100 dcl error_table_$root ext fixed bin (35);
101 dcl error_table_$seg_not_found
102 ext fixed bin (35);
103 dcl error_table_$segknown ext fixed bin (35);
104 dcl pds$stacks (0:7) ptr ext;
105 dcl pds$process_group_id char (32) ext static;
106 dcl pds$wdir (0:7) ptr ext;
107 dcl pds$wdir_uid (0:7) ext bit (36);
108
109
110
111 dcl get_kstep entry (fixed bin (17), ptr, fixed bin (35));
112 dcl get_pathname_ entry (fixed bin (17), char (*) varying, fixed bin (35));
113 dcl initiate$initiate_count
114 entry (char (*), char (*), char (*), fixed bin (24), fixed bin (2), ptr,
115 fixed bin (35));
116 dcl initiate$initiate_seg_count
117 entry (ptr, char (*), char (*), fixed bin (24), fixed bin (2), ptr,
118 fixed bin (35));
119 dcl level$get entry returns (fixed bin);
120 dcl lock$dir_unlock entry (ptr);
121 dcl ref_name_$get_segno entry (char (32) varying, fixed bin (17), fixed bin (35));
122 dcl segno_usage$decrement entry (fixed bin (17), fixed bin (35));
123 dcl status_$minf entry (char (*), char (*), fixed bin (1), fixed bin (2), fixed bin (24),
124 fixed bin (35));
125 dcl syserr entry options (variable);
126 dcl terminate_proc entry (fixed bin (35));
127
128
129
130 dcl any_other condition;
131
132 dcl (addr, baseptr, hbound, length, null, ptr, rtrim, segno)
133 builtin;
134 %page;
135 refptr = a_refptr;
136 refname = a_refname;
137 MSF_sw = a_MSF_sw;
138 segptr = null;
139
140 code = 0;
141 ring = level$get ();
142 test_stack_reference = pds$stacks (ring) -> based_reference;
143
144
145
146 on any_other call USER_RING_DAMAGED ("stack_header.rnt_ptr", ring);
147
148 rntp = pds$stacks (ring) -> stack_header.rnt_ptr;
149 on any_other call USER_RING_DAMAGED ("rnt.srulep", ring);
150 srp = rnt.srulep;
151 on any_other call USER_RING_DAMAGED ("the RNT", ring);
152
153
154
155 do i = 1 to hbound (srp -> sr, 1);
156
157 if srp -> sr (i).off
158 then do;
159
160
161
162 if srp -> sr (i).off = INITIATED_RULE
163 then do;
164 call ref_name_$get_segno ((refname), segment_number, code);
165 if code = 0
166 then do;
167 segptr = baseptr (segment_number);
168 addr (segptr) -> its_unsigned.ringno = 0;
169
170 go to return;
171 end;
172 end;
173
174 else if srp -> sr (i).off = REFERENCING_DIR_RULE
175 then do;
176 if refptr ^= null
177 then do;
178 call get_kstep (segno (refptr), kstep, code);
179 if code = 0
180 then do;
181 if MSF_sw
182 then call get_kstep (segno (kste.entryp), kstep, code);
183 dp = ptr (kste.entryp, 0);
184 go to init_seg;
185 end;
186 end;
187 end;
188
189 else if srp -> sr (i).off = WDIR_RULE
190 then do;
191 dp = pds$wdir (ring);
192 if dp ^= null
193 then do;
194 call get_kstep (segno (dp), kstep, code);
195 if code = 0
196 then if pds$wdir_uid (ring) = kstep -> kste.uid
197
198 then go to init_seg;
199 end;
200 end;
201
202 else if srp -> sr (i).off = END_RULE
203 then do;
204 code = error_table_$seg_not_found;
205 goto return;
206 end;
207
208 else if srp -> sr (i).off = BAD_RULE
209 then ;
210 end;
211
212
213
214 else do;
215 dp = baseptr (srp -> sr (i).base);
216 call get_kstep (segno (dp), kstep, code);
217 if code = 0
218 then if srp -> sr (i).uid = kstep -> kste.uid
219 then do;
220 init_seg:
221 call initiate$initiate_seg_count (dp, refname, refname, (0), 1b, segptr, code);
222 if segptr ^= null
223 then do;
224 if code = error_table_$segknown
225 then code = 0;
226
227 go to return;
228 end;
229 else if code = error_table_$moderr
230 | code = error_table_$logical_volume_not_defined
231 then go to return;
232 else if code = error_table_$dirseg
233 then do;
234 call dc_find$obj_existence_ptr (dp, ep, code);
235 if code = 0
236 then do;
237 call get_pathname_ (segno (dp), pathname, code);
238 call dc_find$finished (ep, DC_FIND_UNLOCK_DIR);
239 end;
240 if code = 0
241 then do;
242 dirname = pathname;
243 call status_$minf (dirname, refname, 1, type, bc, code);
244 end;
245 if code = 0 & bc > 0 & type = 2
246 then do;
247 dirname = rtrim (pathname) || ">" || refname;
248 call initiate$initiate_count (dirname, "0", refname,
249 (0), 1, segptr, code);
250 if segptr ^= null
251 then do;
252 if code = error_table_$segknown
253 then code = 0;
254
255 go to return;
256 end;
257 else if code = error_table_$moderr
258 | code = error_table_$logical_volume_not_defined
259 then go to return;
260 end;
261 end;
262 end;
263 end;
264 end;
265
266 code = error_table_$seg_not_found;
267
268 return:
269 a_segptr = segptr;
270 a_code = code;
271 return;
272 %page;
273 same_directory:
274 entry (a_refptr, a_refname, a_segptr, a_code);
275
276 refptr = a_refptr;
277 refname = a_refname;
278
279
280
281 segptr = null;
282 code = 0;
283
284 if refptr ^= null
285 then do;
286 call get_kstep (segno (refptr), kstep, code);
287 if code = 0
288 then do;
289 dp = ptr (kste.entryp, 0);
290 call initiate$initiate_seg_count (dp, refname, "", 0, 1b, segptr, code);
291 if code = error_table_$segknown
292 then code = 0;
293 end;
294 end;
295 else code = error_table_$seg_not_found;
296
297 a_segptr = segptr;
298 a_code = code;
299
300 return;
301 %page;
302 set_wdir:
303 entry (a_wdir, a_code);
304
305 wdir = a_wdir;
306
307 call dc_find$dir_initiate (wdir, dp, code);
308 if code = 0
309 then do;
310 ring = level$get ();
311 segment_number = segno (pds$wdir (ring));
312 segment_uid = pds$wdir_uid (ring);
313
314 pds$wdir (ring) = dp;
315 pds$wdir_uid (ring) = dp -> dir.uid;
316 call lock$dir_unlock (dp);
317
318 call get_kstep (segment_number, kstep, code);
319 if code = 0
320 then if segment_uid = kstep -> kste.uid
321 then do;
322 call dc_find$obj_terminate_ptr (baseptr (segment_number), old_ep, code);
323
324 if code = 0
325 then call lock$dir_unlock (ptr (old_ep, 0));
326 if code = error_table_$root
327 then code = 0;
328 if code = 0
329 then call segno_usage$decrement (segment_number, (0));
330 end;
331 code = 0;
332 end;
333 a_code = code;
334 return;
335 %page;
336 get_wdir:
337 entry (a_pathptr, a_pathcnt);
338
339 pathname = "";
340 ring = level$get ();
341 wdp = pds$wdir (ring);
342 call get_kstep (segno (wdp), kstep, code);
343 if code = 0
344 then if pds$wdir_uid (ring) = kstep -> kste.uid
345 then do;
346 call dc_find$obj_existence_ptr (wdp, ep, code);
347 if code = 0
348 then do;
349 call get_pathname_ (segno (wdp), pathname, code);
350 call dc_find$finished (ep, DC_FIND_UNLOCK_DIR);
351 end;
352 else if code = error_table_$root
353 then do;
354 code = 0;
355 pathname = ">";
356 end;
357 end;
358 a_pathptr -> dname = pathname;
359 a_pathcnt = length (pathname);
360 return;
361 %page;
362 USER_RING_DAMAGED:
363 procedure (Damaged_thing, Ring);
364
365 dcl Damaged_thing char (*) parameter;
366 dcl Ring fixed bin (3) parameter;
367
368 call syserr (JUST_LOG, "fs_search: Fatal damage detected to ^a in ring ^d for ^a.", Damaged_thing, Ring,
369 pds$process_group_id);
370 call terminate_proc (error_table_$inconsistent_rnt);
371 end USER_RING_DAMAGED;
372 %page;
373 %include dc_find_dcls;
374 %page;
375 %include dir_entry;
376 %page;
377 %include dir_header;
378 %page;
379 %include its;
380 %page;
381 %include kst;
382 %page;
383 %include rnt;
384 %page;
385 %include search_rule_flags;
386 %page;
387 %include stack_header;
388 %page;
389 %include syserr_constants;
390 %page;
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408 end fs_search;