From owner-svn-src-projects@FreeBSD.ORG Thu Jan 22 23:59:37 2015 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 270D4DAA; Thu, 22 Jan 2015 23:59:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 130EF9DF; Thu, 22 Jan 2015 23:59:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0MNxat2095055; Thu, 22 Jan 2015 23:59:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0MNxaYb095053; Thu, 22 Jan 2015 23:59:36 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201501222359.t0MNxaYb095053@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 22 Jan 2015 23:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r277542 - projects/ifnet/sys/net X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jan 2015 23:59:37 -0000 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) {