summaryrefslogtreecommitdiff
path: root/eth-multiplexer
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2021-08-05 18:03:47 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-10 22:12:50 +0200
commit4b739a627e08fe0bc50342e65ba61abd0152fe17 (patch)
tree0a54c1217668ee8a535e117ded9f4886cb526416 /eth-multiplexer
parent99df125e1048d9d09cfb68ce54725a089bacc140 (diff)
eth-multiplexer: Use notify server implementation from libports
We can simply override proc_dead_name () to handle dead-name notifications.
Diffstat (limited to 'eth-multiplexer')
-rw-r--r--eth-multiplexer/Makefile4
-rw-r--r--eth-multiplexer/dead-name.c30
-rw-r--r--eth-multiplexer/device_impl.c1
-rw-r--r--eth-multiplexer/mig-mutate.h9
-rw-r--r--eth-multiplexer/multiplexer.c4
-rw-r--r--eth-multiplexer/notify_impl.c69
6 files changed, 34 insertions, 83 deletions
diff --git a/eth-multiplexer/Makefile b/eth-multiplexer/Makefile
index cefa0abd..5f3d2739 100644
--- a/eth-multiplexer/Makefile
+++ b/eth-multiplexer/Makefile
@@ -20,8 +20,8 @@ makemode := server
target = eth-multiplexer
#CFLAGS += -DDEBUG
-SRCS = ethernet.c vdev.c multiplexer.c dev_stat.c netfs_impl.c notify_impl.c device_impl.c demuxer.c
-MIGSTUBS = deviceServer.o notifyServer.o
+SRCS = ethernet.c vdev.c multiplexer.c dev_stat.c netfs_impl.c device_impl.c dead-name.c demuxer.c
+MIGSTUBS = deviceServer.o
MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
device-MIGSFLAGS="-DMACH_PAYLOAD_TO_PORT=ports_payload_get_name"
OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
diff --git a/eth-multiplexer/dead-name.c b/eth-multiplexer/dead-name.c
new file mode 100644
index 00000000..66d53e3c
--- /dev/null
+++ b/eth-multiplexer/dead-name.c
@@ -0,0 +1,30 @@
+/*
+ Copyright (C) 2008, 2021 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. */
+
+#include <hurd/ports.h>
+#include "vdev.h"
+
+void
+ports_dead_name (void *notify, mach_port_t dead_name)
+{
+ debug ("ports_dead_name is called\n");
+ remove_dead_port_from_dev (dead_name);
+ ports_interrupt_notified_rpcs (notify, dead_name, MACH_NOTIFY_DEAD_NAME);
+}
diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c
index c4d393ac..152dc7bc 100644
--- a/eth-multiplexer/device_impl.c
+++ b/eth-multiplexer/device_impl.c
@@ -28,7 +28,6 @@
#include "ethernet.h"
#include "vdev.h"
#include "device_S.h"
-#include "notify_S.h"
#include "bpf_impl.h"
#include "netfs_impl.h"
#include "util.h"
diff --git a/eth-multiplexer/mig-mutate.h b/eth-multiplexer/mig-mutate.h
index 55eca312..670c454d 100644
--- a/eth-multiplexer/mig-mutate.h
+++ b/eth-multiplexer/mig-mutate.h
@@ -17,15 +17,6 @@
You should have received a copy of the GNU General Public License
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
-#define NOTIFY_INTRAN \
- port_info_t begin_using_port_info_port (mach_port_t)
-#define NOTIFY_INTRAN_PAYLOAD \
- port_info_t begin_using_port_info_payload
-#define NOTIFY_DESTRUCTOR \
- end_using_port_info (port_info_t)
-#define NOTIFY_IMPORTS \
- import "libports/mig-decls.h";
-
#define DEVICE_INTRAN \
vether_device_t begin_using_device_port (mach_port_t)
#define DEVICE_INTRAN_PAYLOAD \
diff --git a/eth-multiplexer/multiplexer.c b/eth-multiplexer/multiplexer.c
index 4cd77a1e..adac2b9c 100644
--- a/eth-multiplexer/multiplexer.c
+++ b/eth-multiplexer/multiplexer.c
@@ -44,7 +44,7 @@
#include "ethernet.h"
#include "vdev.h"
#include "device_S.h"
-#include "notify_S.h"
+#include "libports/notify_S.h"
#include "bpf_impl.h"
#include "netfs_impl.h"
#include "util.h"
@@ -82,7 +82,7 @@ multiplexer_demuxer (mach_msg_header_t *inp,
mig_routine_t routine;
if ((routine = NULL, ethernet_demuxer (inp, outp)) ||
(routine = device_server_routine (inp)) ||
- (routine = notify_server_routine (inp)))
+ (routine = ports_notify_server_routine (inp)))
{
if (routine)
(*routine) (inp, outp);
diff --git a/eth-multiplexer/notify_impl.c b/eth-multiplexer/notify_impl.c
deleted file mode 100644
index eef55448..00000000
--- a/eth-multiplexer/notify_impl.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- Copyright (C) 2008 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. */
-
-#include <hurd.h>
-#include <mach.h>
-
-#include "vdev.h"
-
-/* Implementation of notify interface */
-kern_return_t
-do_mach_notify_port_deleted (struct port_info *pi,
- mach_port_t name)
-{
- return EOPNOTSUPP;
-}
-
-kern_return_t
-do_mach_notify_msg_accepted (struct port_info *pi,
- mach_port_t name)
-{
- return EOPNOTSUPP;
-}
-
-kern_return_t
-do_mach_notify_port_destroyed (struct port_info *pi,
- mach_port_t port)
-{
- return EOPNOTSUPP;
-}
-
-kern_return_t
-do_mach_notify_no_senders (struct port_info *pi,
- mach_port_mscount_t mscount)
-{
- return ports_do_mach_notify_no_senders (pi, mscount);
-}
-
-kern_return_t
-do_mach_notify_send_once (struct port_info *pi)
-{
- return EOPNOTSUPP;
-}
-
-kern_return_t
-do_mach_notify_dead_name (struct port_info *pi,
- mach_port_t name)
-{
- debug ("do_mach_notify_dead_name is called\n");
- mach_port_deallocate (mach_task_self (), name);
- remove_dead_port_from_dev (name);
- return 0;
-}