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
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 %page;
56 delete_vtoce: procedure (branchp, code);
57
58
59 dcl branchp ptr;
60 dcl code fixed bin (35);
61
62 dcl uid bit (36) aligned;
63 dcl pvid bit (36) aligned;
64 dcl (i, pvtx, vtocx) fixed bin (17);
65 dcl n_deposit_pages fixed bin;
66 dcl 1 local_aste aligned like aste;
67 dcl 1 local_vtoce aligned like vtoce;
68 dcl deposit_list (0:255) bit (22) aligned;
69 dcl pageno_list (0:255) fixed bin aligned;
70
71 dcl null builtin;
72
73 dcl error_table_$vtoce_connection_fail external fixed bin (35);
74 dcl sst$checksum_filemap fixed bin (35) external;
75
76 dcl lock$lock_ast entry;
77 dcl lock$unlock_ast entry;
78 dcl search_ast$check entry (bit (36) aligned, bit (36) aligned, fixed bin, fixed bin (35)) returns (ptr);
79 dcl setfaults$if_active entry (bit (36) aligned, bit (36) aligned, fixed bin, bit (1) aligned);
80 dcl quotaw$mq entry (ptr, ptr, fixed bin, bit (1) aligned, fixed bin (35));
81 dcl vtoc_man$await_vtoce entry (bit (36) aligned, fixed bin, fixed bin, fixed bin (35));
82 dcl vtoc_man$free_vtoce entry (bit (36) aligned, fixed bin, fixed bin, fixed bin (35));
83 dcl get_pvtx entry (bit (36), fixed bin (35)) returns (fixed bin);
84 dcl get_pvtx$hold_pvtx entry (bit (36) aligned, fixed bin, fixed bin (35));
85 dcl get_pvtx$release_pvtx entry (bit (36) aligned, fixed bin);
86 dcl activate entry (ptr, fixed bin (35)) returns (ptr);
87 dcl deactivate$for_delete entry (ptr, fixed bin (35));
88 dcl pc$get_file_map entry (ptr, ptr, ptr, fixed bin, ptr, ptr);
89 dcl pc$deposit_list entry (fixed bin, fixed bin, ptr, fixed bin, ptr);
90 dcl truncate_vtoce$truncate_vtoce_delete entry (ptr, fixed bin (35));
91 dcl syserr$error_code entry options (variable);
92
93 dcl (error_table_$mylock, error_table_$root) fixed bin (35) external;
94
95 %page;
96 code = 0;
97 ep = branchp;
98
99 uid = entry.uid;
100 pvid = entry.pvid;
101 pvtx = get_pvtx (entry.pvid, code); if code ^= 0 then return;
102 vtocx = entry.vtocx;
103
104
105 call get_pvtx$hold_pvtx (pvid, pvtx, code);
106 if code ^= 0 then return;
107 call setfaults$if_active (uid, pvid, vtocx, "0"b);
108
109 call truncate_vtoce$truncate_vtoce_delete (ep, code);
110 if code ^= 0 then if code = error_table_$vtoce_connection_fail then do;
111 code = 0;
112 go to release;
113 end;
114 else go to release;
115
116 if entry.dirsw then call RETURN_QUOTA;
117
118 n_deposit_pages = 0;
119
120 call lock$lock_ast;
121
122 astep = search_ast$check (uid, pvid, vtocx, (0));
123 if astep ^= null then do;
124 if aste.dius then do;
125 call lock$unlock_ast;
126 astep = activate (ep, code);
127 if code ^= 0 then go to release;
128 end;
129 call pc$get_file_map (astep, addr (local_aste), addr (local_vtoce.fm), n_deposit_pages,
130 addr (deposit_list), addr (pageno_list));
131 if aste.fm_damaged & (sst$checksum_filemap ^= 0)
132 then n_deposit_pages = 0;
133 call deactivate$for_delete (astep, code);
134 end;
135
136 if code = 0 then
137 call vtoc_man$free_vtoce (pvid, pvtx, vtocx, code);
138
139 call lock$unlock_ast;
140 if code ^= 0 then go to release;
141
142 if n_deposit_pages > 0 then do;
143 call vtoc_man$await_vtoce (pvid, pvtx, vtocx, code);
144 if code = 0 then
145 call pc$deposit_list (pvtx, n_deposit_pages, addr (deposit_list),
146 vtocx, addr (pageno_list));
147 end;
148
149 release:
150 call get_pvtx$release_pvtx (pvid, pvtx);
151
152 return;
153
154
155
156 RETURN_QUOTA: procedure;
157
158 dcl qsw bit (1) init ("0"b);
159 dcl local_tpp (0:1) fixed bin (71) aligned;
160 dcl fixedoverflow condition;
161 dcl par_pvid bit (36) aligned;
162 dcl par_pvtx fixed bin;
163 dcl pep ptr;
164 dcl par_vtocx fixed bin (17);
165 dcl sumcode fixed bin (35);
166 dcl READ_LOCK bit (36) options (constant) static init ("000000000000"b3) aligned;
167
168
169 dcl sum$getbranch_root_my entry (ptr, bit (36) aligned, ptr, fixed bin (35));
170 dcl lock$dir_unlock entry (ptr);
171 dcl (vtoc_man$get_vtoce, vtoc_man$put_vtoce) entry (bit (36) aligned, fixed bin, fixed bin, bit (3), ptr,
172 fixed bin (35));
173
174 dcl 1 local_vtoce like vtoce aligned;
175
176 astep = activate (ep, code); if code ^= 0 then return;
177
178 do i = 0 to 1;
179 if (i = 0 & aste.tqsw (i) & ^aste.master_dir) |
180 (i = 1 & aste.tqsw (i)) then
181 do;
182 qsw = "1"b;
183 call quotaw$mq (ptr (astep, astep -> aste.par_astep), astep, -aste.quota (i),
184 bit (fixed (i, 1), 1), code);
185 if code ^= 0 then call syserr$error_code (4, code,
186 "delete_vtoce: from quotaw, pvid ^w, vtocx ^o", pvid, vtocx);
187 end;
188 end;
189
190 call lock$unlock_ast;
191
192 if ^qsw then return;
193
194
195
196 call vtoc_man$get_vtoce (pvid, pvtx, vtocx, "100"b, addr (local_vtoce), code);
197 if code ^= 0 then return;
198
199 local_tpp = local_vtoce.trp;
200 if local_tpp (0) = 0 & local_tpp (1) = 0 then return;
201
202
203 dp = ptr (ep, 0);
204 call sum$getbranch_root_my (dp, READ_LOCK, pep, sumcode);
205
206
207 if sumcode = 0 | sumcode = error_table_$root | sumcode = error_table_$mylock then do;
208 par_pvid = dir.pvid;
209 par_vtocx = dir.vtocx;
210 end;
211 else do;
212 code = sumcode;
213 go to tploss;
214 end;
215
216 call lock$lock_ast;
217
218 par_pvtx = get_pvtx ((par_pvid), code);
219 if code ^= 0 then go to tpploss1;
220
221 call vtoc_man$get_vtoce (par_pvid, par_pvtx, par_vtocx, "100"b, addr (local_vtoce), code);
222 if code ^= 0 then go to tpploss1;
223
224 on fixedoverflow go to tpploss1;
225 local_vtoce.trp = local_vtoce.trp + local_tpp;
226 revert fixedoverflow;
227
228 call vtoc_man$put_vtoce (par_pvid, par_pvtx, par_vtocx, "100"b, addr (local_vtoce), code);
229 tpploss1:
230 call lock$unlock_ast;
231 tploss:
232 if sumcode = 0 then call lock$dir_unlock (ptr (pep, 0));
233
234 if code ^= 0 then call syserr$error_code (4, code,
235 "delete_vtoce: cannot add time/page product (^d ^d) to pvid ^w vtocx ^o uid ^w.",
236 local_tpp, par_pvid, par_vtocx, dir.uid);
237
238 return;
239
240 end RETURN_QUOTA;
241
242
243 %page; %include aste;
244 %page; %include dir_header;
245 %page; %include dir_entry;
246 %page; %include vtoce;
247
248
249 %page;
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282 end delete_vtoce;