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 salvager:
26 procedure;
27
28 dcl arg_salv_opt_bits bit (36) aligned parameter;
29 dcl arg_code fixed bin (35) parameter;
30 dcl a_info_p ptr parameter;
31 dcl a_pvtx fixed bin parameter;
32 dcl a_path char (*) parameter;
33
34 dcl ec fixed bin (35);
35 dcl start_time fixed bin (71);
36 dcl i fixed bin;
37 dcl update_vtoce bit (1) aligned;
38 dcl delete_connection_failure_flag bit (1) aligned;
39 dcl rebuild bit (1) aligned;
40 dcl salv_info_p ptr;
41
42 dcl 1 salv_info aligned like salv_args;
43 dcl (addr, fixed, ptr, bit, hbound, rel, null, divide, unspec, rtrim) builtin;
44
45
46
47 dcl salv_temp_dir$ ext;
48 dcl salv_dir_space$ ext;
49
50 dcl find entry (char (4) aligned, ptr);
51 dcl salvage_pv entry (fixed bin, fixed bin (35));
52 dcl salvage_pv$convert_vtoc entry (fixed bin, fixed bin (35));
53 dcl salv_directory$ring0_salvage entry (ptr, fixed bin (35));
54 dcl syserr entry options (variable);
55 dcl syserr$error_code entry options (variable);
56 %page;
57 volume_salvage:
58 entry (a_pvtx, arg_salv_opt_bits, arg_code);
59
60 salv_opt_bits = arg_salv_opt_bits;
61 call set_salv_data (salv_opt_bits);
62 call salvage_pv (a_pvtx, arg_code);
63 return;
64
65
66 convert_vtoc:
67 entry (a_pvtx, arg_salv_opt_bits, arg_code);
68
69 salv_opt_bits = arg_salv_opt_bits;
70 call set_salv_data (salv_opt_bits);
71 call salvage_pv$convert_vtoc (a_pvtx, arg_code);
72
73
74 set_options:
75 entry (arg_salv_opt_bits);
76
77 salv_opt_bits = arg_salv_opt_bits;
78 call set_salv_data (salv_opt_bits);
79 return;
80
81
82 online:
83 entry (a_info_p);
84
85 call set_salv_data ("0"b);
86 call setup_args (a_info_p);
87
88 salv_data$on_line = "1"b;
89 return;
90
91
92 dir_salv_boot:
93 entry (a_path);
94
95 call set_salv_data ("0"b);
96 salv_data$rpv = "1"b;
97 call setup_args (addr (salv_info));
98 salv_info.pathname = a_path;
99 salv_info.options.check_vtoce = "1"b;
100 salv_info.options.delete_connection_failure = "1"b;
101 call salv_directory$ring0_salvage (addr (salv_info), ec);
102 if ec ^= 0 then call syserr$error_code (3, ec, "salvager: Error salvaging ^a.", salv_info.pathname);
103 salv_data$rpv = "0"b;
104 return;
105 %page;
106 set_salv_data:
107 procedure (options_bit);
108
109 dcl options_bit bit (36) aligned;
110 dcl 1 options aligned like salv_opts based (addr (options_bit));
111
112 dcl dump_bad_dir bit (1) aligned;
113 dcl print_pathnames bit (1) aligned;
114 dcl debug bit (1) aligned;
115
116
117
118 debug, dump_bad_dir, print_pathnames, rebuild, update_vtoce, delete_connection_failure_flag = "0"b;
119
120
121
122 salv_cardp = null ();
123 call find ("salv", salv_cardp);
124 if salv_cardp ^= null () then do;
125 do i = 1 to salv_card.n_fields;
126 if salv_card.options (i) = "debg" then debug = "1"b;
127 else if salv_card.options (i) = "dump" then dump_bad_dir = "1"b;
128 else if salv_card.options (i) = "rbld" then rebuild = "1"b;
129 else if salv_card.options (i) = "dcf" then delete_connection_failure_flag = "1"b;
130 else if salv_card.options (i) = "path" then print_pathnames = "1"b;
131 end;
132 end;
133
134
135
136 if options_bit ^= "0"b then do;
137 if options.debug then debug = "1"b;
138 if options.ndebug then debug = "0"b;
139 if options.dump then dump_bad_dir = "1"b;
140 if options.ndump then dump_bad_dir = "0"b;
141 if options.pnames then print_pathnames = "1"b;
142 if options.npnames then print_pathnames = "0"b;
143 if options.rbld then rebuild = "1"b;
144 if options.nrbld then rebuild = "0"b;
145 if options.dcf then delete_connection_failure_flag = "1"b;
146 if options.ndcf then delete_connection_failure_flag = "0"b;
147 update_vtoce = options.check | options.dcf;
148 end;
149
150
151
152 salv_data$on_line = "0"b;
153 salv_data$dump = dump_bad_dir;
154 salv_data$debug = debug;
155 salv_data$print_path = print_pathnames;
156
157 return;
158
159 end set_salv_data;
160 %page;
161 setup_args:
162 procedure (salv_p);
163
164 dcl salv_p ptr;
165 dcl 1 args aligned like salv_args based (salv_p);
166
167 args.salv_time = bit (binary (clock (), 52));
168 args.force_rebuild = rebuild;
169 args.check_vtoce = update_vtoce;
170 args.delete_connection_failure = delete_connection_failure_flag;
171 args.print_trace = salv_data$debug;
172 args.dump = salv_data$dump;
173 args.correct_oosw = "1"b;
174 args.temp1_ptr = addr (salv_temp_dir$);
175 args.temp2_ptr = addr (salv_dir_space$);
176 return;
177 end setup_args;
178 %page;
179 %include config_salv_card;
180 %include salv_args;
181 %include salv_data;
182 %include salv_options;
183 %page;
184
185
186
187
188 end salvager;