Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat Simplify sys/compat/sys/sockio.h. No functional c...



details:   https://anonhg.NetBSD.org/src/rev/4be8584be449
branches:  trunk
changeset: 371211:4be8584be449
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Sep 28 15:32:09 2022 +0000

description:
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.

diffstat:

 sys/compat/common/if_43.c            |   5 +-
 sys/compat/common/uipc_syscalls_50.c |   5 +-
 sys/compat/net/if.h                  |  42 ++++++++++++++++++++-
 sys/compat/sys/sockio.h              |  72 ++----------------------------------
 4 files changed, 51 insertions(+), 73 deletions(-)

diffs (212 lines):

diff -r fa22ef22abc7 -r 4be8584be449 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Wed Sep 28 12:34:50 2022 +0000
+++ b/sys/compat/common/if_43.c Wed Sep 28 15:32:09 2022 +0000
@@ -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 @@
 #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>
 
diff -r fa22ef22abc7 -r 4be8584be449 sys/compat/common/uipc_syscalls_50.c
--- a/sys/compat/common/uipc_syscalls_50.c      Wed Sep 28 12:34:50 2022 +0000
+++ b/sys/compat/common/uipc_syscalls_50.c      Wed Sep 28 15:32:09 2022 +0000
@@ -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 @@
 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;
 
diff -r fa22ef22abc7 -r 4be8584be449 sys/compat/net/if.h
--- a/sys/compat/net/if.h       Wed Sep 28 12:34:50 2022 +0000
+++ b/sys/compat/net/if.h       Wed Sep 28 15:32:09 2022 +0000
@@ -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 @@
 };
 
 /*
+ * 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.
  */
diff -r fa22ef22abc7 -r 4be8584be449 sys/compat/sys/sockio.h
--- a/sys/compat/sys/sockio.h   Wed Sep 28 12:34:50 2022 +0000
+++ b/sys/compat/sys/sockio.h   Wed Sep 28 15:32:09 2022 +0000
@@ -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 @@
 #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)



Home | Main Index | Thread Index | Old Index