diff --git a/sys/net/if.c b/sys/net/if.c --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4199,21 +4199,21 @@ if_getbaudrate(const if_t ifp) { - return (((struct ifnet *)ifp)->if_baudrate); + return (ifp->if_baudrate); } int if_setcapabilities(if_t ifp, int capabilities) { - ((struct ifnet *)ifp)->if_capabilities = capabilities; + ifp->if_capabilities = capabilities; return (0); } int if_setcapabilitiesbit(if_t ifp, int setbit, int clearbit) { - ((struct ifnet *)ifp)->if_capabilities &= ~clearbit; - ((struct ifnet *)ifp)->if_capabilities |= setbit; + ifp->if_capabilities &= ~clearbit; + ifp->if_capabilities |= setbit; return (0); } @@ -4221,23 +4221,21 @@ int if_getcapabilities(const if_t ifp) { - return ((struct ifnet *)ifp)->if_capabilities; + return ifp->if_capabilities; } int if_setcapenable(if_t ifp, int capabilities) { - ((struct ifnet *)ifp)->if_capenable = capabilities; + ifp->if_capenable = capabilities; return (0); } int if_setcapenablebit(if_t ifp, int setcap, int clearcap) { - if(clearcap) - ((struct ifnet *)ifp)->if_capenable &= ~clearcap; - if(setcap) - ((struct ifnet *)ifp)->if_capenable |= setcap; + ifp->if_capenable &= ~clearcap; + ifp->if_capenable |= setcap; return (0); } @@ -4261,7 +4259,7 @@ int if_getcapabilities2(const if_t ifp) { - return ((struct ifnet *)ifp)->if_capabilities2; + return ifp->if_capabilities2; } int @@ -4283,19 +4281,19 @@ const char * if_getdname(const if_t ifp) { - return ((struct ifnet *)ifp)->if_dname; + return ifp->if_dname; } void if_setdname(if_t ifp, const char *dname) { - ((struct ifnet *)ifp)->if_dname = dname; + ifp->if_dname = dname; } const char * if_name(if_t ifp) { - return ((struct ifnet *)ifp)->if_xname; + return ifp->if_xname; } int @@ -4311,39 +4309,39 @@ int if_togglecapenable(if_t ifp, int togglecap) { - ((struct ifnet *)ifp)->if_capenable ^= togglecap; + ifp->if_capenable ^= togglecap; return (0); } int if_getcapenable(const if_t ifp) { - return ((struct ifnet *)ifp)->if_capenable; + return ifp->if_capenable; } int if_togglecapenable2(if_t ifp, int togglecap) { - ((struct ifnet *)ifp)->if_capenable2 ^= togglecap; + ifp->if_capenable2 ^= togglecap; return (0); } int if_getcapenable2(const if_t ifp) { - return ((struct ifnet *)ifp)->if_capenable2; + return ifp->if_capenable2; } int if_getdunit(const if_t ifp) { - return ((struct ifnet *)ifp)->if_dunit; + return ifp->if_dunit; } int if_getindex(const if_t ifp) { - return ((struct ifnet *)ifp)->if_index; + return ifp->if_index; } int @@ -4379,7 +4377,7 @@ int if_getalloctype(const if_t ifp) { - return ((struct ifnet *)ifp)->if_alloctype; + return ifp->if_alloctype; } /* @@ -4397,8 +4395,8 @@ int if_setdrvflagbits(if_t ifp, int set_flags, int clear_flags) { - ((struct ifnet *)ifp)->if_drv_flags &= ~clear_flags; - ((struct ifnet *)ifp)->if_drv_flags |= set_flags; + ifp->if_drv_flags &= ~clear_flags; + ifp->if_drv_flags |= set_flags; return (0); } @@ -4406,13 +4404,13 @@ int if_getdrvflags(const if_t ifp) { - return ((struct ifnet *)ifp)->if_drv_flags; + return ifp->if_drv_flags; } int if_setdrvflags(if_t ifp, int flags) { - ((struct ifnet *)ifp)->if_drv_flags = flags; + ifp->if_drv_flags = flags; return (0); } @@ -4427,8 +4425,8 @@ int if_setflagbits(if_t ifp, int set, int clear) { - ((struct ifnet *)ifp)->if_flags &= ~clear; - ((struct ifnet *)ifp)->if_flags |= set; + ifp->if_flags &= ~clear; + ifp->if_flags |= set; return (0); } @@ -4436,21 +4434,21 @@ int if_getflags(const if_t ifp) { - return ((struct ifnet *)ifp)->if_flags; + return ifp->if_flags; } int if_clearhwassist(if_t ifp) { - ((struct ifnet *)ifp)->if_hwassist = 0; + ifp->if_hwassist = 0; return (0); } int if_sethwassistbits(if_t ifp, int toset, int toclear) { - ((struct ifnet *)ifp)->if_hwassist &= ~toclear; - ((struct ifnet *)ifp)->if_hwassist |= toset; + ifp->if_hwassist &= ~toclear; + ifp->if_hwassist |= toset; return (0); } @@ -4458,34 +4456,34 @@ int if_sethwassist(if_t ifp, int hwassist_bit) { - ((struct ifnet *)ifp)->if_hwassist = hwassist_bit; + ifp->if_hwassist = hwassist_bit; return (0); } int if_gethwassist(const if_t ifp) { - return ((struct ifnet *)ifp)->if_hwassist; + return ifp->if_hwassist; } int if_togglehwassist(if_t ifp, int toggle_bits) { - ((struct ifnet *)ifp)->if_hwassist ^= toggle_bits; + ifp->if_hwassist ^= toggle_bits; return (0); } int if_setmtu(if_t ifp, int mtu) { - ((struct ifnet *)ifp)->if_mtu = mtu; + ifp->if_mtu = mtu; return (0); } int if_getmtu(const if_t ifp) { - return ((struct ifnet *)ifp)->if_mtu; + return ifp->if_mtu; } int @@ -4495,10 +4493,10 @@ SLIST_FOREACH(dp, &domains, dom_next) { if (dp->dom_family == family && dp->dom_ifmtu != NULL) - return (dp->dom_ifmtu((struct ifnet *)ifp)); + return (dp->dom_ifmtu(ifp)); } - return (((struct ifnet *)ifp)->if_mtu); + return (ifp->if_mtu); } /* @@ -4627,14 +4625,14 @@ int if_setsoftc(if_t ifp, void *softc) { - ((struct ifnet *)ifp)->if_softc = softc; + ifp->if_softc = softc; return (0); } void * if_getsoftc(const if_t ifp) { - return ((struct ifnet *)ifp)->if_softc; + return ifp->if_softc; } void @@ -4661,33 +4659,33 @@ int if_sendq_empty(if_t ifp) { - return IFQ_DRV_IS_EMPTY(&((struct ifnet *)ifp)->if_snd); + return IFQ_DRV_IS_EMPTY(&ifp->if_snd); } struct ifaddr * if_getifaddr(const if_t ifp) { - return ((struct ifnet *)ifp)->if_addr; + return ifp->if_addr; } int if_getamcount(const if_t ifp) { - return ((struct ifnet *)ifp)->if_amcount; + return ifp->if_amcount; } int if_setsendqready(if_t ifp) { - IFQ_SET_READY(&((struct ifnet *)ifp)->if_snd); + IFQ_SET_READY(&ifp->if_snd); return (0); } int if_setsendqlen(if_t ifp, int tx_desc_count) { - IFQ_SET_MAXLEN(&((struct ifnet *)ifp)->if_snd, tx_desc_count); - ((struct ifnet *)ifp)->if_snd.ifq_drv_maxlen = tx_desc_count; + IFQ_SET_MAXLEN(&ifp->if_snd, tx_desc_count); + ifp->if_snd.ifq_drv_maxlen = tx_desc_count; return (0); } @@ -4707,20 +4705,20 @@ int if_vlantrunkinuse(if_t ifp) { - return ((struct ifnet *)ifp)->if_vlantrunk != NULL?1:0; + return ifp->if_vlantrunk != NULL?1:0; } int if_init(if_t ifp, void *ctx) { - (*((struct ifnet *)ifp)->if_init)(ctx); + (*ifp->if_init)(ctx); return (0); } int if_input(if_t ifp, struct mbuf* sendmp) { - (*((struct ifnet *)ifp)->if_input)((struct ifnet *)ifp, sendmp); + (*ifp->if_input)((struct ifnet *)ifp, sendmp); return (0); } @@ -4728,7 +4726,7 @@ int if_transmit(if_t ifp, struct mbuf *m) { - (*((struct ifnet *)ifp)->if_transmit)((struct ifnet *)ifp, m); + (*ifp->if_transmit)((struct ifnet *)ifp, m); return (0); } @@ -4745,7 +4743,7 @@ if_dequeue(if_t ifp) { struct mbuf *m; - IFQ_DRV_DEQUEUE(&((struct ifnet *)ifp)->if_snd, m); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); return (m); } @@ -4753,21 +4751,21 @@ int if_sendq_prepend(if_t ifp, struct mbuf *m) { - IFQ_DRV_PREPEND(&((struct ifnet *)ifp)->if_snd, m); + IFQ_DRV_PREPEND(&ifp->if_snd, m); return (0); } int if_setifheaderlen(if_t ifp, int len) { - ((struct ifnet *)ifp)->if_hdrlen = len; + ifp->if_hdrlen = len; return (0); } caddr_t if_getlladdr(const if_t ifp) { - return (IF_LLADDR((struct ifnet *)ifp)); + return (IF_LLADDR(ifp)); } void * @@ -4803,7 +4801,7 @@ if_sethwtsomax(if_t ifp, u_int if_hw_tsomax) { - ((struct ifnet *)ifp)->if_hw_tsomax = if_hw_tsomax; + ifp->if_hw_tsomax = if_hw_tsomax; return (0); } @@ -4811,7 +4809,7 @@ if_sethwtsomaxsegcount(if_t ifp, u_int if_hw_tsomaxsegcount) { - ((struct ifnet *)ifp)->if_hw_tsomaxsegcount = if_hw_tsomaxsegcount; + ifp->if_hw_tsomaxsegcount = if_hw_tsomaxsegcount; return (0); } @@ -4819,7 +4817,7 @@ if_sethwtsomaxsegsize(if_t ifp, u_int if_hw_tsomaxsegsize) { - ((struct ifnet *)ifp)->if_hw_tsomaxsegsize = if_hw_tsomaxsegsize; + ifp->if_hw_tsomaxsegsize = if_hw_tsomaxsegsize; return (0); } @@ -4827,33 +4825,33 @@ if_gethwtsomax(const if_t ifp) { - return (((struct ifnet *)ifp)->if_hw_tsomax); + return (ifp->if_hw_tsomax); } u_int if_gethwtsomaxsegcount(const if_t ifp) { - return (((struct ifnet *)ifp)->if_hw_tsomaxsegcount); + return (ifp->if_hw_tsomaxsegcount); } u_int if_gethwtsomaxsegsize(const if_t ifp) { - return (((struct ifnet *)ifp)->if_hw_tsomaxsegsize); + return (ifp->if_hw_tsomaxsegsize); } void if_setinitfn(if_t ifp, if_init_fn_t init_fn) { - ((struct ifnet *)ifp)->if_init = init_fn; + ifp->if_init = init_fn; } void if_setinputfn(if_t ifp, if_input_fn_t input_fn) { - ((struct ifnet *)ifp)->if_input = input_fn; + ifp->if_input = input_fn; } if_input_fn_t @@ -4865,19 +4863,19 @@ void if_setioctlfn(if_t ifp, if_ioctl_fn_t ioctl_fn) { - ((struct ifnet *)ifp)->if_ioctl = (void *)ioctl_fn; + ifp->if_ioctl = (void *)ioctl_fn; } void if_setoutputfn(if_t ifp, if_output_fn_t output_fn) { - ((struct ifnet *)ifp)->if_output = output_fn; + ifp->if_output = output_fn; } void if_setstartfn(if_t ifp, if_start_fn_t start_fn) { - ((struct ifnet *)ifp)->if_start = (void *)start_fn; + ifp->if_start = (void *)start_fn; } if_start_fn_t @@ -4889,7 +4887,7 @@ void if_settransmitfn(if_t ifp, if_transmit_fn_t start_fn) { - ((struct ifnet *)ifp)->if_transmit = start_fn; + ifp->if_transmit = start_fn; } if_transmit_fn_t @@ -4901,14 +4899,14 @@ void if_setqflushfn(if_t ifp, if_qflush_fn_t flush_fn) { - ((struct ifnet *)ifp)->if_qflush = flush_fn; + ifp->if_qflush = flush_fn; } void if_setsndtagallocfn(if_t ifp, if_snd_tag_alloc_t alloc_fn) { - ((struct ifnet *)ifp)->if_snd_tag_alloc = alloc_fn; + ifp->if_snd_tag_alloc = alloc_fn; } int