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]
23 * Copyright (c) 1998 by Sun Microsystems, Inc.
24 * All rights reserved.
28 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <stdio.h> /* for fprintf() */
32 #include <stdlib.h> /* for malloc() */
33 #include <rpc/types.h>
35 #include <rpcsvc/mount.h>
39 * XDR routines to handle mountlist structure
41 * These are iterative versions to avoid the stack-blowing problems of
42 * the recursive routines generated by rpcgen.
44 * XXXX These should be removed when rpcgen is fixed to produce better
45 * code in these circumstances.
50 xdr_mountlist(xdrs
, objp
)
66 if (!xdr_name(xdrs
, &mb
->ml_hostname
))
68 if (!xdr_dirpath(xdrs
, &mb
->ml_directory
))
78 mountbody
*mb_prev
= NULL
;
81 if (!xdr_bool(xdrs
, &more_data
))
87 mb
= (mountbody
*)malloc(sizeof (struct mountbody
));
90 "xdr_mountlist: out of memory\n");
93 mb
->ml_hostname
= NULL
;
94 mb
->ml_directory
= NULL
;
97 if (mb_prev
== NULL
) {
102 if (!xdr_name(xdrs
, &mb
->ml_hostname
))
104 if (!xdr_dirpath(xdrs
, &mb
->ml_directory
))
108 mb_prev
->ml_next
= mb
;
121 more_data
= mb
!= NULL
;
123 if (!xdr_bool(xdrs
, &more_data
))
129 if (!xdr_name(xdrs
, &mb
->ml_hostname
))
131 if (!xdr_dirpath(xdrs
, &mb
->ml_directory
))
148 * xdr_mountbody() is included here simply for backward compatibility. It is
149 * no longer used by xdr_mountlist(), nor by any other SunOS routine as of
152 * This is simply a copy of the rpcgen generated routine.
155 xdr_mountbody(xdrs
, objp
)
159 if (!xdr_name(xdrs
, &objp
->ml_hostname
))
161 if (!xdr_dirpath(xdrs
, &objp
->ml_directory
))
163 if (!xdr_mountlist(xdrs
, &objp
->ml_next
))