summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-03-30 01:17:11 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-03-30 01:17:11 +0200
commit23193fd35c9eaf20d794a7cc231f7c2a931a6378 (patch)
treee2b974a454cc10350bb07086fce09876a6370983
parentabdc4b1040fce44597a61b4e219008932b4f459b (diff)
machdev: Expose machdev_emul_device structure
* libmachdev/machdev-dev_hdr.h (DEVICE_NULL): Remove macro. (emul_device): Rename structure to machdev_emul_device. (emul_device_t): Rename type to machdev_emul_device_t. (mach_device, mach_device_t, MACH_DEVICE_NULL): Move to... * libmachdev/mach_device.h: ... new file. * libmachdev/ds_routines.c: Include "mach_device.h". * libmachdev/machdev-device_emul.h: Include <mach/notify.h>, <device/device_types.h>, <device/net_status.h>, <errno.h> * libmachdev/machdev.h: Include "machdev_hdr.h". * libmachdev/mig-decls.h: Include "mach_device.h". * libmachdev/Makefile (LCLHDRS): Add mach_device.h. (installhdrs): Add machdev-dev_hdr.h.
-rw-r--r--libmachdev/Makefile4
-rw-r--r--libmachdev/ds_routines.c1
-rw-r--r--libmachdev/mach_device.h35
-rw-r--r--libmachdev/machdev-dev_hdr.h17
-rw-r--r--libmachdev/machdev-device_emul.h4
-rw-r--r--libmachdev/machdev.h1
-rw-r--r--libmachdev/mig-decls.h1
7 files changed, 46 insertions, 17 deletions
diff --git a/libmachdev/Makefile b/libmachdev/Makefile
index 08479a3e..1f15ebe9 100644
--- a/libmachdev/Makefile
+++ b/libmachdev/Makefile
@@ -22,8 +22,8 @@ libname = libmachdev
SRCS = deviceUser.c machUser.c ds_routines.c trivfs_server.c \
device_replyUser.c deviceServer.c notifyServer.c
-LCLHDRS = machdev.h machdev-device_emul.h machdev-dev_hdr.h
-installhdrs = machdev.h machdev-device_emul.h
+LCLHDRS = machdev.h machdev-device_emul.h machdev-dev_hdr.h mach_device.h
+installhdrs = machdev.h machdev-device_emul.h machdev-dev_hdr.h
HURDLIBS = ports trivfs
LDLIBS += -lpthread
OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index 5a61805c..f4044b72 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -70,6 +70,7 @@
#include "notify_S.h"
#include "machdev-dev_hdr.h"
#include "machdev.h"
+#include "mach_device.h"
struct port_bucket *machdev_device_bucket;
struct port_class *machdev_device_class;
diff --git a/libmachdev/mach_device.h b/libmachdev/mach_device.h
new file mode 100644
index 00000000..25bf793b
--- /dev/null
+++ b/libmachdev/mach_device.h
@@ -0,0 +1,35 @@
+/*
+ Copyright (C) 2010 Free Software Foundation, Inc.
+ Written by Zheng Da.
+
+ 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. */
+
+#ifndef _MACHDEV_MACH_DEVICE_H
+#define _MACHDEV_MACH_DEVICE_H
+
+/*
+ * Generic device header. May be allocated with the device,
+ * or built when the device is opened.
+ */
+struct mach_device {
+ struct port_info port;
+ struct machdev_emul_device dev; /* the real device structure */
+};
+typedef struct mach_device *mach_device_t;
+#define MACH_DEVICE_NULL ((mach_device_t)0)
+
+#endif /* _MACHDEV_MACH_DEVICE_H */
diff --git a/libmachdev/machdev-dev_hdr.h b/libmachdev/machdev-dev_hdr.h
index 5b5e3e61..2bb3d295 100644
--- a/libmachdev/machdev-dev_hdr.h
+++ b/libmachdev/machdev-dev_hdr.h
@@ -64,25 +64,12 @@
/* This structure is associated with each open device port.
* The port representing the device points to this structure. */
-struct emul_device
+struct machdev_emul_device
{
struct machdev_device_emulation_ops *emul_ops;
void *emul_data;
};
-typedef struct emul_device *emul_device_t;
-
-#define DEVICE_NULL ((device_t) 0)
-
-/*
- * Generic device header. May be allocated with the device,
- * or built when the device is opened.
- */
-struct mach_device {
- struct port_info port;
- struct emul_device dev; /* the real device structure */
-};
-typedef struct mach_device *mach_device_t;
-#define MACH_DEVICE_NULL ((mach_device_t)0)
+typedef struct machdev_emul_device *machdev_emul_device_t;
#endif /* _MACHDEV_DEVICE_DEV_HDR_H_ */
diff --git a/libmachdev/machdev-device_emul.h b/libmachdev/machdev-device_emul.h
index db0b106f..ab1bd92b 100644
--- a/libmachdev/machdev-device_emul.h
+++ b/libmachdev/machdev-device_emul.h
@@ -27,6 +27,10 @@
#define _MACHDEV_DEVICE_EMUL_H_
#include <mach.h>
+#include <mach/notify.h>
+#include <device/device_types.h>
+#include <device/net_status.h>
+#include <errno.h>
/* Each emulation layer provides these operations. */
struct machdev_device_emulation_ops
diff --git a/libmachdev/machdev.h b/libmachdev/machdev.h
index 78b100c6..9b2dbd31 100644
--- a/libmachdev/machdev.h
+++ b/libmachdev/machdev.h
@@ -25,6 +25,7 @@
#include <mach.h>
#include "machdev-device_emul.h"
+#include "machdev-dev_hdr.h"
void machdev_register (struct machdev_device_emulation_ops *ops);
diff --git a/libmachdev/mig-decls.h b/libmachdev/mig-decls.h
index d0077f8d..62eaac80 100644
--- a/libmachdev/mig-decls.h
+++ b/libmachdev/mig-decls.h
@@ -22,6 +22,7 @@
#include <hurd/ports.h>
#include "machdev-dev_hdr.h"
+#include "mach_device.h"
extern struct port_bucket *machdev_device_bucket;
extern struct port_class *machdev_device_class;