Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/nfs/common Mostly mechanical updates for caddr_t, thr...



details:   https://anonhg.NetBSD.org/src/rev/a3401f1d205e
branches:  trunk
changeset: 819682:a3401f1d205e
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Dec 13 22:52:46 2016 +0000

description:
Mostly mechanical updates for caddr_t, thread, mutex, and credentials

diffstat:

 sys/fs/nfs/common/bootp_subr.c      |  129 +++++++++++----------
 sys/fs/nfs/common/krpc.h            |    6 +-
 sys/fs/nfs/common/nfs.h             |   18 +-
 sys/fs/nfs/common/nfs_mountcommon.h |    8 +-
 sys/fs/nfs/common/nfs_var.h         |  205 +++++++++++++++++------------------
 sys/fs/nfs/common/nfsclstate.h      |    8 +-
 sys/fs/nfs/common/nfsm_subs.h       |   10 +-
 sys/fs/nfs/common/nfsport.h         |   99 +++++++++--------
 sys/fs/nfs/common/nfsrvcache.h      |    6 +-
 sys/fs/nfs/common/nfsrvstate.h      |    6 +-
 10 files changed, 255 insertions(+), 240 deletions(-)

diffs (truncated from 1360 to 300 lines):

diff -r c34af7e65224 -r a3401f1d205e sys/fs/nfs/common/bootp_subr.c
--- a/sys/fs/nfs/common/bootp_subr.c    Tue Dec 13 22:49:02 2016 +0000
+++ b/sys/fs/nfs/common/bootp_subr.c    Tue Dec 13 22:52:46 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootp_subr.c,v 1.2 2016/11/18 22:37:50 pgoyette Exp $  */
+/*     $NetBSD: bootp_subr.c,v 1.3 2016/12/13 22:52:46 pgoyette Exp $  */
 /*-
  * Copyright (c) 1995 Gordon Ross, Adam Glass
  * Copyright (c) 1992 Regents of the University of California.
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 /* __FBSDID("FreeBSD: head/sys/nfs/bootp_subr.c 297326 2016-03-27 23:16:37Z ian "); */
-__RCSID("$NetBSD: bootp_subr.c,v 1.2 2016/11/18 22:37:50 pgoyette Exp $");
+__RCSID("$NetBSD: bootp_subr.c,v 1.3 2016/12/13 22:52:46 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_newnfs.h"
@@ -63,6 +63,14 @@
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/uio.h>
+#include <sys/kauth.h>
+#include <sys/lwp.h>
+#include <sys/vnode.h>
+#include <sys/mutex.h>
+
+#if 0
+#include <src/include/rpc/auth.h>
+#endif
 
 #include <net/if.h>
 #include <net/route.h>
@@ -76,6 +84,10 @@
 #include <net/if_dl.h>
 
 #include <fs/nfs/common/nfsproto.h>
+#include <fs/nfs/common/nfsport.h>
+#include <fs/nfs/common/nfs.h>
+#include <fs/nfs/client/nfsmount.h>
+#include <fs/nfs/client/nfsnode.h>
 #include <fs/nfs/client/nfs.h>
 #include <fs/nfs/common/nfsdiskless.h>
 #include <fs/nfs/common/krpc.h>
@@ -236,13 +248,16 @@
 
 static char bootp_cookie[128];
 static struct socket *bootp_so;
+
+#if 0  /* Need to init sysctl variables in the module initialization code */
 SYSCTL_STRING(_kern, OID_AUTO, bootp_cookie, CTLFLAG_RD,
        bootp_cookie, 0, "Cookie (T134) supplied by bootp server");
+#endif
 
 /* mountd RPC */
 static int     md_mount(struct sockaddr_in *mdsin, char *path, u_char *fhp,
-                   int *fhsizep, struct nfs_args *args, struct thread *td);
-static int     setfs(struct sockaddr_in *addr, char *path, char *p,
+                   int *fhsizep, struct nfs_args *args, struct lwp *td);
+static int     setmyfs(struct sockaddr_in *addr, char *path, char *p,
                    const struct in_addr *siaddr);
 static int     getdec(char **ptr);
 static int     getip(char **ptr, struct in_addr *ip);
@@ -254,7 +269,7 @@
 static void    clear_sinaddr(struct sockaddr_in *sin);
 static void    allocifctx(struct bootpc_globalcontext *gctx);
 static void    bootpc_compose_query(struct bootpc_ifcontext *ifctx,
-                   struct thread *td);
+                   struct lwp *td);
 static unsigned char *bootpc_tag(struct bootpc_tagcontext *tctx,
                    struct bootp_packet *bp, int len, int tag);
 static void bootpc_tag_helper(struct bootpc_tagcontext *tctx,
@@ -270,13 +285,13 @@
 #endif
 
 static int     bootpc_call(struct bootpc_globalcontext *gctx,
-                   struct thread *td);
+                   struct lwp *td);
 
 static void    bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx,
