4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
24 * Copyright 2015 Gary Mills
28 * This is a non-recursive version of XDR routine used for db_index_entry
32 #include <sys/types.h>
33 #include <sys/syslog.h>
35 #include <rpc/types.h>
38 #include "db_index_entry_c.h"
39 #include "db_table_c.h"
40 #include "xdr_nullptr.h"
43 xdr_db_index_entry(xdrs
, objp
)
48 register db_index_entry
*ep
= objp
;
49 register db_index_entry
*loc
;
50 register db_index_entry
*freeptr
= NULL
;
53 if (!xdr_u_long(xdrs
, &ep
->hashval
))
55 if (!xdr_pointer(xdrs
, (char **)&ep
->key
, sizeof (item
),
56 (xdrproc_t
) xdr_item
))
58 if (!xdr_entryp(xdrs
, &ep
->location
))
60 if (!xdr_nullptr(xdrs
, &ep
->next_result
))
64 * The following code replaces the call to
68 * sizeof (db_index_entry),
69 * (xdrproc_t) xdr_db_index_entry))
71 * It's a modified version of xdr_refer.c from the rpc library:
72 * @(#)xdr_refer.c 1.8 92/07/20 SMI
77 * the following assignment to more_data is only useful when
78 * encoding and freeing. When decoding, more_data will be
79 * filled by the xdr_bool() routine.
81 more_data
= (ep
->next
!= NULL
);
82 if (! xdr_bool(xdrs
, &more_data
))
95 ep
->next
= loc
= (db_index_entry
*)
96 mem_alloc(sizeof (db_index_entry
));
99 "xdr_db_index_entry: mem_alloc failed");
102 memset(loc
, 0, sizeof (db_index_entry
));
106 if (freeptr
!= NULL
) {
107 mem_free(freeptr
, sizeof (db_index_entry
));
119 if ((freeptr
!= NULL
) && (xdrs
->x_op
== XDR_FREE
)) {
120 mem_free(freeptr
, sizeof (db_index_entry
));
128 xdr_db_index_entry_p(xdrs
, objp
)
130 db_index_entry_p
*objp
;
133 if (!xdr_pointer(xdrs
, (char **)objp
, sizeof (db_index_entry
),
134 (xdrproc_t
) xdr_db_index_entry
))
142 xdr_db_free_entry(xdrs
, objp
)
147 register db_free_entry
*ep
= objp
;
148 register db_free_entry
*loc
;
149 register db_free_entry
*freeptr
= NULL
;
152 if (!xdr_entryp(xdrs
, &ep
->where
))
156 * The following code replaces the call to
159 * (char **)&ep->next,
160 * sizeof (db_free_entry),
161 * (xdrproc_t) xdr_db_free_entry))
163 * It's a modified version of xdr_refer.c from the rpc library:
164 * @(#)xdr_refer.c 1.8 92/07/20 SMI
169 * the following assignment to more_data is only useful when
170 * encoding and freeing. When decoding, more_data will be
171 * filled by the xdr_bool() routine.
173 more_data
= (ep
->next
!= NULL
);
174 if (! xdr_bool(xdrs
, &more_data
))
184 switch (xdrs
->x_op
) {
187 ep
->next
= loc
= (db_free_entry
*)
188 mem_alloc(sizeof (db_free_entry
));
191 "db_free_entry: mem_alloc failed");
194 memset(loc
, 0, sizeof (db_free_entry
));
198 if (freeptr
!= NULL
) {
199 mem_free(freeptr
, sizeof (db_free_entry
));
211 if ((freeptr
!= NULL
) && (xdrs
->x_op
== XDR_FREE
)) {
212 mem_free(freeptr
, sizeof (db_free_entry
));