linux(4): Reduce code duplication between MD files

Move struct ifnet definitions under compat/linux.

Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D38791
This commit is contained in:
Dmitry Chagin 2023-03-04 12:11:38 +03:00 committed by Oscar Zhao
parent b17c015e6b
commit 423fa711b8
5 changed files with 35 additions and 135 deletions

View File

@ -224,40 +224,6 @@ union l_semun {
l_uintptr_t __pad;
};
struct l_ifmap {
l_ulong mem_start;
l_ulong mem_end;
l_ushort base_addr;
u_char irq;
u_char dma;
u_char port;
/* 3 bytes spare */
};
struct l_ifreq {
union {
char ifrn_name[LINUX_IFNAMSIZ];
} ifr_ifrn;
union {
struct l_sockaddr ifru_addr;
struct l_sockaddr ifru_dstaddr;
struct l_sockaddr ifru_broadaddr;
struct l_sockaddr ifru_netmask;
struct l_sockaddr ifru_hwaddr;
l_short ifru_flags[1];
l_int ifru_ivalue;
l_int ifru_mtu;
struct l_ifmap ifru_map;
char ifru_slave[LINUX_IFNAMSIZ];
l_uintptr_t ifru_data;
} ifr_ifru;
};
#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
struct l_ifconf {
int ifc_len;
union {

View File

@ -304,40 +304,6 @@ union l_semun {
l_uintptr_t __pad;
};
struct l_ifmap {
l_ulong mem_start;
l_ulong mem_end;
l_ushort base_addr;
u_char irq;
u_char dma;
u_char port;
/* 3 bytes spare */
};
struct l_ifreq {
union {
char ifrn_name[LINUX_IFNAMSIZ];
} ifr_ifrn;
union {
struct l_sockaddr ifru_addr;
struct l_sockaddr ifru_dstaddr;
struct l_sockaddr ifru_broadaddr;
struct l_sockaddr ifru_netmask;
struct l_sockaddr ifru_hwaddr;
l_short ifru_flags[1];
l_int ifru_ivalue;
l_int ifru_mtu;
struct l_ifmap ifru_map;
char ifru_slave[LINUX_IFNAMSIZ];
l_uintptr_t ifru_data;
} ifr_ifru;
};
#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
struct l_ifconf {
int ifc_len;
union {

View File

@ -181,40 +181,6 @@ union l_semun {
l_uintptr_t __pad;
};
struct l_ifmap {
l_ulong mem_start;
l_ulong mem_end;
l_ushort base_addr;
u_char irq;
u_char dma;
u_char port;
/* 3 bytes spare*/
};
struct l_ifreq {
union {
char ifrn_name[LINUX_IFNAMSIZ];
} ifr_ifrn;
union {
struct l_sockaddr ifru_addr;
struct l_sockaddr ifru_dstaddr;
struct l_sockaddr ifru_broadaddr;
struct l_sockaddr ifru_netmask;
struct l_sockaddr ifru_hwaddr;
l_short ifru_flags[1];
l_int ifru_ivalue;
l_int ifru_mtu;
struct l_ifmap ifru_map;
char ifru_slave[LINUX_IFNAMSIZ];
l_uintptr_t ifru_data;
} ifr_ifru;
};
#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
#define linux_copyout_rusage(r, u) copyout(r, u, sizeof(*r))
struct linux_pt_regset {

View File

@ -326,4 +326,39 @@ int linux_accept(struct thread *td, struct linux_accept_args *args);
#define LINUX_TCP_INFO 11
#define LINUX_TCP_MD5SIG 14
struct l_ifmap {
l_ulong mem_start;
l_ulong mem_end;
l_ushort base_addr;
u_char irq;
u_char dma;
u_char port;
/* 3 bytes spare */
};
struct l_ifreq {
union {
char ifrn_name[LINUX_IFNAMSIZ];
} ifr_ifrn;
union {
struct l_sockaddr ifru_addr;
struct l_sockaddr ifru_dstaddr;
struct l_sockaddr ifru_broadaddr;
struct l_sockaddr ifru_netmask;
struct l_sockaddr ifru_hwaddr;
l_short ifru_flags[1];
l_int ifru_ivalue;
l_int ifru_mtu;
struct l_ifmap ifru_map;
char ifru_slave[LINUX_IFNAMSIZ];
char ifru_newname[LINUX_IFNAMSIZ];
l_uintptr_t ifru_data;
} ifr_ifru;
};
#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
#endif /* _LINUX_SOCKET_H_ */

View File

@ -279,39 +279,6 @@ union l_semun {
l_uintptr_t __pad;
};
struct l_ifmap {
l_ulong mem_start;
l_ulong mem_end;
l_ushort base_addr;
u_char irq;
u_char dma;
u_char port;
};
struct l_ifreq {
union {
char ifrn_name[LINUX_IFNAMSIZ];
} ifr_ifrn;
union {
struct l_sockaddr ifru_addr;
struct l_sockaddr ifru_dstaddr;
struct l_sockaddr ifru_broadaddr;
struct l_sockaddr ifru_netmask;
struct l_sockaddr ifru_hwaddr;
l_short ifru_flags[1];
l_int ifru_ivalue;
l_int ifru_mtu;
struct l_ifmap ifru_map;
char ifru_slave[LINUX_IFNAMSIZ];
l_caddr_t ifru_data;
} ifr_ifru;
};
#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
struct l_user_desc {
l_uint entry_number;
l_uint base_addr;