svn commit: r189230 - head/sys/net

Robert Watson rwatson at FreeBSD.org
Sun Mar 1 04:42:57 PST 2009


Author: rwatson
Date: Sun Mar  1 12:42:54 2009
New Revision: 189230
URL: http://svn.freebsd.org/changeset/base/189230

Log:
  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

Modified:
  head/sys/net/if_var.h

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Sun Mar  1 11:20:35 2009	(r189229)
+++ head/sys/net/if_var.h	Sun Mar  1 12:42:54 2009	(r189230)
@@ -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 *);


More information about the svn-src-head mailing list