Print this page
5910 libnisdb won't build with modern GCC
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libnisdb/db_scheme_c.x
+++ new/usr/src/lib/libnisdb/db_scheme_c.x
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * db_scheme_c.x
24 24 *
25 + * Copyright 2015 Gary Mills
25 26 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
26 27 * Use is subject to license terms.
27 28 */
28 29
29 -%#pragma ident "%Z%%M% %I% %E% SMI"
30 +#if RPC_XDR
31 +%#include "ldap_xdr.h"
32 +#endif /* RPC_XDR */
30 33
31 34 #if RPC_HDR
32 35 %#ifndef _DB_SCHEMA_H
33 36 %#define _DB_SCHEMA_H
34 37
35 38 #ifdef USINGC
36 39 %#include "db_item_c.h"
37 40 %#include "db_entry_c.h"
38 41 #else
39 42 %#include "db_item.h"
40 43 %#include "db_entry.h"
41 44 #endif /* USINGC */
42 45
43 46 const DB_KEY_CASE = TA_CASE;
44 47
45 48 #endif /* RPC_HDR */
46 49 %
47 50 %#include "nisdb_rw.h"
48 51 %
49 52 %/* Positional information of where field starts within record
50 53 % and its maximum length in terms of bytes. */
51 54 struct db_posn_info {
52 55 short int start_column;
53 56 short int max_len;
54 57 };
55 58
56 59 %/* Description of a key */
57 60 struct db_key_desc {
58 61 item *key_name;
59 62 unsigned long key_flags; /* corresponds to tc_flags in table_col defn */
60 63 int column_number; /* column within data structure */
61 64 db_posn_info where; /* where within record entry is 'key' located */
62 65 short int store_type; /* ISAM or SS ? maybe useless */
63 66 };
64 67
65 68 %/* Description of the data field. */
66 69 struct db_data_desc {
67 70 db_posn_info where; /* where within record entry is 'data' located */
68 71 short int store_type; /* ISAM or SS ? maybe useless */
69 72 };
70 73
71 74 %/* A scheme is a description of the fields of a table. */
72 75
73 76 #if RPC_HDR || RPC_XDR
74 77 #ifdef USINGC
75 78
76 79 struct db_scheme {
77 80 db_key_desc keys<>;
78 81 short int max_columns; /* applies to data only ? */
79 82 db_data_desc data;
80 83 __nisdb_rwlock_t scheme_rwlock;
81 84 };
82 85
83 86 typedef struct db_scheme * db_scheme_p;
84 87 #endif /* USINGC */
85 88 #endif /* RPC_HDR */
86 89
87 90 #ifndef USINGC
88 91 #ifdef RPC_HDR
89 92 %
90 93 %class db_scheme {
91 94 % protected:
92 95 % struct {
93 96 % int keys_len;
94 97 % db_key_desc *keys_val;
95 98 % } keys;
96 99 % short int max_columns; /* applies to data only ? */
97 100 % db_data_desc data;
98 101 % STRUCTRWLOCK(scheme);
99 102 %
100 103 % public:
101 104 %/* Accessor: return number of keys in scheme. */
102 105 % int numkeys() { return keys.keys_len; }
103 106 %
104 107 %/* Accessor: return location of array of key_desc's. */
105 108 % db_key_desc* keyloc () { return keys.keys_val; }
106 109 %
107 110 %/* Constructor: create empty scheme */
108 111 % db_scheme() {
109 112 % keys.keys_len = 0;
110 113 % keys.keys_val = NULL;
111 114 % (void) __nisdb_rwinit(&scheme_rwlock);
112 115 % }
113 116 %
114 117 %/* Constructor: create new scheme by making copy of 'orig'.
115 118 % All items within old scheme are also copied (i.e. no shared pointers). */
116 119 % db_scheme( db_scheme* orig );
117 120 %
118 121 %/* Constructor: create new sheme by using information in 'zdesc'. */
119 122 % db_scheme( table_obj * );
120 123 %
121 124 %/* Destructor: delete all keys associated with scheme and scheme itself. */
122 125 % ~db_scheme();
123 126 %
124 127 %/* Free space occupied by columns. */
125 128 % void clear_columns( int );
126 129 %
127 130 %/* Predicate: return whether given string is one of the index names
128 131 % of this scheme. If so, return in 'result' the index's number. */
129 132 % bool_t find_index( char*, int* );
130 133 %
131 134 %/* Print out description of table. */
132 135 % void print();
133 136 %
134 137 %/* Size of the non-MT/LDAP portion of the db_scheme structure */
135 138 % ulong_t oldstructsize(void) {
136 139 % return ((ulong_t)&(this->scheme_rwlock) - (ulong_t)this);
137 140 % }
138 141 %
139 142 %/* Locking methods */
140 143 %
141 144 % int acqexcl(void) {
142 145 % return (WLOCK(scheme));
143 146 % }
144 147 %
145 148 % int relexcl(void) {
146 149 % return (WULOCK(scheme));
147 150 % }
148 151 %
149 152 % int acqnonexcl(void) {
150 153 % return (RLOCK(scheme));
151 154 % }
152 155 %
153 156 % int relnonexcl(void) {
154 157 % return (RULOCK(scheme));
155 158 % }
156 159 %};
157 160
158 161 %typedef class db_scheme * db_scheme_p;
159 162 #endif /* RPC_HDR */
160 163 #endif /* USINGC */
161 164
162 165 #if RPC_HDR
163 166 %#endif /* _DB_SCHEMA_H */
164 167
165 168 #endif /* RPC_HDR */
↓ open down ↓ |
126 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX