From 3055e123d704b5854fd2a3ad2fae4bcd5d3daae6 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sun, 1 Mar 2009 12:42:54 +0000 Subject: [PATCH] Do a bit of struct ifnet cleanup in preparation for 8.0: group function pointers together, move padding to the bottom of the structure, and add two new integer spares due to attrition over time. Remove unused spare "flags" field, we can use one of the spare ints if we need it later. This change requires a rebuild of device driver modules that depend on the layout of ifnet for binary compatibility reasons. Discussed with: kmacy --- sys/net/if_var.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 250bed95cc22..3ff019f27bd1 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -162,10 +162,13 @@ struct ifnet { (void *); int (*if_resolvemulti) /* validate/resolve multicast */ (struct ifnet *, struct sockaddr **, struct sockaddr *); + void (*if_qflush) /* flush any queues */ + (struct ifnet *); + int (*if_transmit) /* initiate output routine */ + (struct ifnet *, struct mbuf *); struct ifaddr *if_addr; /* pointer to link-level address */ void *if_llsoftc; /* link layer softc */ int if_drv_flags; /* driver-managed status flags */ - u_int if_spare_flags2; /* spare flags 2 */ struct ifaltq if_snd; /* output queue (includes altq) */ const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ @@ -187,12 +190,14 @@ struct ifnet { /* protected by if_addr_mtx */ void *if_pf_kif; void *if_lagg; /* lagg glue */ - void *if_pspare[8]; /* TOE 3; vimage 3; general use 4 */ - void (*if_qflush) /* flush any queues */ - (struct ifnet *); - int (*if_transmit) /* initiate output routine */ - (struct ifnet *, struct mbuf *); - int if_ispare[2]; /* general use 2 */ + + /* + * Spare fields are added so that we can modify sensitive data + * structures without changing the kernel binary interface, and must + * be used with care where binary compatibility is required. + */ + void *if_pspare[8]; + int if_ispare[4]; }; typedef void if_init_f_t(void *);