xref: /csrg-svn/sys/nfs/xdr_subs.h (revision 39748)
138414Smckusick /*
238414Smckusick  * Copyright (c) 1989 The Regents of the University of California.
338414Smckusick  * All rights reserved.
438414Smckusick  *
538414Smckusick  * This code is derived from software contributed to Berkeley by
638414Smckusick  * Rick Macklem at The University of Guelph.
738414Smckusick  *
838414Smckusick  * Redistribution and use in source and binary forms are permitted
938414Smckusick  * provided that the above copyright notice and this paragraph are
1038414Smckusick  * duplicated in all such forms and that any documentation,
1138414Smckusick  * advertising materials, and other materials related to such
1238414Smckusick  * distribution and use acknowledge that the software was developed
1338414Smckusick  * by the University of California, Berkeley.  The name of the
1438414Smckusick  * University may not be used to endorse or promote products derived
1538414Smckusick  * from this software without specific prior written permission.
1638414Smckusick  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1738414Smckusick  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1838414Smckusick  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1938414Smckusick  *
20*39748Smckusick  *	@(#)xdr_subs.h	7.2 (Berkeley) 12/20/89
2138414Smckusick  */
2238414Smckusick 
2338414Smckusick /*
2438414Smckusick  * Macros used for conversion to/from xdr representation by nfs...
2538414Smckusick  * These use the MACHINE DEPENDENT routines ntohl, htonl
26*39748Smckusick  * As defined by "XDR: External Data Representation Standard" RFC1014
2738414Smckusick  */
2838414Smckusick /* From xdr to machine */
2938414Smckusick #define fxdr_unsigned(t, v)	((t)ntohl((long)(v)))
3038414Smckusick #define	fxdr_time(f, t)		{((struct timeval *)(t))->tv_sec=ntohl( \
3138414Smckusick 				((struct timeval *)(f))->tv_sec); \
3238414Smckusick 				((struct timeval *)(t))->tv_usec=ntohl( \
3338414Smckusick 				((struct timeval *)(f))->tv_usec);}
3438414Smckusick 
3538414Smckusick /* from machine to xdr */
3638414Smckusick #define	txdr_unsigned(v)	(htonl((long)(v)))
3738414Smckusick #define	txdr_time(f, t)		{((struct timeval *)(t))->tv_sec=htonl( \
3838414Smckusick 				((struct timeval *)(f))->tv_sec); \
3938414Smckusick 				((struct timeval *)(t))->tv_usec=htonl( \
4038414Smckusick 				((struct timeval *)(f))->tv_usec);}
4138414Smckusick 
42