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]
25 * Copyright 2015 Gary Mills
26 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #include "db_dictionary_c.h"
31 #include "db_dictionary.h"
32 #include "db_vers_c.h"
34 extern vers db_update_version
;
36 extern void make_zero(vers
*);
38 /* Special xdr_db_dict_desc that understands optional version number at end. */
40 xdr_db_dict_desc(XDR
*xdrs
, db_dict_desc
*objp
)
43 if (!xdr_db_dict_version(xdrs
, &objp
->impl_vers
))
45 if (!xdr_array(xdrs
, (char **)&objp
->tables
.tables_val
,
46 (uint_t
*)&objp
->tables
.tables_len
, ~0,
47 sizeof (db_table_desc_p
), (xdrproc_t
)xdr_db_table_desc_p
))
49 if (!xdr_int(xdrs
, &objp
->count
))
52 if (xdrs
->x_op
== XDR_DECODE
) {
53 /* If no version was found, set version to 0. */
54 if (!xdr_vers(xdrs
, (void**) &db_update_version
))
55 make_zero(&db_update_version
);
57 } else if (xdrs
->x_op
== XDR_ENCODE
) {
58 /* Always write out version */
59 if (!xdr_vers(xdrs
, (void**) &db_update_version
))
61 } /* else XDR_FREE: do nothing */