IfAPI: Add capabilities2/capenable2 accessors
Summary: As a stopgap measure add basic accessors for the if_capabilities2 and if_capenable2 members to further hide the ifnet details. Sponsored by: Juniper Networks, Inc. Reviewed by: glebius, kib Differential Revision: https://reviews.freebsd.org/D38487
This commit is contained in:
parent
189c3729d8
commit
a3a76c3d90
49
sys/net/if.c
49
sys/net/if.c
@ -4242,6 +4242,42 @@ if_setcapenablebit(if_t ifp, int setcap, int clearcap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
if_setcapabilities2(if_t ifp, int capabilities)
|
||||
{
|
||||
ifp->if_capabilities2 = capabilities;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
if_setcapabilities2bit(if_t ifp, int setbit, int clearbit)
|
||||
{
|
||||
ifp->if_capabilities2 &= ~clearbit;
|
||||
ifp->if_capabilities2 |= setbit;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
if_getcapabilities2(const if_t ifp)
|
||||
{
|
||||
return (ifp->if_capabilities2);
|
||||
}
|
||||
|
||||
int
|
||||
if_setcapenable2(if_t ifp, int capabilities2)
|
||||
{
|
||||
ifp->if_capenable2 = capabilities2;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
if_setcapenable2bit(if_t ifp, int setcap, int clearcap)
|
||||
{
|
||||
ifp->if_capenable2 &= ~clearcap;
|
||||
ifp->if_capenable2 |= setcap;
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
if_getdname(const if_t ifp)
|
||||
{
|
||||
@ -4283,6 +4319,19 @@ if_getcapenable(const if_t ifp)
|
||||
return ((struct ifnet *)ifp)->if_capenable;
|
||||
}
|
||||
|
||||
int
|
||||
if_togglecapenable2(if_t ifp, int togglecap)
|
||||
{
|
||||
ifp->if_capenable2 ^= togglecap;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
if_getcapenable2(const if_t ifp)
|
||||
{
|
||||
return (ifp->if_capenable2);
|
||||
}
|
||||
|
||||
int
|
||||
if_getdunit(const if_t ifp)
|
||||
{
|
||||
|
@ -576,6 +576,13 @@ int if_togglecapenable(if_t ifp, int togglecap);
|
||||
int if_setcapenable(if_t ifp, int capenable);
|
||||
int if_setcapenablebit(if_t ifp, int setcap, int clearcap);
|
||||
int if_getcapenable(const if_t ifp);
|
||||
int if_setcapabilities2(if_t ifp, int capabilities);
|
||||
int if_setcapabilities2bit(if_t ifp, int setbit, int clearbit);
|
||||
int if_getcapabilities2(const if_t ifp);
|
||||
int if_togglecapenable2(if_t ifp, int togglecap);
|
||||
int if_setcapenable2(if_t ifp, int capenable);
|
||||
int if_setcapenable2bit(if_t ifp, int setcap, int clearcap);
|
||||
int if_getcapenable2(const if_t ifp);
|
||||
int if_getdunit(const if_t ifp);
|
||||
int if_getindex(const if_t ifp);
|
||||
int if_getidxgen(const if_t ifp);
|
||||
|
Loading…
Reference in New Issue
Block a user