home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.sbin / amd / rpcx / mount_xdr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-12  |  4.2 KB  |  207 lines

  1. /*
  2.  * Copyright (c) 1989 Jan-Simon Pendry
  3.  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  4.  * Copyright (c) 1989 The Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * This code is derived from software contributed to Berkeley by
  8.  * Jan-Simon Pendry at Imperial College, London.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  *    @(#)mount_xdr.c    5.3 (Berkeley) 5/12/91
  39.  *
  40.  * $Id: mount_xdr.c,v 5.2.1.2 91/05/07 22:18:55 jsp Alpha $
  41.  *
  42.  */
  43.  
  44. #include "am.h"
  45. #include "mount.h"
  46.  
  47.  
  48. bool_t
  49. xdr_fhandle(xdrs, objp)
  50.     XDR *xdrs;
  51.     fhandle objp;
  52. {
  53.     if (!xdr_opaque(xdrs, objp, FHSIZE)) {
  54.         return (FALSE);
  55.     }
  56.     return (TRUE);
  57. }
  58.  
  59.  
  60.  
  61.  
  62. bool_t
  63. xdr_fhstatus(xdrs, objp)
  64.     XDR *xdrs;
  65.     fhstatus *objp;
  66. {
  67.     if (!xdr_u_int(xdrs, &objp->fhs_status)) {
  68.         return (FALSE);
  69.     }
  70.     switch (objp->fhs_status) {
  71.     case 0:
  72.         if (!xdr_fhandle(xdrs, objp->fhstatus_u.fhs_fhandle)) {
  73.             return (FALSE);
  74.         }
  75.         break;
  76.     }
  77.     return (TRUE);
  78. }
  79.  
  80.  
  81.  
  82.  
  83. bool_t
  84. xdr_dirpath(xdrs, objp)
  85.     XDR *xdrs;
  86.     dirpath *objp;
  87. {
  88.     if (!xdr_string(xdrs, objp, MNTPATHLEN)) {
  89.         return (FALSE);
  90.     }
  91.     return (TRUE);
  92. }
  93.  
  94.  
  95.  
  96.  
  97. bool_t
  98. xdr_name(xdrs, objp)
  99.     XDR *xdrs;
  100.     name *objp;
  101. {
  102.     if (!xdr_string(xdrs, objp, MNTNAMLEN)) {
  103.         return (FALSE);
  104.     }
  105.     return (TRUE);
  106. }
  107.  
  108.  
  109.  
  110.  
  111. bool_t
  112. xdr_mountlist(xdrs, objp)
  113.     XDR *xdrs;
  114.     mountlist *objp;
  115. {
  116.     if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct mountbody), xdr_mountbody)) {
  117.         return (FALSE);
  118.     }
  119.     return (TRUE);
  120. }
  121.  
  122.  
  123.  
  124. bool_t
  125. xdr_mountbody(xdrs, objp)
  126.     XDR *xdrs;
  127.     mountbody *objp;
  128. {
  129.     if (!xdr_name(xdrs, &objp->ml_hostname)) {
  130.         return (FALSE);
  131.     }
  132.     if (!xdr_dirpath(xdrs, &objp->ml_directory)) {
  133.         return (FALSE);
  134.     }
  135.     if (!xdr_mountlist(xdrs, &objp->ml_next)) {
  136.         return (FALSE);
  137.     }
  138.     return (TRUE);
  139. }
  140.  
  141.  
  142.  
  143.  
  144. bool_t
  145. xdr_groups(xdrs, objp)
  146.     XDR *xdrs;
  147.     groups *objp;
  148. {
  149.     if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct groupnode), xdr_groupnode)) {
  150.         return (FALSE);
  151.     }
  152.     return (TRUE);
  153. }
  154.  
  155.  
  156.  
  157.  
  158. bool_t
  159. xdr_groupnode(xdrs, objp)
  160.     XDR *xdrs;
  161.     groupnode *objp;
  162. {
  163.     if (!xdr_name(xdrs, &objp->gr_name)) {
  164.         return (FALSE);
  165.     }
  166.     if (!xdr_groups(xdrs, &objp->gr_next)) {
  167.         return (FALSE);
  168.     }
  169.     return (TRUE);
  170. }
  171.  
  172.  
  173.  
  174.  
  175. bool_t
  176. xdr_exports(xdrs, objp)
  177.     XDR *xdrs;
  178.     exports *objp;
  179. {
  180.     if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct exportnode), xdr_exportnode)) {
  181.         return (FALSE);
  182.     }
  183.     return (TRUE);
  184. }
  185.  
  186.  
  187.  
  188.  
  189. bool_t
  190. xdr_exportnode(xdrs, objp)
  191.     XDR *xdrs;
  192.     exportnode *objp;
  193. {
  194.     if (!xdr_dirpath(xdrs, &objp->ex_dir)) {
  195.         return (FALSE);
  196.     }
  197.     if (!xdr_groups(xdrs, &objp->ex_groups)) {
  198.         return (FALSE);
  199.     }
  200.     if (!xdr_exports(xdrs, &objp->ex_next)) {
  201.         return (FALSE);
  202.     }
  203.     return (TRUE);
  204. }
  205.  
  206.  
  207.