-                   struct thread *td);
+                   struct lwp *td);
 
 static void    bootpc_adjust_interface(struct bootpc_ifcontext *ifctx,
-                   struct bootpc_globalcontext *gctx, struct thread *td);
+                   struct bootpc_globalcontext *gctx, struct lwp *td);
 
 static void    bootpc_decode_reply(struct nfsv3_diskless *nd,
                    struct bootpc_ifcontext *ifctx,
@@ -577,7 +592,7 @@
 }
 
 static int
-bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td)
+bootpc_call(struct bootpc_globalcontext *gctx, struct lwp *td)
 {
        struct sockaddr_in *sin, dst;
        struct uio auio;
@@ -595,14 +610,10 @@
 
        tv.tv_sec = 1;
        tv.tv_usec = 0;
-       bzero(&sopt, sizeof(sopt));
-       sopt.sopt_dir = SOPT_SET;
-       sopt.sopt_level = SOL_SOCKET;
-       sopt.sopt_name = SO_RCVTIMEO;
-       sopt.sopt_val = &tv;
-       sopt.sopt_valsize = sizeof tv;
+       sockopt_init(&sopt, SOL_SOCKET, SO_RCVTIMEO, sizeof(tv));
+       error = sockopt_set(&sopt, &tv, sizeof(tv));
+       sockopt_destroy(&sopt);
 
-       error = sosetopt(bootp_so, &sopt);
        if (error != 0)
                goto out;
 
@@ -610,11 +621,10 @@
         * Enable broadcast.
         */
        on = 1;
-       sopt.sopt_name = SO_BROADCAST;
-       sopt.sopt_val = &on;
-       sopt.sopt_valsize = sizeof on;
+       sockopt_init(&sopt, SOL_SOCKET, SO_BROADCAST, sizeof(on));
+       error = sockopt_set(&sopt, &on, sizeof(on));
+       sockopt_destroy(&sopt);
 
-       error = sosetopt(bootp_so, &sopt);
        if (error != 0)
                goto out;
 
@@ -623,11 +633,10 @@
         */
 
        on = 1;
-       sopt.sopt_name = SO_DONTROUTE;
-       sopt.sopt_val = &on;
-       sopt.sopt_valsize = sizeof on;
+       sockopt_init(&sopt, SOL_SOCKET, SO_DONTROUTE, sizeof(on));
+       error = sockopt_set(&sopt, &on, sizeof(on));
+       sockopt_destroy(&sopt);
 
-       error = sosetopt(bootp_so, &sopt);
        if (error != 0)
                goto out;
 
@@ -713,16 +722,15 @@
                                        break;
                                }
                                printf("Sending %s packet from "
-                                      "interface %s (%*D)\n",
+                                      "interface %s (%*ld):\n",
                                       s,
                                       ifctx->ireq.ifr_name,
                                       ifctx->sdl->sdl_alen,
-                                      (unsigned char *) LLADDR(ifctx->sdl),
-                                      ":");
+                                      (unsigned char *) LLADDR(ifctx->sdl) );
                                ifctx->sentmsg = 1;
                        }
 
-                       aio.iov_base = (caddr_t) &ifctx->call;
+                       aio.iov_base = (void *) &ifctx->call;
                        aio.iov_len = sizeof(ifctx->call);
 
                        auio.uio_iov = &aio;
@@ -735,7 +743,7 @@
 
                        /* Set netmask to 0.0.0.0 */
                        clear_sinaddr(sin);
-                       error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra,
+                       error = ifioctl(bootp_so, SIOCAIFADDR, (void *)ifra,
                            td);
                        if (error != 0)
                                panic("%s: SIOCAIFADDR, error=%d", __func__,
@@ -749,7 +757,7 @@
 
                        /* Set netmask to 255.0.0.0 */
                        sin->sin_addr.s_addr = htonl(IN_CLASSA_NET);
-                       error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra,
+                       error = ifioctl(bootp_so, SIOCAIFADDR, (void *)ifra,
                            td);
                        if (error != 0)
                                panic("%s: SIOCAIFADDR, error=%d", __func__,
@@ -777,7 +785,7 @@
                 */
                atimo = timo + time_second;
                while (time_second < atimo) {
-                       aio.iov_base = (caddr_t) &gctx->reply;
+                       aio.iov_base = (void *) &gctx->reply;
                        aio.iov_len = sizeof(gctx->reply);
 
                        auio.uio_iov = &aio;
@@ -943,7 +951,7 @@
 }
 
 static void
-bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct thread *td)
+bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct lwp *td)
 {
        struct ifreq *ifr;
        struct in_aliasreq *ifra;
@@ -959,11 +967,11 @@
         * Get the old interface flags and or IFF_UP into them; if
         * IFF_UP set blindly, interface selection can be clobbered.
         */
-       error = ifioctl(bootp_so, SIOCGIFFLAGS, (caddr_t)ifr, td);
+       error = ifioctl(bootp_so, SIOCGIFFLAGS, (void *)ifr, td);
        if (error != 0)
                panic("%s: SIOCGIFFLAGS, error=%d", __func__, error);
        ifr->ifr_flags |= IFF_UP;
-       error = ifioctl(bootp_so, SIOCSIFFLAGS, (caddr_t)ifr, td);
+       error = ifioctl(bootp_so, SIOCSIFFLAGS, (void *)ifr, td);
        if (error != 0)
                panic("%s: SIOCSIFFLAGS, error=%d", __func__, error);
 
@@ -980,13 +988,13 @@
        sin = (struct sockaddr_in *)&ifra->ifra_broadaddr;
        clear_sinaddr(sin);
        sin->sin_addr.s_addr = htonl(INADDR_BROADCAST);
-       error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td);
+       error = ifioctl(bootp_so, SIOCAIFADDR, (void *)ifra, td);
        if (error != 0)
                panic("%s: SIOCAIFADDR, error=%d", __func__, error);
 }
 
 static void
