Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jan 2015 23:59:36 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r277542 - projects/ifnet/sys/net
Message-ID:  <201501222359.t0MNxaYb095053@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Thu Jan 22 23:59:35 2015
New Revision: 277542
URL: https://svnweb.freebsd.org/changeset/base/277542

Log:
  Remove the if_set(), if_get() and associated functions.
  
  Requested by:	rwatson

Modified:
  projects/ifnet/sys/net/if.c
  projects/ifnet/sys/net/if.h

Modified: projects/ifnet/sys/net/if.c
==============================================================================
--- projects/ifnet/sys/net/if.c	Thu Jan 22 23:50:47 2015	(r277541)
+++ projects/ifnet/sys/net/if.c	Thu Jan 22 23:59:35 2015	(r277542)
@@ -1513,111 +1513,26 @@ if_rtdel(struct radix_node *rn, void *ar
 }
 
 /*
- * Managing different integer values and bitmasks of an ifnet.
+ * Returning different software contexts associated with ifnet.
  */
-static void
-if_getfeature(if_t ifp, ift_feature f, uint32_t **f32, uint64_t **f64,
-    void **ptr)
+void *
+if_getsoftc(struct ifnet *ifp, ift_feature f)
 {
 
-	if (f32)
-		*f32 = NULL;
-	if (f64)
-		*f64 = NULL;
-	if (ptr)
-		*ptr = NULL;
-
 	switch (f) {
 	case IF_DRIVER_SOFTC:
-		*ptr = ifp->if_softc;
-		break;
+		return (ifp->if_softc);
 	case IF_LLADDR:
-		*ptr = LLADDR((struct sockaddr_dl *)(ifp->if_addr->ifa_addr));
-		break;
+		return (LLADDR((struct sockaddr_dl *)(ifp->if_addr->ifa_addr)));
 	case IF_BPF:
-		*ptr = ifp->if_bpf;
-		break;
+		return (ifp->if_bpf);
 	case IF_NAME:
-		*ptr = ifp->if_xname;
-		break;
+		return (ifp->if_xname);
 	default:
 		panic("%s: unknown feature %d", __func__, f);
 	};
 }
 
-void
-if_set(if_t ifp, ift_feature f, uint64_t set)
-{
-	uint64_t *f64;
-	uint32_t *f32;
-
-	if_getfeature(ifp, f, &f32, &f64, NULL);
-	KASSERT(f32 != NULL || f64 != NULL, ("%s: no feature %d", __func__, f));
-	if (f32 != NULL) {
-		KASSERT(set <= UINT32_MAX,
-		    ("%s: value of 0x%jx for feature %d",
-		    __func__, (uintmax_t )set, f));
-		*f32 = set;
-	} else {
-		*f64 = set;
-	}
-}
-
-uint64_t
-if_flagbits(if_t ifp, ift_feature f, uint64_t set, uint64_t clr, uint64_t xor)
-{
-	uint64_t *f64;
-	uint32_t *f32;
-
-	if_getfeature(ifp, f, &f32, &f64, NULL);
-	if (f32 != NULL) {
-		KASSERT(set <= UINT32_MAX,
-		    ("%s: value of 0x%jx for feature %d",
-		    __func__, (uintmax_t )set, f));
-		KASSERT(clr <= UINT32_MAX,
-		    ("%s: value of 0x%jx for feature %d",
-		    __func__, (uintmax_t )clr, f));
-		KASSERT(xor <= UINT32_MAX,
-		    ("%s: value of 0x%jx for feature %d",
-		    __func__, (uintmax_t )xor, f));
-		*f32 |= set;
-		*f32 &= ~clr;
-		*f32 ^= xor;
-		return (*f32);
-	} else {
-		*f64 |= set;
-		*f64 &= ~clr;
-		*f64 ^= xor;
-		return (*f64);
-	}
-}
-
-uint64_t
-if_get(if_t ifp, ift_feature f)
-{
-	uint64_t *f64;
-	uint32_t *f32;
-
-	if_getfeature(ifp, f, &f32, &f64, NULL);
-	KASSERT(f32 != NULL || f64 != NULL,
-	    ("%s: no feature %d", __func__, f));
-	if (f64 != NULL)
-		return (*f64);
-	if (f32 != NULL)
-		return (*f32);
-
-	return (EDOOFUS);
-}
-
-void *
-if_getsoftc(if_t ifp, ift_feature f)
-{
-	void *ptr;
-
-	if_getfeature(ifp, f, NULL, NULL, &ptr);
-	return (ptr);
-}
-
 /*
  * Return counter values from counter(9)s stored in ifnet.
  */

Modified: projects/ifnet/sys/net/if.h
==============================================================================
--- projects/ifnet/sys/net/if.h	Thu Jan 22 23:50:47 2015	(r277541)
+++ projects/ifnet/sys/net/if.h	Thu Jan 22 23:59:35 2015	(r277542)
@@ -716,12 +716,9 @@ void	if_inc_counter(if_t, ift_counter, i
 void	if_inc_txcounters(if_t, struct mbuf *);
 void	if_setbaudrate(if_t, uint64_t);
 void	if_link_state_change(if_t, int);
-void	if_set(if_t, ift_feature, uint64_t);
 void *	if_getsoftc(if_t, ift_feature);
 int	if_printf(if_t, const char *, ...) __printflike(2, 3);
 int	if_drvioctl(u_long, struct ifnet *, void *, struct thread *);
-uint64_t if_get(if_t, ift_feature);
-uint64_t if_flagbits(if_t, ift_feature, uint64_t, uint64_t, uint64_t);
 uint64_t if_get_counter_default(if_t, ift_counter);
 
 /*
@@ -750,29 +747,8 @@ struct mbuf * if_snd_dequeue(if_t);
 void	if_snd_prepend(if_t, struct mbuf *);
 
 /*
- * Type-enforcing inliners over declared above functions.
+ * Type-enforcing inliners over if_getsoftc().
  */
-static inline uint64_t
-if_addflags(if_t ifp, ift_feature f, uint64_t add)
-{
-
-	return (if_flagbits(ifp, f, add, 0, 0));
-}
-
-static inline uint64_t
-if_clrflags(if_t ifp, ift_feature f, uint64_t clr)
-{
-
-	return (if_flagbits(ifp, f, 0, clr, 0));
-}
-
-static inline uint64_t
-if_xorflags(if_t ifp, ift_feature f, uint64_t xor)
-{
-
-	return (if_flagbits(ifp, f, 0, 0, xor));
-}
-
 static inline char *
 if_lladdr(if_t ifp)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501222359.t0MNxaYb095053>