summaryrefslogtreecommitdiff
path: root/libmachdev
diff options
context:
space:
mode:
Diffstat (limited to 'libmachdev')
-rw-r--r--libmachdev/block.c1
-rw-r--r--libmachdev/ds_routines.c20
-rw-r--r--libmachdev/ds_routines.h2
-rw-r--r--libmachdev/mig-decls.h4
-rw-r--r--libmachdev/net.c18
-rw-r--r--libmachdev/trivfs_server.c3
6 files changed, 22 insertions, 26 deletions
diff --git a/libmachdev/block.c b/libmachdev/block.c
index 756a07bf..cd868d25 100644
--- a/libmachdev/block.c
+++ b/libmachdev/block.c
@@ -35,6 +35,7 @@
#include <ddekit/printf.h>
+#include "ds_routines.h"
#include "vm_param.h"
#include "device_reply_U.h"
#include "dev_hdr.h"
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index 0e431a33..6bd5a129 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -64,14 +64,14 @@
#include "vm_param.h"
#include "device_S.h"
-#include "device_reply_U.h"
+#include "notify_S.h"
#include "io_req.h"
#include "dev_hdr.h"
#include "util.h"
#include "queue.h"
#include "mach_glue.h"
-struct port_bucket *port_bucket;
+struct port_bucket *device_bucket;
struct port_class *dev_class;
#define NUM_EMULATION num_emul
@@ -83,12 +83,6 @@ static int num_emul;
boolean_t is_master_device (mach_port_t port);
-static inline void
-mach_device_deallocate (void *device)
-{
- ports_port_deref (device);
-}
-
/*
* What follows is the interface for the native Mach devices.
*/
@@ -181,7 +175,6 @@ ds_device_close (struct mach_device *device)
ret = (device->dev.emul_ops->close
? (*device->dev.emul_ops->close) (device->dev.emul_data)
: D_SUCCESS);
- mach_device_deallocate (device);
return ret;
}
@@ -338,9 +331,10 @@ ds_device_map (struct mach_device *device, vm_prot_t prot, vm_offset_t offset,
return D_INVALID_OPERATION;
}
-int create_device_port (int size, void *result)
+error_t
+create_device_port (size_t size, void *result)
{
- return ports_create_port (dev_class, port_bucket,
+ return ports_create_port (dev_class, device_bucket,
size, result);
}
@@ -348,7 +342,7 @@ void mach_device_init()
{
int i;
- port_bucket = ports_create_bucket ();
+ device_bucket = ports_create_bucket ();
dev_class = ports_create_class (0, 0);
for (i = 0; i < NUM_EMULATION; i++) {
@@ -385,7 +379,7 @@ void * ds_server(void *arg)
/* Launch. */
do
{
- ports_manage_port_operations_one_thread (port_bucket, demuxer, 0);
+ ports_manage_port_operations_one_thread (device_bucket, demuxer, 0);
} while (1);
return NULL;
diff --git a/libmachdev/ds_routines.h b/libmachdev/ds_routines.h
index e314e80e..3706aa58 100644
--- a/libmachdev/ds_routines.h
+++ b/libmachdev/ds_routines.h
@@ -52,4 +52,6 @@ boolean_t ds_write_done(io_req_t);
void iowait (io_req_t ior);
+error_t create_device_port (size_t size, void *result);
+
#endif /* DS_ROUTINES_H */
diff --git a/libmachdev/mig-decls.h b/libmachdev/mig-decls.h
index 1d137cd9..b3dc43d2 100644
--- a/libmachdev/mig-decls.h
+++ b/libmachdev/mig-decls.h
@@ -23,7 +23,7 @@
#include <hurd/ports.h>
#include "dev_hdr.h"
-extern struct port_bucket *port_bucket;
+extern struct port_bucket *device_bucket;
extern struct port_class *dev_class;
/* Called by server stub functions. */
@@ -31,7 +31,7 @@ extern struct port_class *dev_class;
static inline struct mach_device * __attribute__ ((unused))
begin_using_device_port (mach_port_t port)
{
- return ports_lookup_port (port_bucket, port, dev_class);
+ return ports_lookup_port (device_bucket, port, dev_class);
}
static inline void __attribute__ ((unused))
diff --git a/libmachdev/net.c b/libmachdev/net.c
index 501c9bb7..07bb74a9 100644
--- a/libmachdev/net.c
+++ b/libmachdev/net.c
@@ -70,6 +70,7 @@
#define MACH_INCLUDE
+#include "ds_routines.h"
#include "vm_param.h"
#include "device_reply_U.h"
#include "dev_hdr.h"
@@ -80,10 +81,6 @@
#define ether_header ethhdr
-extern int linux_intr_pri;
-extern struct port_bucket *port_bucket;
-extern struct port_class *dev_class;
-
/* One of these is associated with each instance of a device. */
struct net_data
{
@@ -368,15 +365,14 @@ device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type,
dev->set_multicast_list (dev);
#endif
}
- if (MACH_PORT_VALID (reply_port))
- ds_device_open_reply (reply_port, reply_port_type,
- err, dev_to_port (nd));
- return MIG_NO_REPLY;
}
- *devp = ports_get_right (nd);
- *devicePoly = MACH_MSG_TYPE_COPY_SEND;
- return D_SUCCESS;
+ if (nd)
+ {
+ *devp = ports_get_right (nd);
+ *devicePoly = MACH_MSG_TYPE_MAKE_SEND;
+ }
+ return err;
}
static io_return_t
diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
index 0d7fe24e..7d69a2ac 100644
--- a/libmachdev/trivfs_server.c
+++ b/libmachdev/trivfs_server.c
@@ -6,6 +6,9 @@
#include <hurd/trivfs.h>
#include <hurd.h>
+#include "device_S.h"
+#include "notify_S.h"
+
static struct port_bucket *port_bucket;
/* Trivfs hooks. */