xref: /csrg-svn/sys/nfs/xdr_subs.h (revision 38414)
1*38414Smckusick /*
2*38414Smckusick  * Copyright (c) 1989 The Regents of the University of California.
3*38414Smckusick  * All rights reserved.
4*38414Smckusick  *
5*38414Smckusick  * This code is derived from software contributed to Berkeley by
6*38414Smckusick  * Rick Macklem at The University of Guelph.
7*38414Smckusick  *
8*38414Smckusick  * Redistribution and use in source and binary forms are permitted
9*38414Smckusick  * provided that the above copyright notice and this paragraph are
10*38414Smckusick  * duplicated in all such forms and that any documentation,
11*38414Smckusick  * advertising materials, and other materials related to such
12*38414Smckusick  * distribution and use acknowledge that the software was developed
13*38414Smckusick  * by the University of California, Berkeley.  The name of the
14*38414Smckusick  * University may not be used to endorse or promote products derived
15*38414Smckusick  * from this software without specific prior written permission.
16*38414Smckusick  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17*38414Smckusick  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18*38414Smckusick  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19*38414Smckusick  *
20*38414Smckusick  *	@(#)xdr_subs.h	7.1 (Berkeley) 07/05/89
21*38414Smckusick  */
22*38414Smckusick 
23*38414Smckusick /*
24*38414Smckusick  * Macros used for conversion to/from xdr representation by nfs...
25*38414Smckusick  * These use the MACHINE DEPENDENT routines ntohl, htonl
26*38414Smckusick  */
27*38414Smckusick /* From xdr to machine */
28*38414Smckusick #define fxdr_unsigned(t, v)	((t)ntohl((long)(v)))
29*38414Smckusick #define	fxdr_time(f, t)		{((struct timeval *)(t))->tv_sec=ntohl( \
30*38414Smckusick 				((struct timeval *)(f))->tv_sec); \
31*38414Smckusick 				((struct timeval *)(t))->tv_usec=ntohl( \
32*38414Smckusick 				((struct timeval *)(f))->tv_usec);}
33*38414Smckusick 
34*38414Smckusick /* from machine to xdr */
35*38414Smckusick #define	txdr_unsigned(v)	(htonl((long)(v)))
36*38414Smckusick #define	txdr_time(f, t)		{((struct timeval *)(t))->tv_sec=htonl( \
37*38414Smckusick 				((struct timeval *)(f))->tv_sec); \
38*38414Smckusick 				((struct timeval *)(t))->tv_usec=htonl( \
39*38414Smckusick 				((struct timeval *)(f))->tv_usec);}
40*38414Smckusick 
41