bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] Add ioctl_types.defs to avoid duplication of type definitions.


From: Flavio Cruz
Subject: [PATCH] Add ioctl_types.defs to avoid duplication of type definitions.
Date: Sun, 13 Nov 2022 01:11:20 -0500

Also change type srtentry_t to use the new struct format.
---
 hurd/iioctl.defs      | 10 +---------
 hurd/ioctl_types.defs | 40 ++++++++++++++++++++++++++++++++++++++++
 hurd/rioctl.defs      | 10 +---------
 3 files changed, 42 insertions(+), 18 deletions(-)
 create mode 100644 hurd/ioctl_types.defs

diff --git a/hurd/iioctl.defs b/hurd/iioctl.defs
index 6fa05a5d..e059fc2d 100644
--- a/hurd/iioctl.defs
+++ b/hurd/iioctl.defs
@@ -19,6 +19,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 
02139, USA.  */
 
 
 #include <hurd/hurd_types.defs>
+#include <hurd/ioctl_types.defs>
 
 #ifdef IIOCTL_IMPORTS
 IIOCTL_IMPORTS
@@ -30,19 +31,10 @@ INTR_INTERFACE
    <ioctls.h>. */
 subsystem iioctl 112000; /* XXX */
 
-import <hurd/ioctl_types.h>; /* XXX */
-
-/* This is the first arg for a struct ifreq_something as specified by the
-   definition of _IOT_ifreq_something in <net/if.h>.  */
-type ifname_t = array[16] of char;     /* IFNAMSIZ is 16.  */
-
 /* This is the second arg of struct ifreq as specified by the
    definition of _IOT_ifreq in <net/if.h>. */
 type sockaddr_t = struct[16] of char;  /* sizeof(struct sockaddr) is 16.  */
 
-/* This is the struct srtentry from <net/route.h>. */
-type srtentry_t = struct[10] of int;   /* sizeof(struct srtentry) is 40. */
-
 skip; skip; skip; skip; /* 0 1 2 3 unused */
 skip; skip; skip; skip; /* 4 5 6 7 unused */
 skip; skip; skip; skip; /* 8 9 10 11 unused */
diff --git a/hurd/ioctl_types.defs b/hurd/ioctl_types.defs
new file mode 100644
index 00000000..e8bf87d6
--- /dev/null
+++ b/hurd/ioctl_types.defs
@@ -0,0 +1,40 @@
+/* Definitions for interface ioctls
+   Copyright (C) 2022 Free Software Foundation, Inc.
+
+This file is part of the GNU Hurd.
+
+The GNU Hurd is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+The GNU Hurd is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the GNU Hurd; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include <hurd/hurd_types.defs>
+
+import <hurd/ioctl_types.h>;
+
+/* Needs to be kept in sync with ioctl_types.h */
+type srtentry_t = struct {
+       uint32_t rt_dest;
+       uint32_t rt_mask;
+       uint32_t rt_gateway;
+       int rt_flags;
+       int rt_metric;
+       int rt_mtu;
+       int rt_window;
+       int rt_irtt;
+       int rt_tos;
+       int rt_class;
+};
+
+/* This is the first arg for a struct ifreq_something as specified by the
+   definition of _IOT_ifreq_something in <net/if.h>.  */
+type ifname_t = array[16] of char;     /* IFNAMSIZ is 16.  */
diff --git a/hurd/rioctl.defs b/hurd/rioctl.defs
index 595eb7c2..cadcd76e 100644
--- a/hurd/rioctl.defs
+++ b/hurd/rioctl.defs
@@ -19,6 +19,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 
02139, USA.  */
 
 
 #include <hurd/hurd_types.defs>
+#include <hurd/ioctl_types.defs>
 
 #ifdef RIOCTL_IMPORTS
 RIOCTL_IMPORTS
@@ -30,15 +31,6 @@ INTR_INTERFACE
    <ioctls.h>. */
 subsystem rioctl 148000; /* XXX */
 
-import <hurd/ioctl_types.h>; /* XXX */
-
-/* This is the first arg for a struct ifreq_something as specified by the
-   definition of _IOT_ifreq_something in <net/if.h>.  */
-type ifname_t = array[16] of char;     /* IFNAMSIZ is 16.  */
-
-/* This is the struct srtentry from <net/route.h>. */
-type srtentry_t = struct[10] of int;   /* sizeof(struct srtentry) is 40. */
-
 skip; skip; skip; skip; /* 0 1 2 3 unused */
 skip; skip; skip; skip; /* 4 5 6 7 unused */
 skip; skip;            /* 8 9 unused */
-- 
2.37.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]