[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] machdev,pci,rump: fix shutdown dosync
From: |
Damien Zammit |
Subject: |
[PATCH 5/6] machdev,pci,rump: fix shutdown dosync |
Date: |
Sun, 7 Mar 2021 17:39:09 +1100 |
---
libmachdev/ds_routines.c | 4 +--
libmachdev/machdev-device_emul.h | 2 +-
libmachdev/machdev.h | 2 +-
libmachdev/trivfs_server.c | 2 +-
pci-arbiter/Makefile | 2 +-
pci-arbiter/main.c | 19 ++++++++++++-
pci-arbiter/startup-ops.c | 46 --------------------------------
rumpdisk/block-rump.c | 2 +-
8 files changed, 25 insertions(+), 54 deletions(-)
delete mode 100644 pci-arbiter/startup-ops.c
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index d2b5352e..c2de4b26 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -315,13 +315,13 @@ void machdev_device_init()
}
}
-void machdev_device_shutdown()
+void machdev_device_shutdown(mach_port_t dosync_handle)
{
int i;
for (i = 0; i < num_emul; i++)
{
if (emulation_list[i]->shutdown)
- emulation_list[i]->shutdown();
+ emulation_list[i]->shutdown(dosync_handle);
}
}
diff --git a/libmachdev/machdev-device_emul.h b/libmachdev/machdev-device_emul.h
index edf79b96..7748f37f 100644
--- a/libmachdev/machdev-device_emul.h
+++ b/libmachdev/machdev-device_emul.h
@@ -64,7 +64,7 @@ struct machdev_device_emulation_ops
recnum_t, vm_offset_t, vm_size_t);
io_return_t (*writev_trap) (void *, dev_mode_t,
recnum_t, io_buf_vec_t *, vm_size_t);
- void (*shutdown) (void);
+ void (*shutdown) (mach_port_t);
};
#endif /* _MACHDEV_DEVICE_EMUL_H_ */
diff --git a/libmachdev/machdev.h b/libmachdev/machdev.h
index 41afe36d..8f613b35 100644
--- a/libmachdev/machdev.h
+++ b/libmachdev/machdev.h
@@ -30,7 +30,7 @@
void machdev_register (struct machdev_device_emulation_ops *ops);
void machdev_device_init(void);
-void machdev_device_shutdown(void);
+void machdev_device_shutdown(mach_port_t dosync_handle);
void * machdev_server(void *);
error_t machdev_create_device_port (size_t size, void *result);
int machdev_trivfs_init(mach_port_t bootstrap_resume_task, const char *name,
const char *path, mach_port_t *bootstrap);
diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
index d1d3a71d..e3e4045d 100644
--- a/libmachdev/trivfs_server.c
+++ b/libmachdev/trivfs_server.c
@@ -429,7 +429,7 @@ S_startup_dosync (mach_port_t handle)
ports_port_deref (inpi);
/* Sync and close device(s) */
- machdev_device_shutdown ();
+ machdev_device_shutdown (handle);
return trivfs_goaway (NULL, FSYS_GOAWAY_FORCE);
}
diff --git a/pci-arbiter/Makefile b/pci-arbiter/Makefile
index 3f374d18..b32bc579 100644
--- a/pci-arbiter/Makefile
+++ b/pci-arbiter/Makefile
@@ -22,7 +22,7 @@ PORTDIR = $(srcdir)/port
SRCS = main.c pci-ops.c netfs_impl.c \
pcifs.c ncache.c options.c func_files.c startup.c \
- startup-ops.c pciServer.c startup_notifyServer.c
+ pciServer.c startup_notifyServer.c
OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
HURDLIBS= fshelp ports shouldbeinlibc netfs iohelp ihash trivfs machdev
diff --git a/pci-arbiter/main.c b/pci-arbiter/main.c
index 33e9053a..4a10b264 100644
--- a/pci-arbiter/main.c
+++ b/pci-arbiter/main.c
@@ -88,6 +88,23 @@ pci_device_open (mach_port_t reply_port,
mach_msg_type_name_t reply_port_type,
return D_SUCCESS;
}
+static void
+pci_device_shutdown (mach_port_t dosync_handle)
+{
+ struct port_info *inpi = ports_lookup_port (netfs_port_bucket, dosync_handle,
+ pci_shutdown_notify_class);
+
+ if (!inpi)
+ return;
+
+ // Free all libpciaccess resources
+ pci_system_cleanup ();
+
+ ports_port_deref (inpi);
+
+ netfs_shutdown (FSYS_GOAWAY_FORCE);
+}
+
static struct machdev_device_emulation_ops pci_arbiter_emulation_ops = {
NULL,
NULL,
@@ -106,7 +123,7 @@ static struct machdev_device_emulation_ops
pci_arbiter_emulation_ops = {
NULL,
NULL,
NULL,
- NULL,
+ pci_device_shutdown,
};
int
diff --git a/pci-arbiter/startup-ops.c b/pci-arbiter/startup-ops.c
deleted file mode 100644
index fc285572..00000000
--- a/pci-arbiter/startup-ops.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- Copyright (C) 2017 Free Software Foundation, Inc.
- Written by Michael I. Bushnell, p/BSG.
-
- 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. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <startup_notify_S.h>
-
-#include <pciaccess.h>
-#include <hurd/netfs.h>
-
-#include "startup.h"
-
-#if 0 // FIXME: this conflicts with trivfs for machdev
-/* The system is going down. Call netfs_shutdown() */
-error_t
-S_startup_dosync (mach_port_t handle)
-{
- struct port_info *inpi = ports_lookup_port (netfs_port_bucket, handle,
- pci_shutdown_notify_class);
-
- if (!inpi)
- return EOPNOTSUPP;
-
- // Free all libpciaccess resources
- pci_system_cleanup ();
-
- ports_port_deref (inpi);
-
- return netfs_shutdown (FSYS_GOAWAY_FORCE);
-}
-#endif
diff --git a/rumpdisk/block-rump.c b/rumpdisk/block-rump.c
index 584056f7..a61f7b80 100644
--- a/rumpdisk/block-rump.c
+++ b/rumpdisk/block-rump.c
@@ -203,7 +203,7 @@ rumpdisk_device_dealloc (void *d)
}
static void
-rumpdisk_device_shutdown (void)
+rumpdisk_device_shutdown (mach_port_t dosync_handle)
{
struct block_data *bd = block_head;
--
2.30.1
- [PATCH: hurd x6], Damien Zammit, 2021/03/07
- [PATCH 2/6] pci-arbiter: Introduce machdev into this server, Damien Zammit, 2021/03/07
- [PATCH 3/6] libnetfs: Hacks to allow pci to run with no cred, Damien Zammit, 2021/03/07
- [PATCH 4/6] rumpdisk: Don't pretend to be the arbiter anymore, Damien Zammit, 2021/03/07
- [PATCH 1/6] pci-arbiter: Fix brokenness, Damien Zammit, 2021/03/07
- [PATCH 6/6] pci-arbiter: Close correctly, Damien Zammit, 2021/03/07
- [PATCH 5/6] machdev,pci,rump: fix shutdown dosync,
Damien Zammit <=
- Re: [PATCH: hurd x6], Samuel Thibault, 2021/03/07