linux(4): Rename struct l_ifreq members names to avoid conflicts with FreeBSD
For now we are using mixed names to access struct ifreq members, some of Linux (ifr_name, ifr_ifindex), others of FreeBSD. To avoid conflicts switch to use FreeBSD names. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D38792
This commit is contained in:
parent
423fa711b8
commit
55ed591b65
@ -2097,7 +2097,7 @@ linux_ioctl_ifname(struct thread *td, struct l_ifreq *uifr)
|
||||
error = copyin(uifr, &ifr, sizeof(ifr));
|
||||
if (error != 0)
|
||||
return (error);
|
||||
ret = ifname_bsd_to_linux_idx(ifr.ifr_ifindex, ifr.ifr_name,
|
||||
ret = ifname_bsd_to_linux_idx(ifr.ifr_index, ifr.ifr_name,
|
||||
LINUX_IFNAMSIZ);
|
||||
if (ret > 0)
|
||||
return (copyout(&ifr, uifr, sizeof(ifr)));
|
||||
|
@ -72,6 +72,16 @@ __FBSDID("$FreeBSD$");
|
||||
#include <compat/linux/linux_time.h>
|
||||
#include <compat/linux/linux_util.h>
|
||||
|
||||
_Static_assert(offsetof(struct l_ifreq, ifr_ifru) ==
|
||||
offsetof(struct ifreq, ifr_ifru),
|
||||
"Linux ifreq members names should be equal to FreeeBSD");
|
||||
_Static_assert(offsetof(struct l_ifreq, ifr_index) ==
|
||||
offsetof(struct ifreq, ifr_index),
|
||||
"Linux ifreq members names should be equal to FreeeBSD");
|
||||
_Static_assert(offsetof(struct l_ifreq, ifr_name) ==
|
||||
offsetof(struct ifreq, ifr_name),
|
||||
"Linux ifreq members names should be equal to FreeeBSD");
|
||||
|
||||
#define SECURITY_CONTEXT_STRING "unconfined"
|
||||
|
||||
static int linux_sendmsg_common(struct thread *, l_int, struct l_msghdr *,
|
||||
|
@ -336,11 +336,13 @@ struct l_ifmap {
|
||||
/* 3 bytes spare */
|
||||
};
|
||||
|
||||
/*
|
||||
* Careful changing the declaration of this structure.
|
||||
* To use FreeBSD names to access the struct l_ifreq members the
|
||||
* member names of struct l_ifreq should be equal to the FreeBSD.
|
||||
*/
|
||||
struct l_ifreq {
|
||||
union {
|
||||
char ifrn_name[LINUX_IFNAMSIZ];
|
||||
} ifr_ifrn;
|
||||
|
||||
char ifr_name[LINUX_IFNAMSIZ];
|
||||
union {
|
||||
struct l_sockaddr ifru_addr;
|
||||
struct l_sockaddr ifru_dstaddr;
|
||||
@ -348,7 +350,7 @@ struct l_ifreq {
|
||||
struct l_sockaddr ifru_netmask;
|
||||
struct l_sockaddr ifru_hwaddr;
|
||||
l_short ifru_flags[1];
|
||||
l_int ifru_ivalue;
|
||||
l_int ifru_index;
|
||||
l_int ifru_mtu;
|
||||
struct l_ifmap ifru_map;
|
||||
char ifru_slave[LINUX_IFNAMSIZ];
|
||||
@ -357,8 +359,9 @@ struct l_ifreq {
|
||||
} ifr_ifru;
|
||||
};
|
||||
|
||||
#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
|
||||
/*
|
||||
* Define here members which are not exists in the FreeBSD struct ifreq.
|
||||
*/
|
||||
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
|
||||
#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
|
||||
|
||||
#endif /* _LINUX_SOCKET_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user