From 13431b3eda8882f866cef27ae66cc52986190392 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 1 Jan 2014 21:08:08 +0100 Subject: [PATCH] netmap: fix all the cdev prototypes While there, reduce diff noise against vanilla sources. --- sys/net/netmap/netmap.c | 21 +++++++---------- sys/net/netmap/netmap_freebsd.c | 40 +++++++++++++++++---------------- sys/net/netmap/netmap_generic.c | 3 +-- sys/net/netmap/netmap_kern.h | 6 ++--- 4 files changed, 33 insertions(+), 37 deletions(-) diff --git a/sys/net/netmap/netmap.c b/sys/net/netmap/netmap.c index 5eda96d5b2..84ed66296f 100644 --- a/sys/net/netmap/netmap.c +++ b/sys/net/netmap/netmap.c @@ -138,19 +138,17 @@ ports attached to the switch) #include #include /* struct socket */ #include -#include -#include -#include #include #include #include /* sockaddrs */ +#include #include -#include /* bus_dmamap_* */ -#include -#include #include #include #include /* BIOCIMMEDIATE */ +#include /* bus_dmamap_* */ +#include +#include /* reduce conditional code */ #define init_waitqueue_head(x) // only needed in linux @@ -1283,20 +1281,17 @@ out: * Return 0 on success, errno otherwise. */ int -netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data, - int fflag, struct thread *td) +netmap_ioctl(struct dev_ioctl_args *ap) { struct netmap_priv_d *priv = NULL; struct ifnet *ifp = NULL; - struct nmreq *nmr = (struct nmreq *) data; + struct nmreq *nmr = (struct nmreq *) ap->a_data; struct netmap_adapter *na = NULL; int error; u_int i, lim; struct netmap_if *nifp; struct netmap_kring *krings; - - (void)dev; /* UNUSED */ - (void)fflag; /* UNUSED */ + u_long cmd = ap->a_cmd; #if 0 error = devfs_get_cdevpriv((void **)&priv); @@ -1507,7 +1502,7 @@ netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data, } ifp = na->ifp; // so->so_proto not null. - error = ifioctl(&so, cmd, data, td); + error = ifioctl(&so, cmd, ap->a_data, ap->a_cred); netmap_adapter_put(na); NMG_UNLOCK(); break; diff --git a/sys/net/netmap/netmap_freebsd.c b/sys/net/netmap/netmap_freebsd.c index 11b5cd0cb4..3fbe00222b 100644 --- a/sys/net/netmap/netmap_freebsd.c +++ b/sys/net/netmap/netmap_freebsd.c @@ -26,13 +26,10 @@ #include #include #include -#include #include /* defines used in kernel.h */ #include /* types used in module initialization */ #include /* DEV_MODULE */ -#include /* bus_dmamap_* */ -#include -#include /* sockaddrs */ +#include #include /* vtophys */ #include /* vtophys */ @@ -42,10 +39,15 @@ #include #include + +#include +#include /* sockaddrs */ +#include #include #include -#include +#include /* bus_dmamap_* */ +#include #include "netmap_kern.h" #include "netmap_mem2.h" @@ -278,12 +280,16 @@ static struct cdev_pager_ops netmap_cdev_pager_ops = { static int -netmap_mmap_single(struct cdev *cdev, vm_ooffset_t *foff, - vm_size_t objsize, vm_object_t *objp, int prot) +netmap_mmap_single(struct dev_mmap_single_args *ap) { int error; + struct cdev *cdev = ap->a_head.a_dev; + vm_ooffset_t *foff = ap->a_offset; + vm_object_t *objp = ap->a_object; + vm_size_t objsize = ap->a_size; struct netmap_vm_handle_t *vmh; struct netmap_priv_d *priv; + int prot = ap->a_nprot; vm_object_t obj; D("cdev %p foff %jd size %jd objp %p prot %d", cdev, @@ -336,27 +342,24 @@ err_unlock: // XXX can we remove this ? static int -netmap_close(struct cdev *dev, int fflag, int devtype, struct thread *td) +netmap_close(struct dev_close_args *ap) { if (netmap_verbose) - D("dev %p fflag 0x%x devtype %d td %p", - dev, fflag, devtype, td); + D("dev %p fflag 0x%x devtype %d", + ap->a_head.a_dev, ap->a_fflag, ap->a_devtype); return 0; } static int -netmap_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +netmap_open(struct dev_open_args *ap) { struct netmap_priv_d *priv; #if 0 int error; #endif - (void)dev; - (void)oflags; - (void)devtype; - (void)td; + (void)ap; // XXX wait or nowait ? priv = kmalloc(sizeof(struct netmap_priv_d), M_DEVBUF, @@ -377,15 +380,14 @@ netmap_open(struct cdev *dev, int oflags, int devtype, struct thread *td) struct dev_ops netmap_cdevsw = { -#if 0 - .d_version = D_VERSION, - .d_name = "netmap", + { "netmap", 0, 0 }, .d_open = netmap_open, .d_mmap_single = netmap_mmap_single, .d_ioctl = netmap_ioctl, +#if 0 .d_poll = netmap_poll, - .d_close = netmap_close, #endif + .d_close = netmap_close, }; diff --git a/sys/net/netmap/netmap_generic.c b/sys/net/netmap/netmap_generic.c index 59799066b6..0b95136d1f 100644 --- a/sys/net/netmap/netmap_generic.c +++ b/sys/net/netmap/netmap_generic.c @@ -65,16 +65,15 @@ #include #include #include -#include #include /* PROT_EXEC */ #include /* sockaddrs */ +#include #include #include #include /* bus_dmamap_* in netmap_kern.h */ // XXX temporary - D() defined here #include - #include "netmap_kern.h" #include "netmap_mem2.h" diff --git a/sys/net/netmap/netmap_kern.h b/sys/net/netmap/netmap_kern.h index aae74da051..15dfbd61a8 100644 --- a/sys/net/netmap/netmap_kern.h +++ b/sys/net/netmap/netmap_kern.h @@ -303,8 +303,7 @@ struct netmap_adapter { void *tailroom; /* space below the rings array */ /* (used for leases) */ - NM_SELINFO_T tx_si; /* global tx wait queue */ - NM_SELINFO_T rx_si; /* global rx wait queue */ + NM_SELINFO_T tx_si, rx_si; /* global wait queues */ /* copy of if_qflush and if_transmit pointers, to intercept * packets from the network stack when netmap is active. @@ -674,7 +673,8 @@ int netmap_get_memory(struct netmap_priv_d* p); void netmap_dtor(void *data); int netmap_dtor_locked(struct netmap_priv_d *priv); -int netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td); +struct dev_ioctl_args; /* XXX this shouldn't be here */ +int netmap_ioctl(struct dev_ioctl_args *ap); /* netmap_adapter creation/destruction */ #define NM_IFPNAME(ifp) ((ifp) ? (ifp)->if_xname : "zombie") -- 2.41.0