1 /****^  ***********************************************************
  2         *                                                         *
  3         * Copyright, (C) Honeywell Bull Inc., 1988                *
  4         *                                                         *
  5         * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  6         *                                                         *
  7         * Copyright (c) 1972 by Massachusetts Institute of        *
  8         * Technology and Honeywell Information Systems, Inc.      *
  9         *                                                         *
 10         *********************************************************** */
 11 
 12 
 13 
 14 /****^  HISTORY COMMENTS:
 15   1) change(88-05-01,Parisek), approve(88-05-27,MCR7907),
 16      audit(88-06-02,Fawcett), install(88-09-27,MR12.2-1122):
 17      Changed to NOT set pc_vacating in the pvte. This flag would inhibit any
 18      new pages being withdrawed from this pv. The concept of inhibit is to
 19      inhibit any new segments. If pc_vacating is set and a segment like the
 20      kst needs one more page, the system loop trying to get a page on the pv.
 21      The kst cannot be moved.
 22                                                    END HISTORY COMMENTS */
 23 
 24 
 25 /* format: style4,indattr,ifthenstmt,ifthen,idind35,^indcomtxt */
 26 
 27 vacate_pv: proc (a_pvtx, a_pvid, a_code);
 28 
 29 
 30 /* vacate_pv     Bernard Greenberg 05/24/76
 31 
 32    Procedure to segmove all of the segments on a given physical volume.
 33    Must be driven by pathname from outer ring. */
 34 
 35 /* modified 4/77 by M. Weaver to change calling sequences to makeknown_ and terminate_ */
 36 /* Modified March 1982, J. Bongiovanni, for new PVTE, demand_segmove */
 37 /* Modified 84-10-17, BIM, TEMPORARILY set pvte.pc_vacating */
 38 /* Modified July 1984 by Keith Loepere to use the new dc_find. */
 39 /* Modified November 1984 by Keith Loepere for auditing. */
 40 
 41 /* Parameters */
 42 
 43 dcl  a_code                             fixed bin (35);
 44 dcl  a_dirname                          char (*);
 45 dcl  a_ename                            char (*);
 46 dcl  a_pvid                             bit (36) aligned;
 47 dcl  a_pvtx                             fixed bin;
 48 dcl  a_segptr                           ptr;
 49 
 50 /* External */
 51 
 52 dcl  error_table_$argerr                fixed bin (35) ext;
 53 dcl  error_table_$bad_index             fixed bin (33) ext;
 54 dcl  error_table_$segknown              fixed bin (35) ext;
 55 dcl  pvt$n_entries                      fixed bin ext;
 56 
 57 /* Variables */
 58 
 59 dcl  called_find                        bit (1) aligned init ("0"b);
 60 dcl  code                               fixed bin (35);
 61 dcl  dir                                char (168);
 62 dcl  dp                                 ptr;
 63 dcl  ent                                char (32);
 64 dcl  1 mkinf                            aligned like makeknown_info;
 65 dcl  pvid                               bit (36) aligned;
 66 dcl  pvtx                               fixed bin;
 67 dcl  segno                              fixed bin;
 68 dcl  segptr                             ptr;
 69 
 70 /* Entries */
 71 
 72 dcl  activate                           entry (ptr, fixed bin (35)) returns (ptr);
 73 dcl  lock$dir_unlock                    entry (ptr);
 74 dcl  makeknown_                         entry (ptr, fixed bin, fixed bin, fixed bin (35));
 75 dcl  makeunknown_                       entry (fixed bin, bit (36) aligned, bit (1) aligned, fixed bin (35));
 76 dcl  segment_mover$demand_segmove       entry (ptr, ptr, fixed bin, fixed bin (35));
 77 
 78 /* Misc */
 79 
 80 dcl  (addr, ptr, unspec)                builtin;
 81 %page;
 82 
 83 /* These entries are not protected by any form of lock. It is assumed that the
 84    caller is cooperating with the demounter in the setting of these bits. */
 85           pvtx = a_pvtx;
 86           pvt_arrayp = addr (pvt$array);
 87           pvid = a_pvid;
 88           code = 0;
 89           if pvtx <= 0 | pvtx > pvt$n_entries then do;
 90                a_code = error_table_$bad_index;
 91                return;
 92           end;
 93           pvtep = addr (pvt_array (pvtx));                  /* Address pvte */
 94 
 95           if pvte.being_demounted | (pvte.pvid ^= pvid) then
 96                code = error_table_$argerr;
 97           else if pvte.storage_system & pvte.used & pvid = pvte.pvid then
 98                pvte.vacating = "1"b;
 99           else code = error_table_$argerr;
100 
101           a_code = code;
102           return;
103 
104 stop_vacate: entry (a_pvtx, a_pvid, a_code);
105 
106           pvt_arrayp = addr (pvt$array);
107           pvid = a_pvid;
108           pvtx = a_pvtx;
109           code = 0;
110           if pvtx <= 0 | pvtx > pvt$n_entries then do;
111                a_code = error_table_$bad_index;
112                return;
113           end;
114           pvtep = addr (pvt_array (pvtx));
115           if pvte.used & pvte.storage_system & pvte.vacating & (pvte.pvid = pvid) then
116                pvte.vacating = "0"b;
117           else code = error_table_$argerr;
118           a_code = code;
119           return;
120 %page;
121 move_seg_file: entry (a_dirname, a_ename, a_code);
122 
123 /* This entry starts a segmove on a seg given the name */
124 
125           dir = a_dirname;
126           ent = a_ename;
127           code = 0;
128 
129           call dc_find$obj_status_write_priv (dir, ent, DC_FIND_CHASE, FS_OBJ_SEG_MOVE, ep, code);
130           if code ^= 0 then go to finale;
131           called_find = "1"b;
132           go to join;                                       /* Merge with seg entry */
133 
134 move_seg_seg: entry (a_segptr, a_code);
135 
136           segptr = a_segptr;
137           code = 0;
138           call dc_find$obj_status_write_priv_ptr (segptr, FS_OBJ_SEG_MOVE, ep, code);
139           if code ^= 0 then go to finale;
140 
141 join:     dp = ptr (ep, 0);
142 
143           makeknown_infop = addr (mkinf);                   /* Get local makeknown info */
144           unspec (makeknown_info) = ""b;                    /* Clear all things we don't know about */
145           makeknown_info.uid = entry.uid;
146           makeknown_info.dirsw = entry.dirsw;
147           makeknown_info.entryp = ep;                       /* Set up for makeknown */
148           call makeknown_ (makeknown_infop, segno, (0), code);
149           if code = 0 | code = error_table_$segknown then do;
150                astep = activate (ep, code);
151                                                             /* Get AST entry */
152                if code = 0 then do;
153                     aste.pack_ovfl = "1"b;                  /* Cause seg mover to do thing */
154                     call segment_mover$demand_segmove (astep, ep, segno, code);
155                end;
156                call makeunknown_ (segno, "0"b, ("0"b), (0));
157           end;
158           if called_find then call dc_find$finished (dp, "1"b);
159           else call lock$dir_unlock (dp);
160 finale:   a_code = code;
161           return;
162 %page; %include aste;
163 %page; %include dc_find_dcls;
164 %page; %include dir_entry;
165 %page; %include fs_obj_access_codes;
166 %page; %include makeknown_info;
167 %page; %include pvte;
168      end;