Module Name: src Committed By: riastradh Date: Sat Dec 7 02:05:55 UTC 2024
Modified Files: src/sys/nfs: krpc.h nfs.h nfs_var.h nfsdiskless.h nfsm_subs.h nfsmount.h nfsnode.h nfsproto.h nfsrtt.h nfsrvcache.h rpcv2.h xdr_subs.h Log Message: sys/nfs/nfs: Add some missing includes and include guards. Fix up some minor KNF issues while here. No functional change intended (except to enable things to build that might not have built before because of previously required #include ordering). To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/nfs/krpc.h cvs rdiff -u -r1.80 -r1.81 src/sys/nfs/nfs.h cvs rdiff -u -r1.96 -r1.97 src/sys/nfs/nfs_var.h cvs rdiff -u -r1.32 -r1.33 src/sys/nfs/nfsdiskless.h cvs rdiff -u -r1.58 -r1.59 src/sys/nfs/nfsm_subs.h cvs rdiff -u -r1.53 -r1.54 src/sys/nfs/nfsmount.h cvs rdiff -u -r1.76 -r1.77 src/sys/nfs/nfsnode.h cvs rdiff -u -r1.17 -r1.18 src/sys/nfs/nfsproto.h cvs rdiff -u -r1.10 -r1.11 src/sys/nfs/nfsrtt.h cvs rdiff -u -r1.16 -r1.17 src/sys/nfs/nfsrvcache.h cvs rdiff -u -r1.12 -r1.13 src/sys/nfs/rpcv2.h cvs rdiff -u -r1.15 -r1.16 src/sys/nfs/xdr_subs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/nfs/krpc.h diff -u src/sys/nfs/krpc.h:1.9 src/sys/nfs/krpc.h:1.10 --- src/sys/nfs/krpc.h:1.9 Sat Mar 14 14:46:11 2009 +++ src/sys/nfs/krpc.h Sat Dec 7 02:05:55 2024 @@ -1,8 +1,12 @@ -/* $NetBSD: krpc.h,v 1.9 2009/03/14 14:46:11 dsl Exp $ */ +/* $NetBSD: krpc.h,v 1.10 2024/12/07 02:05:55 riastradh Exp $ */ + +#ifndef _NFS_KRPC_H_ +#define _NFS_KRPC_H_ #include <sys/cdefs.h> #ifdef _KERNEL + int krpc_call(struct sockaddr_in *sin, u_int prog, u_int vers, u_int func, struct mbuf **data, struct mbuf **from, struct lwp *l); @@ -15,8 +19,8 @@ struct mbuf *xdr_string_encode(char *str struct mbuf *xdr_string_decode(struct mbuf *m, char *str, int *len_p); struct mbuf *xdr_inaddr_encode(struct in_addr *ia); struct mbuf *xdr_inaddr_decode(struct mbuf *m, struct in_addr *ia); -#endif /* _KERNEL */ +#endif /* _KERNEL */ /* * RPC definitions for the portmapper @@ -31,7 +35,6 @@ struct mbuf *xdr_inaddr_decode(struct mb #define PMAPPROC_DUMP 4 #define PMAPPROC_CALLIT 5 - /* * RPC definitions for bootparamd */ @@ -40,3 +43,4 @@ struct mbuf *xdr_inaddr_decode(struct mb #define BOOTPARAM_WHOAMI 1 #define BOOTPARAM_GETFILE 2 +#endif /* _NFS_KRPC_H_ */ Index: src/sys/nfs/nfs.h diff -u src/sys/nfs/nfs.h:1.80 src/sys/nfs/nfs.h:1.81 --- src/sys/nfs/nfs.h:1.80 Sun Dec 5 07:44:53 2021 +++ src/sys/nfs/nfs.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs.h,v 1.80 2021/12/05 07:44:53 msaitoh Exp $ */ +/* $NetBSD: nfs.h,v 1.81 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1989, 1993, 1995 * The Regents of the University of California. All rights reserved. @@ -44,6 +44,8 @@ #include <sys/rbtree.h> #endif +#include <nfs/rpcv2.h> + /* * Tunable constants for nfs */ @@ -69,8 +71,8 @@ #define NFS_TRYLATERDELMAX (1*60) /* Maximum try later delay (sec) */ #define NFS_TRYLATERDELMUL 2 /* Exponential backoff multiplier */ -#define NFS_CWNDSCALE 256 -#define NFS_MAXCWND (NFS_CWNDSCALE * 32) +#define NFS_CWNDSCALE 256 +#define NFS_MAXCWND (NFS_CWNDSCALE * 32) /* * These can be overridden through <machine/param.h>, included via Index: src/sys/nfs/nfs_var.h diff -u src/sys/nfs/nfs_var.h:1.96 src/sys/nfs/nfs_var.h:1.97 --- src/sys/nfs/nfs_var.h:1.96 Wed Apr 27 17:38:52 2022 +++ src/sys/nfs/nfs_var.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_var.h,v 1.96 2022/04/27 17:38:52 hannken Exp $ */ +/* $NetBSD: nfs_var.h,v 1.97 2024/12/07 02:05:55 riastradh Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -29,14 +29,17 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* - * XXX needs <nfs/rpcv2.h> and <nfs/nfs.h> because of typedefs - */ +#ifndef _NFS_NFS_VAR_H_ +#define _NFS_NFS_VAR_H_ #ifdef _KERNEL + #include <sys/mallocvar.h> #include <sys/pool.h> +#include <nfs/nfsproto.h> +#include <nfs/rpcv2.h> + struct vnode; struct uio; struct proc; @@ -364,4 +367,7 @@ void netexport_rdunlock(void); void netexport_init(void); void netexport_fini(void); bool netexport_hasexports(void); + #endif /* _KERNEL */ + +#endif /* _NFS_NFS_VAR_H_ */ Index: src/sys/nfs/nfsdiskless.h diff -u src/sys/nfs/nfsdiskless.h:1.32 src/sys/nfs/nfsdiskless.h:1.33 --- src/sys/nfs/nfsdiskless.h:1.32 Thu May 21 02:04:22 2015 +++ src/sys/nfs/nfsdiskless.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfsdiskless.h,v 1.32 2015/05/21 02:04:22 rtr Exp $ */ +/* $NetBSD: nfsdiskless.h,v 1.33 2024/12/07 02:05:55 riastradh Exp $ */ /*- * Copyright (c) 1995, 1997 The NetBSD Foundation, Inc. @@ -30,9 +30,22 @@ * * @(#)nfsdiskless.h 8.1 (Berkeley) 6/10/93 */ + #ifndef _NFS_NFSDISKLESS_H_ #define _NFS_NFSDISKLESS_H_ +#include <sys/types.h> + +#include <sys/mount.h> +#include <sys/socket.h> + +#include <netinet/in.h> + +#include <nfs/nfsmount.h> +#include <nfs/nfsproto.h> + +struct ifnet; + /* * Structure holds parameters needed by nfs_mountroot(), * which are filled in by nfs_boot_init() using either @@ -66,25 +79,27 @@ struct nfs_diskless { }; #ifdef _KERNEL -int nfs_boot_init (struct nfs_diskless *, struct lwp *); -void nfs_boot_cleanup (struct nfs_diskless *, struct lwp *); -int nfs_boot_ifupdown (struct ifnet *, struct lwp *, int); -int nfs_boot_setaddress (struct ifnet *, struct lwp *, - uint32_t, uint32_t, uint32_t); +struct lwp; + +int nfs_boot_init(struct nfs_diskless *, struct lwp *); +void nfs_boot_cleanup(struct nfs_diskless *, struct lwp *); +int nfs_boot_ifupdown(struct ifnet *, struct lwp *, int); +int nfs_boot_setaddress(struct ifnet *, struct lwp *, + uint32_t, uint32_t, uint32_t); void nfs_boot_setmtu (struct ifnet *, int, struct lwp *); -int nfs_boot_deladdress (struct ifnet *, struct lwp *, uint32_t); -void nfs_boot_flushrt (struct ifnet *); -int nfs_boot_setrecvtimo (struct socket *); -int nfs_boot_enbroadcast (struct socket *); -int nfs_boot_sobind_ipport (struct socket *, uint16_t, struct lwp *); -int nfs_boot_sendrecv (struct socket *, struct sockaddr_in *, - int (*)(struct mbuf*, void*, int), struct mbuf*, - int (*)(struct mbuf**, void*), struct mbuf**, - struct mbuf**, void*, struct lwp *); - -int nfs_bootdhcp (struct nfs_diskless *, struct lwp *, int *); -int nfs_bootparam (struct nfs_diskless *, struct lwp *, int *); -int nfs_bootstatic (struct nfs_diskless *, struct lwp *, int *); +int nfs_boot_deladdress(struct ifnet *, struct lwp *, uint32_t); +void nfs_boot_flushrt(struct ifnet *); +int nfs_boot_setrecvtimo(struct socket *); +int nfs_boot_enbroadcast(struct socket *); +int nfs_boot_sobind_ipport(struct socket *, uint16_t, struct lwp *); +int nfs_boot_sendrecv(struct socket *, struct sockaddr_in *, + int (*)(struct mbuf *, void*, int), struct mbuf *, + int (*)(struct mbuf **, void*), struct mbuf **, + struct mbuf **, void*, struct lwp *); + +int nfs_bootdhcp(struct nfs_diskless *, struct lwp *, int *); +int nfs_bootparam(struct nfs_diskless *, struct lwp *, int *); +int nfs_bootstatic(struct nfs_diskless *, struct lwp *, int *); extern int (*nfs_bootstatic_callback)(struct nfs_diskless *); @@ -96,7 +111,9 @@ extern int (*nfs_bootstatic_callback)(st #define NFS_BOOT_NOSTATIC 0x20 #define NFS_BOOT_HAS_ROOTPATH 0x40 -#define NFS_BOOT_ALLINFO (NFS_BOOT_HAS_MYIP|NFS_BOOT_HAS_GWIP|NFS_BOOT_HAS_MASK|NFS_BOOT_HAS_SERVADDR|NFS_BOOT_HAS_SERVER|NFS_BOOT_HAS_ROOTPATH) +#define NFS_BOOT_ALLINFO \ + (NFS_BOOT_HAS_MYIP|NFS_BOOT_HAS_GWIP|NFS_BOOT_HAS_MASK| \ + NFS_BOOT_HAS_SERVADDR|NFS_BOOT_HAS_SERVER|NFS_BOOT_HAS_ROOTPATH) #endif /* _KERNEL */ Index: src/sys/nfs/nfsm_subs.h diff -u src/sys/nfs/nfsm_subs.h:1.58 src/sys/nfs/nfsm_subs.h:1.59 --- src/sys/nfs/nfsm_subs.h:1.58 Fri Jul 5 04:31:54 2024 +++ src/sys/nfs/nfsm_subs.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfsm_subs.h,v 1.58 2024/07/05 04:31:54 rin Exp $ */ +/* $NetBSD: nfsm_subs.h,v 1.59 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1989, 1993 @@ -34,7 +34,6 @@ * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 */ - #ifndef _NFS_NFSM_SUBS_H_ #define _NFS_NFSM_SUBS_H_ @@ -572,4 +571,4 @@ break; \ }; } -#endif +#endif /* _NFS_NFSM_SUBS_H_ */ Index: src/sys/nfs/nfsmount.h diff -u src/sys/nfs/nfsmount.h:1.53 src/sys/nfs/nfsmount.h:1.54 --- src/sys/nfs/nfsmount.h:1.53 Wed Jul 15 03:28:55 2015 +++ src/sys/nfs/nfsmount.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfsmount.h,v 1.53 2015/07/15 03:28:55 manu Exp $ */ +/* $NetBSD: nfsmount.h,v 1.54 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1989, 1993 @@ -34,9 +34,8 @@ * @(#)nfsmount.h 8.3 (Berkeley) 3/30/95 */ - #ifndef _NFS_NFSMOUNT_H_ -#define _NFS_NFSMOUNT_H_ +#define _NFS_NFSMOUNT_H_ #if defined(_KERNEL) && !defined(NFS_ARGS_ONLY) #include <sys/condvar.h> @@ -200,4 +199,4 @@ void nfs_vfs_done(void); #endif /* _KERNEL */ -#endif +#endif /* _NFS_NFSMOUNT_H_ */ Index: src/sys/nfs/nfsnode.h diff -u src/sys/nfs/nfsnode.h:1.76 src/sys/nfs/nfsnode.h:1.77 --- src/sys/nfs/nfsnode.h:1.76 Thu Oct 21 13:21:55 2021 +++ src/sys/nfs/nfsnode.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfsnode.h,v 1.76 2021/10/21 13:21:55 andvar Exp $ */ +/* $NetBSD: nfsnode.h,v 1.77 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1989, 1993 @@ -36,14 +36,18 @@ #ifndef _NFS_NFSNODE_H_ -#define _NFS_NFSNODE_H_ +#define _NFS_NFSNODE_H_ + +#include <sys/types.h> #include <sys/condvar.h> #include <sys/mutex.h> +#include <sys/queue.h> +#include <sys/timespec.h> -#ifndef _NFS_NFS_H_ #include <nfs/nfs.h> -#endif +#include <nfs/nfsproto.h> + #include <miscfs/genfs/genfs.h> #include <miscfs/genfs/genfs_node.h> @@ -62,7 +66,6 @@ * the cookies are stored. */ - LIST_HEAD(nfsdirhashhead, nfsdircache); TAILQ_HEAD(nfsdirchainhead, nfsdircache); @@ -280,4 +283,4 @@ extern int (**nfsv2_vnodeop_p)(void *); #endif /* _KERNEL */ -#endif +#endif /* _NFS_NFSNODE_H_ */ Index: src/sys/nfs/nfsproto.h diff -u src/sys/nfs/nfsproto.h:1.17 src/sys/nfs/nfsproto.h:1.18 --- src/sys/nfs/nfsproto.h:1.17 Wed Dec 27 12:10:09 2006 +++ src/sys/nfs/nfsproto.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfsproto.h,v 1.17 2006/12/27 12:10:09 yamt Exp $ */ +/* $NetBSD: nfsproto.h,v 1.18 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,6 +37,9 @@ #ifndef _NFS_NFSPROTO_H_ #define _NFS_NFSPROTO_H_ +#include <sys/types.h> + +#include <sys/fstypes.h> /* * nfs definitions as per the Version 2 and 3 specs @@ -432,4 +435,4 @@ struct nfsv3_pathconf { u_int32_t pc_casepreserving; }; -#endif +#endif /* _NFS_NFSPROTO_H_ */ Index: src/sys/nfs/nfsrtt.h diff -u src/sys/nfs/nfsrtt.h:1.10 src/sys/nfs/nfsrtt.h:1.11 --- src/sys/nfs/nfsrtt.h:1.10 Fri Sep 5 05:34:41 2014 +++ src/sys/nfs/nfsrtt.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfsrtt.h,v 1.10 2014/09/05 05:34:41 matt Exp $ */ +/* $NetBSD: nfsrtt.h,v 1.11 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -34,9 +34,13 @@ * @(#)nfsrtt.h 8.2 (Berkeley) 3/30/95 */ - #ifndef _NFS_NFSRTT_H_ -#define _NFS_NFSRTT_H_ +#define _NFS_NFSRTT_H_ + +#include <sys/types.h> + +#include <sys/fstypes.h> +#include <sys/time.h> /* * Definitions for performance monitor. @@ -103,4 +107,4 @@ struct nfsdrt { extern int nfsrtton; #endif -#endif +#endif /* _NFS_NFSRTT_H_ */ Index: src/sys/nfs/nfsrvcache.h diff -u src/sys/nfs/nfsrvcache.h:1.16 src/sys/nfs/nfsrvcache.h:1.17 --- src/sys/nfs/nfsrvcache.h:1.16 Tue Dec 4 17:42:32 2007 +++ src/sys/nfs/nfsrvcache.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nfsrvcache.h,v 1.16 2007/12/04 17:42:32 yamt Exp $ */ +/* $NetBSD: nfsrvcache.h,v 1.17 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1989, 1993 @@ -34,10 +34,16 @@ * @(#)nfsrvcache.h 8.3 (Berkeley) 3/30/95 */ - #ifndef _NFS_NFSRVCACHE_H_ #define _NFS_NFSRVCACHE_H_ +#include <sys/types.h> + +#include <sys/condvar.h> +#include <sys/queue.h> + +#include <nfs/nfs.h> + /* * Definitions for the server recent request cache */ @@ -85,4 +91,4 @@ struct nfsrvcache { #define RC_INETADDR 0x20 #define RC_NAM 0x40 -#endif +#endif /* _NFS_NFSRVCACHE_H_ */ Index: src/sys/nfs/rpcv2.h diff -u src/sys/nfs/rpcv2.h:1.12 src/sys/nfs/rpcv2.h:1.13 --- src/sys/nfs/rpcv2.h:1.12 Thu Dec 28 00:39:03 2006 +++ src/sys/nfs/rpcv2.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: rpcv2.h,v 1.12 2006/12/28 00:39:03 yamt Exp $ */ +/* $NetBSD: rpcv2.h,v 1.13 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1989, 1993 @@ -34,10 +34,11 @@ * @(#)rpcv2.h 8.2 (Berkeley) 3/30/95 */ - #ifndef _NFS_RPCV2_H_ #define _NFS_RPCV2_H_ +#include <sys/types.h> + /* * Definitions for Sun RPC Version 2, from * "RPC: Remote Procedure Call Protocol Specification" RFC1057 @@ -142,4 +143,5 @@ typedef u_char NFSKERBKEYSCHED_T[2]; #define NFS_KERBTTL (30 * 60) /* Credential ttl (sec) */ #define NFS_KERBCLOCKSKEW (5 * 60) /* Clock skew (sec) */ #define NFS_KERBW1(t) (*((u_long *)(&((t).dat[((t).length + 3) & ~0x3])))) -#endif + +#endif /* _NFS_RPCV2_H_ */ Index: src/sys/nfs/xdr_subs.h diff -u src/sys/nfs/xdr_subs.h:1.15 src/sys/nfs/xdr_subs.h:1.16 --- src/sys/nfs/xdr_subs.h:1.15 Sun Dec 11 12:25:17 2005 +++ src/sys/nfs/xdr_subs.h Sat Dec 7 02:05:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: xdr_subs.h,v 1.15 2005/12/11 12:25:17 christos Exp $ */ +/* $NetBSD: xdr_subs.h,v 1.16 2024/12/07 02:05:55 riastradh Exp $ */ /* * Copyright (c) 1989, 1993 @@ -34,7 +34,6 @@ * @(#)xdr_subs.h 8.3 (Berkeley) 3/30/95 */ - #ifndef _NFS_XDR_SUBS_H_ #define _NFS_XDR_SUBS_H_ @@ -72,14 +71,16 @@ #define fxdr_nfsv2time(f, t) { \ (t)->tv_sec = ntohl(((struct nfsv2_time *)(f))->nfsv2_sec); \ if (((struct nfsv2_time *)(f))->nfsv2_usec != 0xffffffff) \ - (t)->tv_nsec = 1000 * ntohl(((struct nfsv2_time *)(f))->nfsv2_usec); \ + (t)->tv_nsec = 1000 * \ + ntohl(((struct nfsv2_time *)(f))->nfsv2_usec); \ else \ (t)->tv_nsec = 0; \ } #define txdr_nfsv2time(f, t) { \ ((struct nfsv2_time *)(t))->nfsv2_sec = htonl((f)->tv_sec); \ if ((f)->tv_nsec != -1) \ - ((struct nfsv2_time *)(t))->nfsv2_usec = htonl((f)->tv_nsec / 1000); \ + ((struct nfsv2_time *)(t))->nfsv2_usec = \ + htonl((f)->tv_nsec / 1000); \ else \ ((struct nfsv2_time *)(t))->nfsv2_usec = 0xffffffff; \ } @@ -103,4 +104,4 @@ ((u_int32_t *)(t))[1] = htonl((u_int32_t)((f) & 0xffffffff)); \ } -#endif +#endif /* _NFS_XDR_SUBS_H_ */