1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 vtoc_attributes$set_dates:
16 proc (Uid, Pvid, Vtocx, Dtu, Dtm, Code);
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 dcl Code fixed bin (35) parameter;
59 dcl Dtd bit (36) aligned parameter;
60 dcl Dtm bit (36) aligned parameter;
61 dcl Dtu bit (36) aligned parameter;
62 dcl Dudelta fixed bin (34);
63 dcl Msk bit (36) aligned;
64 dcl Mxl fixed bin (9) parameter;
65 dcl Ncd fixed bin parameter;
66 dcl Nid fixed bin parameter;
67 dcl Priv_Sw bit (1) aligned parameter;
68 dcl Pvid bit (36) aligned parameter;
69 dcl Qcp ptr parameter;
70 dcl Qtype fixed bin parameter;
71 dcl Salv_Updatep ptr parameter;
72 dcl Scip ptr parameter;
73 dcl Sudelta fixed bin (34);
74 dcl Sws bit (36) aligned;
75 dcl Uid bit (36) aligned parameter;
76 dcl Volid (3) bit (36) aligned parameter;
77
78 dcl Vtocx fixed bin parameter;
79
80
81
82 dcl active bit (1) aligned;
83 dcl add_to_dumper bit (1) aligned;
84 dcl ast_is_locked bit (1) aligned;
85 dcl code fixed bin (35);
86 dcl code1 fixed bin (35);
87 dcl curtime fixed bin (71);
88 dcl dtd bit (36) aligned;
89 dcl dtm bit (36) aligned;
90 dcl dtu bit (36) aligned;
91 dcl dudelta fixed bin (34);
92 dcl 1 local_aste aligned like aste;
93 dcl 1 local_quota_cell aligned like quota_cell;
94 dcl 1 local_salv_update_info
95 aligned like salv_update_info;
96 dcl 1 local_sc_info aligned like sc_info;
97 dcl 1 local_vtoce aligned like vtoce;
98 dcl 1 msk aligned like vtoce_pc_sws;
99 dcl mxl fixed bin (9);
100 dcl mxl_bits bit (9);
101 dcl ncd fixed bin;
102 dcl need_vtoce bit (1) aligned;
103 dcl nid fixed bin;
104 dcl priv_sw bit (1) aligned;
105 dcl pvid bit (36) aligned;
106 dcl pvtx fixed bin;
107 dcl qt fixed bin;
108 dcl qtype fixed bin;
109 dcl sudelta fixed bin (34);
110 dcl 1 sws aligned like vtoce_pc_sws;
111 dcl uid bit (36) aligned;
112 dcl update bit (1) aligned;
113 dcl volid (3) bit (36) aligned;
114 dcl vtocx fixed bin;
115
116
117
118 dcl ALL_PARTS bit (3) int static options (constant) init ("111"b);
119
120
121
122 dcl 1 Quota_Cell aligned like quota_cell based (Qcp);
123 dcl 1 Salv_Update_Info aligned like salv_update_info based (Salv_Updatep);
124 dcl 1 Sc_Info aligned like sc_info based (Scip);
125
126
127
128 dcl error_table_$dm_not_enabled
129 fixed bin (35) external;
130 dcl error_table_$invalid_max_length
131 fixed bin (35) external;
132 dcl error_table_$vtoce_connection_fail
133 fixed bin (35) external;
134 dcl sst$dm_enabled bit (1) aligned external;
135
136
137
138 dcl dbm_man$set_incr entry (fixed bin, fixed bin, fixed bin (35));
139 dcl deactivate entry (ptr, fixed bin (35));
140 dcl get_pvtx entry (bit (36) aligned, fixed bin (35)) returns (fixed bin);
141 dcl lock$lock_ast entry;
142 dcl lock$unlock_ast entry;
143 dcl quotaw$cu entry (ptr, fixed bin (34), bit (1) aligned, fixed bin (2), fixed bin (35));
144 dcl pc$update_incore_fms
145 entry (ptr);
146 dcl search_ast$check entry (bit (36) aligned, bit (36) aligned, fixed bin, fixed bin (35)) returns (ptr);
147 dcl setfaults entry (ptr, bit (1) aligned);
148 dcl vtoc_man$get_vtoce entry (bit (36) aligned, fixed bin, fixed bin, bit (3), ptr, fixed bin (35));
149 dcl vtoc_man$put_vtoce entry (bit (36) aligned, fixed bin, fixed bin, bit (3), ptr, fixed bin (35));
150
151
152
153 dcl addr builtin;
154 dcl bit builtin;
155 dcl clock builtin;
156 dcl fixed builtin;
157 dcl null builtin;
158 dcl string builtin;
159 dcl unspec builtin;
160 %page;
161
162
163
164 dtu = Dtu;
165 dtm = Dtm;
166
167 call SETUP (Code);
168 if Code ^= 0
169 then return;
170
171 update = "1"b;
172 add_to_dumper = "1"b;
173
174 call GET_ASTE_VTOCE (code);
175 if code = 0
176 then do;
177 call UPDATE_ACTIVE_DT;
178 if dtu ^= ""b
179 then aste.dtu = dtu;
180 if dtm ^= ""b
181 then aste.dtm = dtm;
182 end;
183
184 call FINISH (code);
185
186 Code = code;
187
188 return;
189 %page;
190
191
192
193
194 set_max_lth:
195 entry (Uid, Pvid, Vtocx, Mxl, Priv_Sw, Code);
196
197 mxl = Mxl;
198 mxl_bits = bit (mxl, 9);
199 priv_sw = Priv_Sw;
200
201 call SETUP (Code);
202 if Code ^= 0
203 then return;
204
205 call GET_ASTE_VTOCE (code);
206 if code = 0
207 then do;
208 if ^priv_sw
209 then if mxl_bits < aste.csl
210 then code = error_table_$invalid_max_length;
211 end;
212 if code = 0
213 then if aste.msl ^= mxl_bits
214 then do;
215 update = "1"b;
216 add_to_dumper = "1"b;
217 if active & (mxl_bits < aste.msl)
218 then call setfaults (astep, "0"b);
219 aste.msl = mxl_bits;
220 end;
221
222 call FINISH (code);
223
224 Code = code;
225
226 return;
227 %page;
228
229
230
231 get_info:
232 entry (Uid, Pvid, Vtocx, Scip, Code);
233
234 call SETUP (Code);
235 if Code ^= 0
236 then return;
237
238 unspec (local_sc_info) = ""b;
239
240 call GET_ASTE_VTOCE (code);
241 if code = 0
242 then do;
243 call UPDATE_ACTIVE_DT;
244 local_sc_info.dtu = aste.dtu;
245 local_sc_info.dtm = aste.dtm;
246 local_sc_info.records = fixed (aste.records, 9);
247 local_sc_info.msl = fixed (aste.msl, 9) * 1024;
248 local_sc_info.csl = fixed (aste.csl, 9) * 1024;
249 local_sc_info.dnzp = aste.dnzp;
250 local_sc_info.damaged = aste.damaged;
251 local_sc_info.synchronized = aste.synchronized;
252 if aste.dirsw
253 then local_sc_info.pf_count = 0;
254 else local_sc_info.pf_count = seg_aste.usage;
255
256 local_sc_info.nid = "0"b;
257 local_sc_info.ncd = "0"b;
258 local_sc_info.vol_dtd = ""b;
259 local_sc_info.volid (*) = ""b;
260
261 if aste.dirsw
262 then do qt = 0, 1;
263 local_sc_info.qcell (qt).quota = aste.quota (qt);
264 local_sc_info.qcell (qt).used = aste.used (qt);
265 local_sc_info.qcell (qt).terminal_quota_sw = aste.tqsw (qt);
266 local_sc_info.qcell (qt).received = 0;
267 local_sc_info.qcell (qt).tup = ""b;
268 local_sc_info.qcell (qt).trp = 0;
269 end;
270 end;
271
272 call FINISH (code);
273
274 if code = 0
275 then Sc_Info = local_sc_info;
276 else unspec (Sc_Info) = ""b;
277
278 Code = code;
279
280 return;
281 %page;
282
283
284 get_quota:
285 entry (Uid, Pvid, Vtocx, Qcp, Qtype, Code);
286
287 qtype = Qtype;
288
289 call SETUP (Code);
290 if Code ^= 0
291 then return;
292
293 need_vtoce = "1"b;
294 unspec (local_quota_cell) = ""b;
295
296 call GET_ASTE_VTOCE (code);
297 if code = 0
298 then do;
299 local_quota_cell.quota = aste.quota (qtype);
300 local_quota_cell.used = aste.used (qtype);
301 local_quota_cell.terminal_quota_sw = aste.tqsw (qtype);
302 local_quota_cell.received = vtoce.received (qtype);
303 local_quota_cell.tup = vtoce.trp_time (qtype);
304 local_quota_cell.trp = vtoce.trp (qtype);
305 end;
306
307 call FINISH (code);
308
309 if code = 0
310 then Quota_Cell = local_quota_cell;
311 else unspec (Quota_Cell) = ""b;
312
313 Code = code;
314
315 return;
316 %page;
317
318
319
320
321
322
323 set_quota:
324 entry (Uid, Pvid, Vtocx, Qcp, Qtype, Code);
325
326 qtype = Qtype;
327 local_quota_cell = Quota_Cell;
328
329 call SETUP (Code);
330 if Code ^= 0
331 then return;
332
333 need_vtoce = "1"b;
334 update = "1"b;
335 add_to_dumper = "1"b;
336
337 call GET_ASTE_VTOCE (code);
338 if code = 0
339 then do;
340 if ^active
341 then do;
342 aste.quota (qtype) = local_quota_cell.quota;
343 aste.used (qtype) = local_quota_cell.used;
344 end;
345 vtoce.received (qtype) = local_quota_cell.received;
346 vtoce.trp_time (qtype) = local_quota_cell.tup;
347 vtoce.trp (qtype) = local_quota_cell.trp;
348 end;
349
350 call FINISH (code);
351
352 Code = code;
353
354 return;
355 %page;
356
357
358 reloading:
359 entry (Uid, Pvid, Vtocx, Dtu, Dtm, Mxl, Code);
360
361 dtu = Dtu;
362 dtm = Dtm;
363 mxl = Mxl;
364 mxl_bits = bit (mxl, 9);
365
366 call SETUP (Code);
367 if Code ^= 0
368 then return;
369
370 update = "1"b;
371 add_to_dumper = "1"b;
372
373 call GET_ASTE_VTOCE (code);
374 if code = 0
375 then do;
376 if dtu ^= ""b
377 then aste.dtu = dtu;
378 if dtm ^= ""b
379 then aste.dtm = dtm;
380 if (mxl >= 0) & (mxl_bits ^= aste.msl)
381 then do;
382 if active & (mxl_bits < aste.msl)
383 then call setfaults (astep, "0"b);
384 aste.msl = mxl_bits;
385 end;
386 end;
387
388 call FINISH (code);
389
390 Code = code;
391
392 return;
393 %page;
394
395
396 set_pc_switches:
397 entry (Uid, Pvid, Vtocx, Sws, Msk, Code);
398
399 string (sws) = Sws;
400 string (msk) = Msk;
401
402 if msk.synchronized & sws.synchronized
403 then if ^sst$dm_enabled
404 then do;
405 Code = error_table_$dm_not_enabled;
406 return;
407 end;
408
409 call SETUP (Code);
410 if Code ^= 0
411 then return;
412
413 update = "1"b;
414 add_to_dumper = "1"b;
415
416 RETRY_SET:
417 call GET_ASTE_VTOCE (code);
418 if (code = 0) & active
419 then if (msk.synchronized & ^aste.synchronized)
420 then do;
421 call deactivate (astep, code);
422 if code = 0
423 then do;
424 call lock$unlock_ast;
425 ast_is_locked = "0"b;
426 active = "0"b;
427 goto RETRY_SET;
428 end;
429 end;
430 if code = 0
431 then do;
432 if msk.dnzp
433 then aste.dnzp = sws.dnzp;
434 if msk.damaged
435 then aste.damaged = sws.damaged;
436 if msk.synchronized
437 then aste.synchronized = sws.synchronized;
438 end;
439
440 call FINISH (code);
441
442 Code = code;
443
444 return;
445 %page;
446
447
448
449 set_dump_switches:
450 entry (Uid, Pvid, Vtocx, Nid, Ncd, Code);
451
452 nid = Nid;
453 ncd = Ncd;
454
455 call SETUP (Code);
456 if Code ^= 0
457 then return;
458
459 update = "1"b;
460 need_vtoce = "1"b;
461 add_to_dumper = "1"b;
462
463 call GET_ASTE_VTOCE (code);
464 if code = 0
465 then do;
466 aste.nid = (aste.nid & (nid = 0)) | (nid > 0);
467 vtoce.ncd = (vtoce.ncd & (ncd = 0)) | (ncd > 0);
468 end;
469
470 call FINISH (code);
471
472 return;
473 %page;
474
475
476 set_dump_info:
477 entry (Uid, Pvid, Vtocx, Dtd, Volid, Code);
478
479 dtd = Dtd;
480 volid (*) = Volid (*);
481
482 call SETUP (Code);
483 if Code ^= 0
484 then return;
485
486 update = "1"b;
487 need_vtoce = "1"b;
488 add_to_dumper = "1"b;
489
490 call GET_ASTE_VTOCE (code);
491 if code = 0
492 then do;
493 vtoce.dtd = dtd;
494 vtoce.volid (*) = volid (*);
495 end;
496
497 call FINISH (code);
498
499 Code = code;
500
501 return;
502 %page;
503
504
505 get_dump_info:
506 entry (Uid, Pvid, Vtocx, Dtd, Volid, Code);
507
508 call SETUP (Code);
509 if Code ^= 0
510 then return;
511
512 need_vtoce = "1"b;
513
514 call GET_ASTE_VTOCE (code);
515 if code = 0
516 then do;
517 dtd = vtoce.dtd;
518 volid (*) = vtoce.volid (*);
519 end;
520
521 call FINISH (code);
522
523 if code = 0
524 then do;
525 Dtd = dtd;
526 Volid (*) = volid (*);
527 end;
528
529 Code = code;
530
531 return;
532 %page;
533
534
535 correct_qused:
536 entry (Uid, Pvid, Vtocx, Sudelta, Dudelta, Code);
537
538 sudelta = Sudelta;
539 dudelta = Dudelta;
540 code1 = 0;
541
542 call SETUP (Code);
543 if Code ^= 0
544 then return;
545
546 update = "1"b;
547 add_to_dumper = "1"b;
548
549 call GET_ASTE_VTOCE (code);
550 if code = 0
551 then do;
552 if active
553 then do;
554 if sudelta ^= 0
555 then call quotaw$cu (astep, sudelta, "0"b, 2, code1);
556 if dudelta ^= 0
557 then call quotaw$cu (astep, dudelta, "1"b, 2, code1);
558 end;
559 else do;
560 aste.used (0) = aste.used (0) + sudelta;
561 aste.used (1) = aste.used (1) + dudelta;
562 end;
563 end;
564
565 if code = 0
566 then code = code1;
567
568 call FINISH (code);
569
570 Code = code;
571
572 return;
573 %page;
574
575
576
577 salv_update:
578 entry (Uid, Pvid, Vtocx, Salv_Updatep, Code);
579
580 local_salv_update_info = Salv_Update_Info;
581
582 call SETUP (Code);
583 if Code ^= 0
584 then return;
585
586 need_vtoce = local_salv_update_info.set_uid_path | local_salv_update_info.set_primary_name;
587 update = "1"b;
588
589 call GET_ASTE_VTOCE (code);
590 if code = 0
591 then do;
592 if local_salv_update_info.set_master_dir
593 then aste.master_dir = local_salv_update_info.master_dir;
594 if local_salv_update_info.set_primary_name
595 then vtoce.primary_name = local_salv_update_info.primary_name;
596 if local_salv_update_info.set_uid_path
597 then vtoce.uid_path = local_salv_update_info.uid_path;
598 end;
599
600 call FINISH (code);
601
602 Code = code;
603
604 return;
605 %page;
606
607
608 get_dump_switches:
609 entry (Uid, Pvid, Vtocx, Nid, Ncd, Code);
610
611 nid, ncd = 0;
612
613 call SETUP (Code);
614 if Code ^= 0
615 then return;
616
617 need_vtoce = "1"b;
618
619 call GET_ASTE_VTOCE (code);
620 if code = 0
621 then do;
622 if aste.nid
623 then nid = 1;
624 else nid = -1;
625 if vtoce.ncd
626 then ncd = 1;
627 else ncd = -1;
628 end;
629
630 call FINISH (code);
631
632 if code = 0
633 then do;
634 Nid = nid;
635 Ncd = ncd;
636 end;
637
638 Code = code;
639
640 return;
641
642
643 %page;
644
645
646
647
648 SETUP:
649 proc (Code);
650
651 dcl Code fixed bin (35) parameter;
652
653 Code = 0;
654 ast_is_locked = "0"b;
655 active = "0"b;
656 need_vtoce = "0"b;
657 update = "0"b;
658 add_to_dumper = "0"b;
659 uid = Uid;
660 pvid = Pvid;
661 vtocx = Vtocx;
662 vtocep = addr (local_vtoce);
663 pvtx = get_pvtx (pvid, Code);
664
665 end SETUP;
666 %page;
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698 GET_ASTE_VTOCE:
699 proc (Code);
700
701 dcl Code fixed bin (35) parameter;
702
703 dcl vtoce_read bit (1) aligned;
704
705
706 Code = 0;
707 vtoce_read = "0"b;
708 unspec (vtoce) = ""b;
709
710 if need_vtoce
711 then do;
712 call vtoc_man$get_vtoce (""b, pvtx, vtocx, ALL_PARTS, vtocep, Code);
713 if Code ^= 0
714 then return;
715 vtoce_read = "1"b;
716 end;
717
718 call lock$lock_ast;
719 ast_is_locked = "1"b;
720 astep = search_ast$check (uid, pvid, vtocx, Code);
721 if Code ^= 0
722 then do;
723 call lock$unlock_ast;
724 ast_is_locked = "0"b;
725 return;
726 end;
727
728
729 if astep = null () & ^vtoce_read
730 then do;
731 call lock$unlock_ast;
732 ast_is_locked = "0"b;
733 call vtoc_man$get_vtoce (""b, pvtx, vtocx, ALL_PARTS, vtocep, Code);
734 if Code ^= 0
735 then return;
736 vtoce_read = "1"b;
737 call lock$lock_ast;
738 ast_is_locked = "1"b;
739 astep = search_ast$check (uid, pvid, vtocx, Code);
740 if Code ^= 0
741 then do;
742 call lock$unlock_ast;
743 ast_is_locked = "0"b;
744 return;
745 end;
746 end;
747
748 if (astep = null ()) | need_vtoce
749 then do;
750 call vtoc_man$get_vtoce (""b, pvtx, vtocx, ALL_PARTS, vtocep, Code);
751 if Code ^= 0
752 then do;
753 VTOCE_ERROR:
754 call lock$unlock_ast;
755 ast_is_locked = "0"b;
756 return;
757 end;
758 if vtoce.uid ^= uid
759 then do;
760 Code = error_table_$vtoce_connection_fail;
761 goto VTOCE_ERROR;
762 end;
763 end;
764
765 if astep ^= null ()
766 then active = "1"b;
767 else do;
768 astep = addr (local_aste);
769 call VTOCE_TO_ASTE;
770 end;
771
772
773 end GET_ASTE_VTOCE;
774 %page;
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790 FINISH:
791 proc (Code);
792
793 dcl Code fixed bin (35) parameter;
794
795
796 dcl code fixed bin (35);
797 dcl code1 fixed bin (35);
798
799
800 code, code1 = 0;
801
802 if ^active & update & (astep ^= null ())
803 then call ASTE_TO_VTOCE;
804
805 if add_to_dumper & (Code = 0)
806 then if ^vtoce.nid & ^vtoce.per_process & ^vtoce.deciduous & ^vtoce.per_bootload
807 then call dbm_man$set_incr (pvtx, vtocx, code);
808
809 if update & (Code = 0)
810 then if ^active | need_vtoce
811 then call vtoc_man$put_vtoce (""b, pvtx, vtocx, ALL_PARTS, vtocep, code1);
812
813 if ast_is_locked
814 then call lock$unlock_ast;
815 ast_is_locked = "0"b;
816
817 if Code = 0
818 then if code ^= 0
819 then Code = code;
820 else Code = code1;
821
822 end FINISH;
823 %page;
824
825
826 ASTE_TO_VTOCE:
827 proc;
828
829 dcl i fixed bin;
830
831
832 vtoce.msl = aste.msl;
833 vtoce.csl = aste.csl;
834 vtoce.dtu = aste.dtu;
835 vtoce.dtm = aste.dtm;
836 vtoce.nqsw = aste.nqsw;
837 vtoce.deciduous = aste.hc_sdw;
838 vtoce.damaged = aste.damaged;
839 vtoce.synchronized = aste.synchronized;
840 vtoce.dnzp = aste.dnzp;
841 vtoce.nid = aste.nid;
842 vtoce.dirsw = aste.dirsw;
843
844 if aste.dirsw
845 then do;
846 vtoce.master_dir = aste.master_dir;
847 do i = 0, 1;
848 vtoce.used (i) = aste.used (i);
849 vtoce.quota (i) = aste.quota (i);
850 end;
851 end;
852
853 end ASTE_TO_VTOCE;
854 %page;
855
856
857 VTOCE_TO_ASTE:
858 proc;
859
860 dcl i fixed bin;
861
862
863 unspec (aste) = ""b;
864
865 aste.uid = vtoce.uid;
866 aste.msl = vtoce.msl;
867 aste.csl = vtoce.csl;
868 aste.records = vtoce.records;
869 aste.dtu = vtoce.dtu;
870 aste.dtm = vtoce.dtm;
871 aste.nqsw = vtoce.nqsw;
872 aste.hc_sdw = vtoce.deciduous;
873 aste.per_process = vtoce.per_process;
874 aste.damaged = vtoce.damaged;
875 aste.synchronized = vtoce.synchronized;
876 aste.dnzp = vtoce.dnzp;
877 aste.nid = vtoce.nid;
878 aste.dirsw = vtoce.dirsw;
879 aste.pvtx = pvtx;
880 aste.vtocx = vtocx;
881
882 if aste.dirsw
883 then do;
884 aste.master_dir = vtoce.master_dir;
885 do i = 0, 1;
886 aste.quota (i) = vtoce.quota (i);
887 aste.used (i) = vtoce.used (i);
888 end;
889 aste.tqsw (0) = (vtoce.received (0) ^= 0) | aste.master_dir;
890 aste.tqsw (1) = (vtoce.received (1) ^= 0);
891 end;
892 else seg_aste.usage = seg_vtoce.usage;
893
894 end VTOCE_TO_ASTE;
895 %page;
896
897
898 UPDATE_ACTIVE_DT:
899 proc;
900
901 curtime = clock ();
902
903 if (aste.np ^= ""b)
904 then call pc$update_incore_fms (astep);
905 if aste.fms
906 then do;
907 add_to_dumper = "1"b;
908 aste.fms = "0"b;
909 end;
910 if ^aste.gtus
911 then if ((aste.np ^= ""b) | (aste.infp ^= ""b))
912 then aste.dtu = bit (fixed (curtime, 52), 52);
913
914
915 end UPDATE_ACTIVE_DT;
916
917
918
919 %page; %include aste;
920 %page; %include quota_cell;
921 %page; %include sc_info;
922 %page; %include vtoce;
923 %page; %include vtoce_pc_sws;
924 %page; %include vtoce_salv_update;
925
926 end vtoc_attributes$set_dates;