Skip to content

Commit 3077532

Browse files
committed
vtnet, ptnet: include opt_*.h files early
Include opt_inet.h and opt_inet6.h early in the files including virtio_net.h, since they use INET and/or INET6. While there, remove redundant inclusion of sys/types.h, since it is included already by sys/param.h. There was a discussion to include opt_inet.h and opt_inet6.h also in virtio_net.h. glebius suggested to add a mechanism for files to check, if required opt_*.h files were included. virtio_net.h will be the first consumer of this mechanism. Reviewed by: glebius, Peter Lei MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D52046
1 parent ac87d70 commit 3077532

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

sys/dev/netmap/if_ptnet.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
/* Driver for ptnet paravirtualized network device. */
2828

2929
#include <sys/cdefs.h>
30+
#include "opt_inet.h"
31+
#include "opt_inet6.h"
3032

31-
#include <sys/types.h>
3233
#include <sys/param.h>
3334
#include <sys/systm.h>
3435
#include <sys/kernel.h>
@@ -75,9 +76,6 @@
7576
#include <dev/pci/pcivar.h>
7677
#include <dev/pci/pcireg.h>
7778

78-
#include "opt_inet.h"
79-
#include "opt_inet6.h"
80-
8179
#include <sys/selinfo.h>
8280
#include <net/netmap.h>
8381
#include <dev/netmap/netmap_kern.h>

sys/dev/virtio/network/if_vtnet.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
/* Driver for VirtIO network devices. */
3030

31+
#include "opt_inet.h"
32+
#include "opt_inet6.h"
33+
3134
#include <sys/param.h>
3235
#include <sys/eventhandler.h>
3336
#include <sys/systm.h>
@@ -82,9 +85,6 @@
8285
#include <dev/virtio/network/if_vtnetvar.h>
8386
#include "virtio_if.h"
8487

85-
#include "opt_inet.h"
86-
#include "opt_inet6.h"
87-
8888
#if defined(INET) || defined(INET6)
8989
#include <machine/in_cksum.h>
9090
#endif

0 commit comments

Comments
 (0)