-bootpc_shutdown_interface(struct bootpc_ifcontext *ifctx, struct thread *td)
+bootpc_shutdown_interface(struct bootpc_ifcontext *ifctx, struct lwp *td)
 {
        struct ifreq *ifr;
        struct sockaddr_in *sin;
@@ -995,24 +1003,24 @@
        ifr = &ifctx->ireq;
 
        printf("Shutdown interface %s\n", ifctx->ireq.ifr_name);
-       error = ifioctl(bootp_so, SIOCGIFFLAGS, (caddr_t)ifr, td);
+       error = ifioctl(bootp_so, SIOCGIFFLAGS, (void *)ifr, td);
        if (error != 0)
                panic("%s: SIOCGIFFLAGS, error=%d", __func__, error);
        ifr->ifr_flags &= ~IFF_UP;
-       error = ifioctl(bootp_so, SIOCSIFFLAGS, (caddr_t)ifr, td);
+       error = ifioctl(bootp_so, SIOCSIFFLAGS, (void *)ifr, td);
        if (error != 0)
                panic("%s: SIOCSIFFLAGS, error=%d", __func__, error);
 
        sin = (struct sockaddr_in *) &ifr->ifr_addr;
        clear_sinaddr(sin);
-       error = ifioctl(bootp_so, SIOCDIFADDR, (caddr_t) ifr, td);
+       error = ifioctl(bootp_so, SIOCDIFADDR, (void *) ifr, td);
        if (error != 0)
                panic("%s: SIOCDIFADDR, error=%d", __func__, error);
 }
 
 static void
 bootpc_adjust_interface(struct bootpc_ifcontext *ifctx,
-    struct bootpc_globalcontext *gctx, struct thread *td)
+    struct bootpc_globalcontext *gctx, struct lwp *td)
 {
        int error;
        struct sockaddr_in *sin;
@@ -1039,7 +1047,7 @@
                printf(" (MTU=%d%s)", ifctx->mtu, 
                    (ifctx->mtu > 1514) ? "/JUMBO" : "");
                ifr->ifr_mtu = ifctx->mtu;
-               error = ifioctl(bootp_so, SIOCSIFMTU, (caddr_t) ifr, td);
+               error = ifioctl(bootp_so, SIOCSIFMTU, (void *) ifr, td);
                if (error != 0)
                        panic("%s: SIOCSIFMTU, error=%d", __func__, error);
        }
@@ -1051,7 +1059,7 @@
         */
        sin = (struct sockaddr_in *) &ifr->ifr_addr;
        clear_sinaddr(sin);
-       error = ifioctl(bootp_so, SIOCDIFADDR, (caddr_t) ifr, td);
+       error = ifioctl(bootp_so, SIOCDIFADDR, (void *) ifr, td);
        if (error != 0)
                panic("%s: SIOCDIFADDR, error=%d", __func__, error);
 
@@ -1061,7 +1069,7 @@
        ifra->ifra_broadaddr.sin_addr.s_addr = myaddr->sin_addr.s_addr |
            ~netmask->sin_addr.s_addr;
 
-       error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td);
+       error = ifioctl(bootp_so, SIOCAIFADDR, (void *)ifra, td);
        if (error != 0)
                panic("%s: SIOCAIFADDR, error=%d", __func__, error);
 }
@@ -1109,7 +1117,7 @@
 }
 
 static int
-setfs(struct sockaddr_in *addr, char *path, char *p,
+setmyfs(struct sockaddr_in *addr, char *path, char *p,
     const struct in_addr *siaddr)
 {
 
@@ -1248,7 +1256,7 @@
 }
 



Home | Main Index | Thread Index | Old Index