[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/6] pci-arbiter: Close correctly
From: |
Damien Zammit |
Subject: |
[PATCH 6/6] pci-arbiter: Close correctly |
Date: |
Sun, 7 Mar 2021 17:39:10 +1100 |
---
pci-arbiter/main.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/pci-arbiter/main.c b/pci-arbiter/main.c
index 4a10b264..ddea5aa7 100644
--- a/pci-arbiter/main.c
+++ b/pci-arbiter/main.c
@@ -62,7 +62,7 @@ pci_device_open (mach_port_t reply_port, mach_msg_type_name_t
reply_port_type,
mach_msg_type_name_t * devicePoly)
{
io_return_t err = D_SUCCESS;
- mach_port_t dev_master, root;
+ mach_port_t dev_master;
if (strncmp(name, "pci", 3))
err = D_NO_SUCH_DEVICE;
@@ -82,12 +82,18 @@ pci_device_open (mach_port_t reply_port,
mach_msg_type_name_t reply_port_type,
return D_SUCCESS;
}
- root = pci_control_port;
- *devp = root;
+ *devp = pci_control_port;
*devicePoly = MACH_MSG_TYPE_COPY_SEND;
return D_SUCCESS;
}
+static io_return_t
+pci_device_close (void *d)
+{
+ ports_port_deref (&pci_control_port);
+ return 0;
+}
+
static void
pci_device_shutdown (mach_port_t dosync_handle)
{
@@ -102,6 +108,8 @@ pci_device_shutdown (mach_port_t dosync_handle)
ports_port_deref (inpi);
+ ports_destroy_right (&pci_control_port);
+
netfs_shutdown (FSYS_GOAWAY_FORCE);
}
@@ -111,7 +119,7 @@ static struct machdev_device_emulation_ops
pci_arbiter_emulation_ops = {
NULL,
NULL,
pci_device_open,
- NULL,
+ pci_device_close,
NULL,
NULL,
NULL,
--
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 <=
- [PATCH 5/6] machdev,pci,rump: fix shutdown dosync, Damien Zammit, 2021/03/07
- Re: [PATCH: hurd x6], Samuel Thibault, 2021/03/07