linux(4): Make linux_ifflags return a value
To simplify the use of the function in the printf-like statements. Differential Revision: https://reviews.freebsd.org/D38830
This commit is contained in:
parent
6c5786fd37
commit
130383f2f1
@ -98,13 +98,11 @@ static int
|
||||
linsysfs_ifnet_flags(PFS_FILL_ARGS)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
unsigned short flags;
|
||||
|
||||
ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL);
|
||||
if (ifp == NULL)
|
||||
return (ENOENT);
|
||||
linux_ifflags(ifp, &flags);
|
||||
sbuf_printf(sb, "0x%x\n", flags);
|
||||
sbuf_printf(sb, "0x%x\n", linux_ifflags(ifp));
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -416,33 +416,34 @@ ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname)
|
||||
return (arg.ifp);
|
||||
}
|
||||
|
||||
void
|
||||
linux_ifflags(struct ifnet *ifp, short *flags)
|
||||
unsigned short
|
||||
linux_ifflags(struct ifnet *ifp)
|
||||
{
|
||||
unsigned short fl;
|
||||
unsigned short fl, flags;
|
||||
|
||||
fl = (if_getflags(ifp) | if_getdrvflags(ifp)) & 0xffff;
|
||||
*flags = 0;
|
||||
flags = 0;
|
||||
if (fl & IFF_UP)
|
||||
*flags |= LINUX_IFF_UP;
|
||||
flags |= LINUX_IFF_UP;
|
||||
if (fl & IFF_BROADCAST)
|
||||
*flags |= LINUX_IFF_BROADCAST;
|
||||
flags |= LINUX_IFF_BROADCAST;
|
||||
if (fl & IFF_DEBUG)
|
||||
*flags |= LINUX_IFF_DEBUG;
|
||||
flags |= LINUX_IFF_DEBUG;
|
||||
if (fl & IFF_LOOPBACK)
|
||||
*flags |= LINUX_IFF_LOOPBACK;
|
||||
flags |= LINUX_IFF_LOOPBACK;
|
||||
if (fl & IFF_POINTOPOINT)
|
||||
*flags |= LINUX_IFF_POINTOPOINT;
|
||||
flags |= LINUX_IFF_POINTOPOINT;
|
||||
if (fl & IFF_DRV_RUNNING)
|
||||
*flags |= LINUX_IFF_RUNNING;
|
||||
flags |= LINUX_IFF_RUNNING;
|
||||
if (fl & IFF_NOARP)
|
||||
*flags |= LINUX_IFF_NOARP;
|
||||
flags |= LINUX_IFF_NOARP;
|
||||
if (fl & IFF_PROMISC)
|
||||
*flags |= LINUX_IFF_PROMISC;
|
||||
flags |= LINUX_IFF_PROMISC;
|
||||
if (fl & IFF_ALLMULTI)
|
||||
*flags |= LINUX_IFF_ALLMULTI;
|
||||
flags |= LINUX_IFF_ALLMULTI;
|
||||
if (fl & IFF_MULTICAST)
|
||||
*flags |= LINUX_IFF_MULTICAST;
|
||||
flags |= LINUX_IFF_MULTICAST;
|
||||
return (flags);
|
||||
}
|
||||
|
||||
static u_int
|
||||
|
@ -36,7 +36,7 @@ int ifname_bsd_to_linux_name(const char *, char *, size_t);
|
||||
|
||||
struct ifnet *ifname_linux_to_bsd(struct thread *td,
|
||||
const char *lxname, char *bsdname);
|
||||
void linux_ifflags(struct ifnet *ifp, short *flags);
|
||||
unsigned short linux_ifflags(struct ifnet *);
|
||||
int linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *lsa);
|
||||
|
||||
int linux_to_bsd_domain(int domain);
|
||||
|
@ -2237,9 +2237,9 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
|
||||
static int
|
||||
linux_gifflags(struct thread *td, struct ifnet *ifp, struct l_ifreq *ifr)
|
||||
{
|
||||
l_short flags;
|
||||
unsigned short flags;
|
||||
|
||||
linux_ifflags(ifp, &flags);
|
||||
flags = linux_ifflags(ifp);
|
||||
|
||||
return (copyout(&flags, &ifr->ifr_flags, sizeof(flags)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user