diff options
author | 1996-04-19 16:08:13 +0000 | |
---|---|---|
committer | 1996-04-19 16:08:13 +0000 | |
commit | 0c0430f8be50281c74d9dc83e99431ec6557954b (patch) | |
tree | afa225701d5d148fcc2f938d8b48ae7e0389ceef /sys/lib | |
parent | Fix a bit, so it's now compiles. (diff) | |
download | wireguard-openbsd-0c0430f8be50281c74d9dc83e99431ec6557954b.tar.xz wireguard-openbsd-0c0430f8be50281c74d9dc83e99431ec6557954b.zip |
NetBSD 960317 merge
Diffstat (limited to 'sys/lib')
-rw-r--r-- | sys/lib/libkern/__main.c | 8 | ||||
-rw-r--r-- | sys/lib/libkern/arch/i386/Makefile.inc | 3 | ||||
-rw-r--r-- | sys/lib/libkern/arch/sparc/memset.c | 5 | ||||
-rw-r--r-- | sys/lib/libkern/bcmp.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/imax.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/imin.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/libkern.h | 50 | ||||
-rw-r--r-- | sys/lib/libkern/lmax.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/lmin.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/max.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/min.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/quad.h | 24 | ||||
-rw-r--r-- | sys/lib/libkern/scanc.c | 4 | ||||
-rw-r--r-- | sys/lib/libkern/skpc.c | 8 | ||||
-rw-r--r-- | sys/lib/libkern/strcat.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/strcpy.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/ulmax.c | 6 | ||||
-rw-r--r-- | sys/lib/libkern/ulmin.c | 6 | ||||
-rw-r--r-- | sys/lib/libsa/bootparam.c | 7 | ||||
-rw-r--r-- | sys/lib/libsa/nfs.c | 14 | ||||
-rw-r--r-- | sys/lib/libsa/nfsv2.h | 167 | ||||
-rw-r--r-- | sys/lib/libsa/rpc.c | 9 | ||||
-rw-r--r-- | sys/lib/libsa/rpcv2.h | 90 |
23 files changed, 397 insertions, 58 deletions
diff --git a/sys/lib/libkern/__main.c b/sys/lib/libkern/__main.c index aa2be9a7509..02b525d8133 100644 --- a/sys/lib/libkern/__main.c +++ b/sys/lib/libkern/__main.c @@ -1,4 +1,5 @@ -/* $NetBSD: __main.c,v 1.3 1994/10/26 06:42:13 cgd Exp $ */ +/* $OpenBSD: __main.c,v 1.2 1996/04/19 16:09:17 niklas Exp $ */ +/* $NetBSD: __main.c,v 1.4 1996/03/14 18:52:03 christos Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -30,6 +31,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/types.h> + +void __main __P((void)); + +void __main() { } diff --git a/sys/lib/libkern/arch/i386/Makefile.inc b/sys/lib/libkern/arch/i386/Makefile.inc index cbeec30a509..a39aac330eb 100644 --- a/sys/lib/libkern/arch/i386/Makefile.inc +++ b/sys/lib/libkern/arch/i386/Makefile.inc @@ -1,4 +1,5 @@ -# $NetBSD: Makefile.inc,v 1.7 1995/10/07 09:52:48 mycroft Exp $ +# $OpenBSD: Makefile.inc,v 1.3 1996/04/19 16:09:44 niklas Exp $ +# $NetBSD: Makefile.inc,v 1.9 1996/03/11 05:32:00 scottr Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ bcmp.S ffs.S memset.S strcat.S strcmp.S strcpy.S strlen.S strncmp.c \ diff --git a/sys/lib/libkern/arch/sparc/memset.c b/sys/lib/libkern/arch/sparc/memset.c index 8b208c7e970..af092288f49 100644 --- a/sys/lib/libkern/arch/sparc/memset.c +++ b/sys/lib/libkern/arch/sparc/memset.c @@ -1,4 +1,5 @@ -/* $NetBSD: memset.c,v 1.2 1994/10/26 06:40:00 cgd Exp $ */ +/* $OpenBSD: memset.c,v 1.2 1996/04/19 16:09:46 niklas Exp $ */ +/* $NetBSD: memset.c,v 1.4 1996/03/11 05:46:51 scottr Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -40,7 +41,7 @@ #ifdef notdef static char *sccsid = "@(#)memset.c 5.6 (Berkeley) 1/26/91"; #endif -static char *rcsid = "$NetBSD: memset.c,v 1.2 1994/10/26 06:40:00 cgd Exp $"; +static char *rcsid = "$NetBSD: memset.c,v 1.4 1996/03/11 05:46:51 scottr Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> diff --git a/sys/lib/libkern/bcmp.c b/sys/lib/libkern/bcmp.c index b5b12e2c636..feaa9655521 100644 --- a/sys/lib/libkern/bcmp.c +++ b/sys/lib/libkern/bcmp.c @@ -1,3 +1,5 @@ +/* $OpenBSD: bcmp.c,v 1.2 1996/04/19 16:09:19 niklas Exp $ */ + /* * Copyright (c) 1987 Regents of the University of California. * All rights reserved. @@ -33,14 +35,16 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)bcmp.c 5.6 (Berkeley) 2/24/91";*/ -static char *rcsid = "$Id: bcmp.c,v 1.1.1.1 1995/10/18 08:52:49 deraadt Exp $"; +static char *rcsid = "$OpenBSD: bcmp.c,v 1.2 1996/04/19 16:09:19 niklas Exp $"; #endif /* LIBC_SCCS and not lint */ #include <string.h> +#include <lib/libkern/libkern.h> /* * bcmp -- vax cmpc3 instruction */ +int bcmp(b1, b2, length) const void *b1, *b2; register size_t length; diff --git a/sys/lib/libkern/imax.c b/sys/lib/libkern/imax.c index 243f82deb66..7c61784e4d5 100644 --- a/sys/lib/libkern/imax.c +++ b/sys/lib/libkern/imax.c @@ -1,4 +1,5 @@ -/* $NetBSD: imax.c,v 1.2 1994/10/26 06:42:24 cgd Exp $ */ +/* $OpenBSD: imax.c,v 1.2 1996/04/19 16:09:20 niklas Exp $ */ +/* $NetBSD: imax.c,v 1.3 1996/03/14 18:52:06 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991 Regents of the University of California. @@ -35,6 +36,9 @@ * @(#)subr_xxx.c 7.10 (Berkeley) 4/20/91 */ +#define LIBKERN_INLINE +#include <lib/libkern/libkern.h> + int imax(a, b) int a, b; diff --git a/sys/lib/libkern/imin.c b/sys/lib/libkern/imin.c index 9ac2402c6ba..5eef0b07818 100644 --- a/sys/lib/libkern/imin.c +++ b/sys/lib/libkern/imin.c @@ -1,4 +1,5 @@ -/* $NetBSD: imin.c,v 1.2 1994/10/26 06:42:25 cgd Exp $ */ +/* $OpenBSD: imin.c,v 1.2 1996/04/19 16:09:22 niklas Exp $ */ +/* $NetBSD: imin.c,v 1.3 1996/03/14 18:52:07 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991 Regents of the University of California. @@ -35,6 +36,9 @@ * @(#)subr_xxx.c 7.10 (Berkeley) 4/20/91 */ +#define LIBKERN_INLINE +#include <lib/libkern/libkern.h> + int imin(a, b) int a, b; diff --git a/sys/lib/libkern/libkern.h b/sys/lib/libkern/libkern.h index e292a3ca8b1..53a8600cd77 100644 --- a/sys/lib/libkern/libkern.h +++ b/sys/lib/libkern/libkern.h @@ -1,5 +1,5 @@ -/* $OpenBSD: libkern.h,v 1.2 1996/02/29 13:27:49 niklas Exp $ */ -/* $NetBSD: libkern.h,v 1.6 1996/02/13 23:48:26 christos Exp $ */ +/* $OpenBSD: libkern.h,v 1.3 1996/04/19 16:09:23 niklas Exp $ */ +/* $NetBSD: libkern.h,v 1.7 1996/03/14 18:52:08 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -38,71 +38,79 @@ #include <sys/types.h> -static __inline int imax __P((int, int)); -static __inline int imin __P((int, int)); -static __inline u_int max __P((u_int, u_int)); -static __inline u_int min __P((u_int, u_int)); -static __inline long lmax __P((long, long)); -static __inline long lmin __P((long, long)); -static __inline u_long ulmax __P((u_long, u_long)); -static __inline u_long ulmin __P((u_long, u_long)); -static __inline int abs __P((int)); +#ifndef LIBKERN_INLINE +#define LIBKERN_INLINE static __inline +#define LIBKERN_BODY +#endif -static __inline int + +LIBKERN_INLINE int imax __P((int, int)); +LIBKERN_INLINE int imin __P((int, int)); +LIBKERN_INLINE u_int max __P((u_int, u_int)); +LIBKERN_INLINE u_int min __P((u_int, u_int)); +LIBKERN_INLINE long lmax __P((long, long)); +LIBKERN_INLINE long lmin __P((long, long)); +LIBKERN_INLINE u_long ulmax __P((u_long, u_long)); +LIBKERN_INLINE u_long ulmin __P((u_long, u_long)); +LIBKERN_INLINE int abs __P((int)); + +#ifdef LIBKERN_BODY +LIBKERN_INLINE int imax(a, b) int a, b; { return (a > b ? a : b); } -static __inline int +LIBKERN_INLINE int imin(a, b) int a, b; { return (a < b ? a : b); } -static __inline long +LIBKERN_INLINE long lmax(a, b) long a, b; { return (a > b ? a : b); } -static __inline long +LIBKERN_INLINE long lmin(a, b) long a, b; { return (a < b ? a : b); } -static __inline u_int +LIBKERN_INLINE u_int max(a, b) u_int a, b; { return (a > b ? a : b); } -static __inline u_int +LIBKERN_INLINE u_int min(a, b) u_int a, b; { return (a < b ? a : b); } -static __inline u_long +LIBKERN_INLINE u_long ulmax(a, b) u_long a, b; { return (a > b ? a : b); } -static __inline u_long +LIBKERN_INLINE u_long ulmin(a, b) u_long a, b; { return (a < b ? a : b); } -static __inline int +LIBKERN_INLINE int abs(j) int j; { return(j < 0 ? -j : j); } +#endif /* Prototypes for non-quad routines. */ int bcmp __P((const void *, const void *, size_t)); @@ -111,7 +119,7 @@ int locc __P((int, char *, u_int)); u_long random __P((void)); char *rindex __P((const char *, int)); int scanc __P((u_int, u_char *, u_char *, int)); -int skpc __P((int, int, char *)); +int skpc __P((int, size_t, u_char *)); size_t strlen __P((const char *)); char *strcat __P((char *, const char *)); char *strcpy __P((char *, const char *)); diff --git a/sys/lib/libkern/lmax.c b/sys/lib/libkern/lmax.c index 723300807d7..357a821d41f 100644 --- a/sys/lib/libkern/lmax.c +++ b/sys/lib/libkern/lmax.c @@ -1,4 +1,5 @@ -/* $NetBSD: lmax.c,v 1.2 1994/10/26 06:42:27 cgd Exp $ */ +/* $OpenBSD: lmax.c,v 1.2 1996/04/19 16:09:25 niklas Exp $ */ +/* $NetBSD: lmax.c,v 1.3 1996/03/14 18:52:09 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991 Regents of the University of California. @@ -35,6 +36,9 @@ * @(#)subr_xxx.c 7.10 (Berkeley) 4/20/91 */ +#define LIBKERN_INLINE +#include <lib/libkern/libkern.h> + long lmax(a, b) long a, b; diff --git a/sys/lib/libkern/lmin.c b/sys/lib/libkern/lmin.c index 2bfe05aba70..21cb58eec0d 100644 --- a/sys/lib/libkern/lmin.c +++ b/sys/lib/libkern/lmin.c @@ -1,4 +1,5 @@ -/* $NetBSD: lmin.c,v 1.2 1994/10/26 06:42:28 cgd Exp $ */ +/* $OpenBSD: lmin.c,v 1.2 1996/04/19 16:09:27 niklas Exp $ */ +/* $NetBSD: lmin.c,v 1.3 1996/03/14 18:52:10 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991 Regents of the University of California. @@ -35,6 +36,9 @@ * @(#)subr_xxx.c 7.10 (Berkeley) 4/20/91 */ +#define LIBKERN_INLINE +#include <lib/libkern/libkern.h> + long lmin(a, b) long a, b; diff --git a/sys/lib/libkern/max.c b/sys/lib/libkern/max.c index 825fb57fd3b..e0505d9ad2b 100644 --- a/sys/lib/libkern/max.c +++ b/sys/lib/libkern/max.c @@ -1,4 +1,5 @@ -/* $NetBSD: max.c,v 1.2 1994/10/26 06:42:31 cgd Exp $ */ +/* $OpenBSD: max.c,v 1.2 1996/04/19 16:09:28 niklas Exp $ */ +/* $NetBSD: max.c,v 1.3 1996/03/14 18:52:12 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991 Regents of the University of California. @@ -35,6 +36,9 @@ * @(#)subr_xxx.c 7.10 (Berkeley) 4/20/91 */ +#define LIBKERN_INLINE +#include <lib/libkern/libkern.h> + unsigned int max(a, b) unsigned int a, b; diff --git a/sys/lib/libkern/min.c b/sys/lib/libkern/min.c index 07d26426902..9d9b9072a50 100644 --- a/sys/lib/libkern/min.c +++ b/sys/lib/libkern/min.c @@ -1,4 +1,5 @@ -/* $NetBSD: min.c,v 1.2 1994/10/26 06:42:33 cgd Exp $ */ +/* $OpenBSD: min.c,v 1.2 1996/04/19 16:09:29 niklas Exp $ */ +/* $NetBSD: min.c,v 1.3 1996/03/14 18:52:13 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991 Regents of the University of California. @@ -35,6 +36,9 @@ * @(#)subr_xxx.c 7.10 (Berkeley) 4/20/91 */ +#define LIBKERN_INLINE +#include <lib/libkern/libkern.h> + unsigned int min(a, b) unsigned int a, b; diff --git a/sys/lib/libkern/quad.h b/sys/lib/libkern/quad.h index f7eea7a31ec..b1b57eea1d0 100644 --- a/sys/lib/libkern/quad.h +++ b/sys/lib/libkern/quad.h @@ -1,4 +1,5 @@ -/* $NetBSD: quad.h,v 1.5 1995/10/12 15:13:58 jtc Exp $ */ +/* $OpenBSD: quad.h,v 1.3 1996/04/19 16:09:31 niklas Exp $ */ +/* $NetBSD: quad.h,v 1.6 1996/03/14 18:52:14 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -110,3 +111,24 @@ typedef unsigned int qshift_t; #else typedef u_quad_t qshift_t; #endif + +__BEGIN_DECLS +quad_t __adddi3 __P((quad_t, quad_t)); +quad_t __anddi3 __P((quad_t, quad_t)); +quad_t __ashldi3 __P((quad_t, qshift_t)); +quad_t __ashrdi3 __P((quad_t, qshift_t)); +int __cmpdi2 __P((quad_t, quad_t)); +quad_t __divdi3 __P((quad_t, quad_t)); +quad_t __iordi3 __P((quad_t, quad_t)); +quad_t __lshldi3 __P((quad_t, qshift_t)); +quad_t __lshrdi3 __P((quad_t, qshift_t)); +quad_t __moddi3 __P((quad_t, quad_t)); +quad_t __muldi3 __P((quad_t, quad_t)); +quad_t __negdi2 __P((quad_t)); +quad_t __one_cmpldi2 __P((quad_t)); +quad_t __subdi3 __P((quad_t, quad_t)); +int __ucmpdi2 __P((u_quad_t, u_quad_t)); +u_quad_t __udivdi3 __P((u_quad_t, u_quad_t)); +u_quad_t __umoddi3 __P((u_quad_t, u_quad_t)); +quad_t __xordi3 __P((quad_t, quad_t)); +__END_DECLS diff --git a/sys/lib/libkern/scanc.c b/sys/lib/libkern/scanc.c index c28e47841b9..66686604672 100644 --- a/sys/lib/libkern/scanc.c +++ b/sys/lib/libkern/scanc.c @@ -1,4 +1,5 @@ -/* $NetBSD: scanc.c,v 1.2 1994/10/26 06:42:42 cgd Exp $ */ +/* $OpenBSD: scanc.c,v 1.2 1996/04/19 16:09:33 niklas Exp $ */ +/* $NetBSD: scanc.c,v 1.3 1996/03/14 18:52:16 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989 Regents of the University of California. @@ -36,6 +37,7 @@ */ #include <sys/types.h> +#include <lib/libkern/libkern.h> int scanc(size, cp, table, mask) diff --git a/sys/lib/libkern/skpc.c b/sys/lib/libkern/skpc.c index 298af88fcaf..e710ca639b0 100644 --- a/sys/lib/libkern/skpc.c +++ b/sys/lib/libkern/skpc.c @@ -1,4 +1,5 @@ -/* $NetBSD: skpc.c,v 1.2 1994/10/26 06:42:43 cgd Exp $ */ +/* $OpenBSD: skpc.c,v 1.2 1996/04/19 16:09:36 niklas Exp $ */ +/* $NetBSD: skpc.c,v 1.3 1996/03/14 18:52:18 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989 Regents of the University of California. @@ -36,16 +37,17 @@ */ #include <sys/types.h> +#include <lib/libkern/libkern.h> int skpc(mask, size, cp) register int mask; - u_int size; + size_t size; register u_char *cp; { register u_char *end = &cp[size]; - while (cp < end && *cp == mask) + while (cp < end && *cp == (u_char) mask) cp++; return (end - cp); } diff --git a/sys/lib/libkern/strcat.c b/sys/lib/libkern/strcat.c index 6c2d76ab54b..069bd1fa35b 100644 --- a/sys/lib/libkern/strcat.c +++ b/sys/lib/libkern/strcat.c @@ -1,3 +1,5 @@ +/* $OpenBSD: strcat.c,v 1.2 1996/04/19 16:09:37 niklas Exp $ */ + /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -33,7 +35,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)strcat.c 5.6 (Berkeley) 2/24/91";*/ -static char *rcsid = "$Id: strcat.c,v 1.1.1.1 1995/10/18 08:52:50 deraadt Exp $"; +static char *rcsid = "$OpenBSD: strcat.c,v 1.2 1996/04/19 16:09:37 niklas Exp $"; #endif /* LIBC_SCCS and not lint */ #include <string.h> @@ -46,6 +48,6 @@ strcat(s, append) char *save = s; for (; *s; ++s); - while (*s++ = *append++); + while ((*s++ = *append++) != '\0'); return(save); } diff --git a/sys/lib/libkern/strcpy.c b/sys/lib/libkern/strcpy.c index f344c192789..d08b319e67b 100644 --- a/sys/lib/libkern/strcpy.c +++ b/sys/lib/libkern/strcpy.c @@ -1,3 +1,5 @@ +/* $OpenBSD: strcpy.c,v 1.2 1996/04/19 16:09:39 niklas Exp $ */ + /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -33,7 +35,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)strcpy.c 5.7 (Berkeley) 2/24/91";*/ -static char *rcsid = "$Id: strcpy.c,v 1.1.1.1 1995/10/18 08:52:50 deraadt Exp $"; +static char *rcsid = "$OpenBSD: strcpy.c,v 1.2 1996/04/19 16:09:39 niklas Exp $"; #endif /* LIBC_SCCS and not lint */ #include <string.h> @@ -45,6 +47,6 @@ strcpy(to, from) { char *save = to; - for (; *to = *from; ++from, ++to); + for (; (*to = *from) != '\0'; ++from, ++to); return(save); } diff --git a/sys/lib/libkern/ulmax.c b/sys/lib/libkern/ulmax.c index 0beadeacb7e..e0b7817c43d 100644 --- a/sys/lib/libkern/ulmax.c +++ b/sys/lib/libkern/ulmax.c @@ -1,4 +1,5 @@ -/* $NetBSD: ulmax.c,v 1.2 1994/10/26 06:42:52 cgd Exp $ */ +/* $OpenBSD: ulmax.c,v 1.2 1996/04/19 16:09:40 niklas Exp $ */ +/* $NetBSD: ulmax.c,v 1.3 1996/03/14 18:52:23 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991 Regents of the University of California. @@ -35,6 +36,9 @@ * @(#)subr_xxx.c 7.10 (Berkeley) 4/20/91 */ +#define LIBKERN_INLINE +#include <lib/libkern/libkern.h> + unsigned long ulmax(a, b) unsigned long a, b; diff --git a/sys/lib/libkern/ulmin.c b/sys/lib/libkern/ulmin.c index 68631c14506..d96e947a9ba 100644 --- a/sys/lib/libkern/ulmin.c +++ b/sys/lib/libkern/ulmin.c @@ -1,4 +1,5 @@ -/* $NetBSD: ulmin.c,v 1.2 1994/10/26 06:42:53 cgd Exp $ */ +/* $OpenBSD: ulmin.c,v 1.2 1996/04/19 16:09:41 niklas Exp $ */ +/* $NetBSD: ulmin.c,v 1.3 1996/03/14 18:52:25 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991 Regents of the University of California. @@ -35,6 +36,9 @@ * @(#)subr_xxx.c 7.10 (Berkeley) 4/20/91 */ +#define LIBKERN_INLINE +#include <lib/libkern/libkern.h> + unsigned long ulmin(a, b) unsigned long a, b; diff --git a/sys/lib/libsa/bootparam.c b/sys/lib/libsa/bootparam.c index 5736b8d4571..65739a28b17 100644 --- a/sys/lib/libsa/bootparam.c +++ b/sys/lib/libsa/bootparam.c @@ -1,4 +1,5 @@ -/* $NetBSD: bootparam.c,v 1.6 1995/12/08 04:10:28 gwr Exp $ */ +/* $OpenBSD: bootparam.c,v 1.3 1996/04/19 16:09:49 niklas Exp $ */ +/* $NetBSD: bootparam.c,v 1.7 1996/02/26 23:05:14 gwr Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -42,10 +43,10 @@ #include <netinet/in.h> #include <netinet/in_systm.h> -#include <nfs/rpcv2.h> - #include <string.h> +#include "rpcv2.h" + #include "stand.h" #include "net.h" #include "netif.h" diff --git a/sys/lib/libsa/nfs.c b/sys/lib/libsa/nfs.c index de16be75325..7aedb5f1b8c 100644 --- a/sys/lib/libsa/nfs.c +++ b/sys/lib/libsa/nfs.c @@ -1,4 +1,5 @@ -/* $NetBSD: nfs.c,v 1.12 1995/09/23 03:36:08 gwr Exp $ */ +/* $OpenBSD: nfs.c,v 1.2 1996/04/19 16:09:50 niklas Exp $ */ +/* $NetBSD: nfs.c,v 1.14 1996/02/26 23:05:21 gwr Exp $ */ /*- * Copyright (c) 1993 John Brezak @@ -37,9 +38,8 @@ #include <netinet/in.h> #include <netinet/in_systm.h> -#include <nfs/rpcv2.h> -#include <nfs/nfsv2.h> -#include <nfs/xdr_subs.h> +#include "rpcv2.h" +#include "nfsv2.h" #include "stand.h" #include "net.h" @@ -250,11 +250,11 @@ nfs_readdata(d, off, addr, len) repl = &rdata.d; bcopy(d->fh, args->fh, NFS_FHSIZE); - args->off = txdr_unsigned(off); + args->off = htonl((n_long)off); if (len > NFSREAD_SIZE) len = NFSREAD_SIZE; - args->len = txdr_unsigned(len); - args->xxx = txdr_unsigned(0); + args->len = htonl((n_long)len); + args->xxx = htonl((n_long)0); hlen = sizeof(*repl) - NFSREAD_SIZE; cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READ, diff --git a/sys/lib/libsa/nfsv2.h b/sys/lib/libsa/nfsv2.h new file mode 100644 index 00000000000..83464564e6c --- /dev/null +++ b/sys/lib/libsa/nfsv2.h @@ -0,0 +1,167 @@ +/* $OpenBSD: nfsv2.h,v 1.1 1996/04/19 16:09:52 niklas Exp $ */ +/* $NetBSD: nfsv2.h,v 1.2 1996/02/26 23:05:23 gwr Exp $ */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Rick Macklem at The University of Guelph. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)nfsv2.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * nfs definitions as per the version 2 specs + */ + +/* + * Constants as defined in the Sun NFS Version 2 spec. + * "NFS: Network File System Protocol Specification" RFC1094 + */ + +#define NFS_PORT 2049 +#define NFS_PROG 100003 +#define NFS_VER2 2 +#define NFS_MAXDGRAMDATA 8192 +#define NFS_MAXDATA 32768 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_MAXPKTHDR 404 +#define NFS_MAXPACKET (NFS_MAXPKTHDR+NFS_MAXDATA) +#define NFS_MINPACKET 20 +#define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ + +/* Stat numbers for rpc returns */ +#define NFS_OK 0 +#define NFSERR_PERM 1 +#define NFSERR_NOENT 2 +#define NFSERR_IO 5 +#define NFSERR_NXIO 6 +#define NFSERR_ACCES 13 +#define NFSERR_EXIST 17 +#define NFSERR_NODEV 19 +#define NFSERR_NOTDIR 20 +#define NFSERR_ISDIR 21 +#define NFSERR_FBIG 27 +#define NFSERR_NOSPC 28 +#define NFSERR_ROFS 30 +#define NFSERR_NAMETOL 63 +#define NFSERR_NOTEMPTY 66 +#define NFSERR_DQUOT 69 +#define NFSERR_STALE 70 +#define NFSERR_WFLUSH 99 + +/* Sizes in bytes of various nfs rpc components */ +#define NFSX_FH 32 +#define NFSX_UNSIGNED 4 +#define NFSX_FATTR 68 +#define NFSX_SATTR 32 +#define NFSX_STATFS 20 +#define NFSX_COOKIE 4 + +/* nfs rpc procedure numbers */ +#define NFSPROC_NULL 0 +#define NFSPROC_GETATTR 1 +#define NFSPROC_SETATTR 2 +#define NFSPROC_NOOP 3 +#define NFSPROC_ROOT NFSPROC_NOOP /* Obsolete */ +#define NFSPROC_LOOKUP 4 +#define NFSPROC_READLINK 5 +#define NFSPROC_READ 6 +#define NFSPROC_WRITECACHE NFSPROC_NOOP /* Obsolete */ +#define NFSPROC_WRITE 8 +#define NFSPROC_CREATE 9 +#define NFSPROC_REMOVE 10 +#define NFSPROC_RENAME 11 +#define NFSPROC_LINK 12 +#define NFSPROC_SYMLINK 13 +#define NFSPROC_MKDIR 14 +#define NFSPROC_RMDIR 15 +#define NFSPROC_READDIR 16 +#define NFSPROC_STATFS 17 + +#define NFS_NPROCS 18 + + +/* File types */ +typedef enum { + NFNON=0, + NFREG=1, + NFDIR=2, + NFBLK=3, + NFCHR=4, + NFLNK=5 +} nfstype; + +/* Structs for common parts of the rpc's */ +struct nfsv2_time { + n_long nfs_sec; + n_long nfs_usec; +}; + +/* + * File attributes and setable attributes. + */ +struct nfsv2_fattr { + n_long fa_type; + n_long fa_mode; + n_long fa_nlink; + n_long fa_uid; + n_long fa_gid; + n_long fa_size; + n_long fa_blocksize; + n_long fa_rdev; + n_long fa_blocks; + n_long fa_fsid; + n_long fa_fileid; + struct nfsv2_time fa_atime; + struct nfsv2_time fa_mtime; + struct nfsv2_time fa_ctime; +}; + +struct nfsv2_sattr { + n_long sa_mode; + n_long sa_uid; + n_long sa_gid; + n_long sa_size; + struct nfsv2_time sa_atime; + struct nfsv2_time sa_mtime; +}; + +struct nfsv2_statfs { + n_long sf_tsize; + n_long sf_bsize; + n_long sf_blocks; + n_long sf_bfree; + n_long sf_bavail; +}; diff --git a/sys/lib/libsa/rpc.c b/sys/lib/libsa/rpc.c index 8d5557c9016..c3cff959a18 100644 --- a/sys/lib/libsa/rpc.c +++ b/sys/lib/libsa/rpc.c @@ -1,4 +1,5 @@ -/* $NetBSD: rpc.c,v 1.10 1995/09/23 03:36:11 gwr Exp $ */ +/* $OpenBSD: rpc.c,v 1.2 1996/04/19 16:09:53 niklas Exp $ */ +/* $NetBSD: rpc.c,v 1.12 1996/02/26 23:05:26 gwr Exp $ */ /* * Copyright (c) 1992 Regents of the University of California. @@ -53,12 +54,10 @@ #include <netinet/in.h> #include <netinet/in_systm.h> -#include <nfs/rpcv2.h> -#include <nfs/nfsv2.h> -#include <nfs/xdr_subs.h> - #include <string.h> +#include "rpcv2.h" + #include "stand.h" #include "net.h" #include "netif.h" diff --git a/sys/lib/libsa/rpcv2.h b/sys/lib/libsa/rpcv2.h new file mode 100644 index 00000000000..75102c14fd1 --- /dev/null +++ b/sys/lib/libsa/rpcv2.h @@ -0,0 +1,90 @@ +/* $OpenBSD: rpcv2.h,v 1.1 1996/04/19 16:09:55 niklas Exp $ */ +/* $NetBSD: rpcv2.h,v 1.1 1996/02/26 23:05:32 gwr Exp $ */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Rick Macklem at The University of Guelph. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)rpcv2.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * Definitions for Sun RPC Version 2, from + * "RPC: Remote Procedure Call Protocol Specification" RFC1057 + */ + +/* Version # */ +#define RPC_VER2 2 + +/* Authentication */ +#define RPCAUTH_NULL 0 +#define RPCAUTH_UNIX 1 +#define RPCAUTH_SHORT 2 +#define RPCAUTH_MAXSIZ 400 +#define RPCAUTH_UNIXGIDS 16 + +/* Rpc Constants */ +#define RPC_CALL 0 +#define RPC_REPLY 1 +#define RPC_MSGACCEPTED 0 +#define RPC_MSGDENIED 1 +#define RPC_PROGUNAVAIL 1 +#define RPC_PROGMISMATCH 2 +#define RPC_PROCUNAVAIL 3 +#define RPC_GARBAGE 4 /* I like this one */ +#define RPC_MISMATCH 0 +#define RPC_AUTHERR 1 + +/* Authentication failures */ +#define AUTH_BADCRED 1 +#define AUTH_REJECTCRED 2 +#define AUTH_BADVERF 3 +#define AUTH_REJECTVERF 4 +#define AUTH_TOOWEAK 5 /* Give em wheaties */ + +/* Sizes of rpc header parts */ +#define RPC_SIZ 24 +#define RPC_REPLYSIZ 28 + +/* RPC Prog definitions */ +#define RPCPROG_MNT 100005 +#define RPCMNT_VER1 1 +#define RPCMNT_MOUNT 1 +#define RPCMNT_DUMP 2 +#define RPCMNT_UMOUNT 3 +#define RPCMNT_UMNTALL 4 +#define RPCMNT_EXPORT 5 +#define RPCMNT_NAMELEN 255 +#define RPCMNT_PATHLEN 1024 +#define RPCPROG_NFS 100003 |