Module Name: src Committed By: msaitoh Date: Wed Sep 28 15:32:10 UTC 2022
Modified Files: src/sys/compat/common: if_43.c uipc_syscalls_50.c src/sys/compat/net: if.h src/sys/compat/sys: sockio.h Log Message: Simplify sys/compat/sys/sockio.h. No functional change intended. - Move some definitions from sys/compat/sockio.h to compat/net/if.h. struct oif_data in sockio.h and if_data50 are the same, so remove oif_data. Do the same thing to oifdatareq, too. - u_quad_t -> uint64_t. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/compat/common/if_43.c cvs rdiff -u -r1.11 -r1.12 src/sys/compat/common/uipc_syscalls_50.c cvs rdiff -u -r1.6 -r1.7 src/sys/compat/net/if.h cvs rdiff -u -r1.20 -r1.21 src/sys/compat/sys/sockio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/common/if_43.c diff -u src/sys/compat/common/if_43.c:1.25 src/sys/compat/common/if_43.c:1.26 --- src/sys/compat/common/if_43.c:1.25 Fri Jun 12 11:04:45 2020 +++ src/sys/compat/common/if_43.c Wed Sep 28 15:32:09 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_43.c,v 1.25 2020/06/12 11:04:45 roy Exp $ */ +/* $NetBSD: if_43.c,v 1.26 2022/09/28 15:32:09 msaitoh Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1990, 1993 @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.25 2020/06/12 11:04:45 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.26 2022/09/28 15:32:09 msaitoh Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -69,6 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1. #include <net80211/ieee80211_ioctl.h> #include <netinet6/in6_var.h> #include <netinet6/nd6.h> +#include <compat/net/if.h> #include <compat/sys/socket.h> #include <compat/sys/sockio.h> Index: src/sys/compat/common/uipc_syscalls_50.c diff -u src/sys/compat/common/uipc_syscalls_50.c:1.11 src/sys/compat/common/uipc_syscalls_50.c:1.12 --- src/sys/compat/common/uipc_syscalls_50.c:1.11 Wed Jan 29 05:48:22 2020 +++ src/sys/compat/common/uipc_syscalls_50.c Wed Sep 28 15:32:09 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_syscalls_50.c,v 1.11 2020/01/29 05:48:22 thorpej Exp $ */ +/* $NetBSD: uipc_syscalls_50.c,v 1.12 2022/09/28 15:32:09 msaitoh Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -48,6 +48,7 @@ #include <net/if.h> +#include <compat/net/if.h> #include <compat/sys/time.h> #include <compat/sys/socket.h> #include <compat/sys/sockio.h> @@ -59,7 +60,7 @@ static int compat_ifdatareq(struct lwp *l, u_long cmd, void *data) { struct if_data ifi; - struct oifdatareq *ifdr = data; + struct ifdatareq50 *ifdr = data; struct ifnet *ifp; int error; Index: src/sys/compat/net/if.h diff -u src/sys/compat/net/if.h:1.6 src/sys/compat/net/if.h:1.7 --- src/sys/compat/net/if.h:1.6 Wed Sep 28 08:12:55 2022 +++ src/sys/compat/net/if.h Wed Sep 28 15:32:09 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if.h,v 1.6 2022/09/28 08:12:55 msaitoh Exp $ */ +/* $NetBSD: if.h,v 1.7 2022/09/28 15:32:09 msaitoh Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -63,8 +63,39 @@ #ifndef _COMPAT_NET_IF_H_ #define _COMPAT_NET_IF_H_ +#include <net/route.h> #include <compat/sys/time.h> +#define OIFNAMSIZ 16 + +struct oifreq { + char ifr_name[OIFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + short ifru_flags; + int ifru_metric; + int ifru_mtu; + int ifru_dlt; + u_int ifru_value; + void * ifru_data; + struct { + uint32_t b_buflen; + void *b_buf; + } ifru_b; + } ifr_ifru; +}; +struct oifconf { + int ifc_len; /* size of associated buffer */ + union { + void * ifcu_buf; + struct oifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + /* Pre-1.5 if_data struct */ struct if_data14 { /* generic interface information */ @@ -133,6 +164,15 @@ struct if_data50 { }; /* + * Structure defining statistics and other data kept regarding a network + * interface. + */ +struct ifdatareq50 { + char ifdr_name[OIFNAMSIZ]; /* if name, e.g. "en0" */ + struct if_data50 ifdr_data; +}; + +/* * Message format for use in obtaining information about interfaces * from sysctl and the routing socket. */ Index: src/sys/compat/sys/sockio.h diff -u src/sys/compat/sys/sockio.h:1.20 src/sys/compat/sys/sockio.h:1.21 --- src/sys/compat/sys/sockio.h:1.20 Wed Sep 28 08:12:56 2022 +++ src/sys/compat/sys/sockio.h Wed Sep 28 15:32:09 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: sockio.h,v 1.20 2022/09/28 08:12:56 msaitoh Exp $ */ +/* $NetBSD: sockio.h,v 1.21 2022/09/28 15:32:09 msaitoh Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 @@ -33,70 +33,7 @@ #define _COMPAT_SYS_SOCKIO_H_ #include <sys/ioccom.h> - -#define OIFNAMSIZ 16 - -struct oifreq { - char ifr_name[OIFNAMSIZ]; /* if name, e.g. "en0" */ - union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - struct sockaddr ifru_broadaddr; - short ifru_flags; - int ifru_metric; - int ifru_mtu; - int ifru_dlt; - u_int ifru_value; - void * ifru_data; - struct { - uint32_t b_buflen; - void *b_buf; - } ifru_b; - } ifr_ifru; -}; -struct oifconf { - int ifc_len; /* size of associated buffer */ - union { - void * ifcu_buf; - struct oifreq *ifcu_req; - } ifc_ifcu; -#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ -#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ -}; - -#include <compat/sys/time.h> -/* - * Structure defining statistics and other data kept regarding a network - * interface. - */ -struct oif_data { - /* generic interface information */ - u_char ifi_type; /* ethernet, tokenring, etc. */ - u_char ifi_addrlen; /* media address length */ - u_char ifi_hdrlen; /* media header length */ - int ifi_link_state; /* current link state */ - uint64_t ifi_mtu; /* maximum transmission unit */ - uint64_t ifi_metric; /* routing metric (external only) */ - uint64_t ifi_baudrate; /* linespeed */ - /* volatile statistics */ - uint64_t ifi_ipackets; /* packets received on interface */ - uint64_t ifi_ierrors; /* input errors on interface */ - uint64_t ifi_opackets; /* packets sent on interface */ - uint64_t ifi_oerrors; /* output errors on interface */ - uint64_t ifi_collisions; /* collisions on csma interfaces */ - uint64_t ifi_ibytes; /* total number of octets received */ - uint64_t ifi_obytes; /* total number of octets sent */ - uint64_t ifi_imcasts; /* packets received via multicast */ - uint64_t ifi_omcasts; /* packets sent via multicast */ - uint64_t ifi_iqdrops; /* dropped on input, this interface */ - uint64_t ifi_noproto; /* destined for unsupported protocol */ - struct timeval50 ifi_lastchange;/* last operational state change */ -}; - -struct oifdatareq { - char ifdr_name[OIFNAMSIZ]; /* if name, e.g. "en0" */ - struct oif_data ifdr_data; -}; +#include <compat/net/if.h> #define OSIOCSIFADDR _IOW('i', 12, struct oifreq) /* set ifnet address */ #define OOSIOCGIFADDR _IOWR('i', 13, struct oifreq) /* get ifnet address */ @@ -116,11 +53,10 @@ struct oifdatareq { #define SIOCSIFMEDIA_80 _IOWR('i', 53, struct ifreq) /* set net media */ #define SIOCGIFMEDIA_80 _IOWR('i', 54, struct ifmediareq) /* set net media */ #define OSIOCGIFMTU _IOWR('i', 126, struct oifreq) /* get ifnet mtu */ -#define OSIOCGIFDATA _IOWR('i', 128, struct oifdatareq) /* get if_data */ -#define OSIOCZIFDATA _IOWR('i', 129, struct oifdatareq) /* get if_data then +#define OSIOCGIFDATA _IOWR('i', 128, struct ifdatareq50) /* get if_data */ +#define OSIOCZIFDATA _IOWR('i', 129, struct ifdatareq50) /* get if_data then zero ctrs*/ - #define OBIOCGETIF _IOR('B', 107, struct oifreq) #define OBIOCSETIF _IOW('B', 108, struct oifreq) #define OTAPGIFNAME _IOR('e', 0, struct oifreq)