1 /****^  ***********************************************************
 2         *                                                         *
 3         * Copyright, (C) Honeywell Bull Inc., 1987                *
 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 /* format: style4,delnl,insnl,indattr,ifthen,dclind10 */
14 delete_key:
15      proc (p_journal_control_block_ptr, p_info_ptr, p_code);
16 
17 /* After doing the specified delete_key operation on the vfile, an entry is made
18    in the journal recording the key and descriptor.  Only the input_desc and input_key case is allowed.
19 
20    Written  by  Lindsey Spratt 08/06/79
21    Modified by Chris Jones 02/15/85 for privileges and clean up.
22 */
23 /* Parameter */
24 
25 
26 
27 dcl       p_journal_control_block_ptr
28                                  ptr;
29 dcl       p_info_ptr             ptr;
30 dcl       p_code                 fixed bin (35);
31 
32 /* Automatic */
33 
34 dcl       privileges_string      bit (36) aligned;
35 
36 /* Based */
37 /* Controlled */
38 /* Builtin */
39 
40 dcl       null                   builtin;
41 
42 dcl       cleanup                condition;
43 
44 /* Entry */
45 
46 dcl       iox_$control           entry (ptr, char (*), ptr, fixed bin (35));
47 dcl       rcprm_registry_util_$turn_off_privs
48                                  entry (bit (36) aligned);
49 dcl       rcprm_registry_util_$turn_on_privs
50                                  entry (bit (36) aligned);
51 
52 /* External */
53 
54 dcl       error_table_$locked_by_this_process
55                                  fixed bin (35) ext;
56 dcl       error_table_$bad_arg   fixed bin (35) ext;
57 ^L
58           ak_info_ptr = p_info_ptr;
59           journal_control_block_ptr = p_journal_control_block_ptr;
60           if ^ak_info.input_desc | ^ak_info.input_key then do;
61                p_code = error_table_$bad_arg;
62                return;
63           end;
64           privileges_string = ""b;
65           on cleanup call rcprm_registry_util_$turn_off_privs (privileges_string);
66 
67           call rcprm_registry_util_$turn_on_privs (privileges_string);
68 
69           call iox_$control (journal_control_block.vfile_iocb_ptr, "delete_key", ak_info_ptr, p_code);
70           if p_code ^= 0 & p_code ^= error_table_$locked_by_this_process then
71                return;
72 
73 
74           a_key_len = ak_info.key_len;
75           a_rec_len = 0;
76           alloc journal_entry in (journal_area);
77           journal_entry.key_str = ak_info.key;
78           journal_entry.descriptor = ak_info.descrip;
79           journal_entry.inc_ref_count = "0"b;
80           journal_entry.dec_ref_count = "0"b;
81           journal_entry.type = DELETE_KEY;
82           journal_entry.next_ptr = null;
83           journal_entry.prev_ptr = journal_control_block.latest_entry_ptr;
84           if journal_control_block.latest_entry_ptr ^= null then
85                journal_control_block.latest_entry_ptr -> journal_entry.next_ptr = journal_entry_ptr;
86           journal_control_block.latest_entry_ptr = journal_entry_ptr;
87           call rcprm_registry_util_$turn_off_privs (privileges_string);
88           return;
89 ^L
90 %include journal_entry;
91 %include journal_control_block;
92 %include ak_info;
93      end;                                                   /* end delete_key */