summaryrefslogtreecommitdiff
path: root/libmachdev
diff options
context:
space:
mode:
Diffstat (limited to 'libmachdev')
-rw-r--r--libmachdev/Makefile5
-rw-r--r--libmachdev/block.c9
-rw-r--r--libmachdev/device_emul.h3
-rw-r--r--libmachdev/ds_routines.c4
-rw-r--r--libmachdev/net.c4
5 files changed, 18 insertions, 7 deletions
diff --git a/libmachdev/Makefile b/libmachdev/Makefile
index e65a453a..22909949 100644
--- a/libmachdev/Makefile
+++ b/libmachdev/Makefile
@@ -20,7 +20,7 @@ makemode := library
libname = libmachdev
SRCS = deviceUser.c machUser.c net.c ds_routines.c queue.c trivfs_server.c \
- device_replyUser.c deviceServer.c notifyServer.c misc.c block.c
+ device_replyUser.c ourdeviceServer.c notifyServer.c misc.c block.c
LCLHDRS = dev_hdr.h device_emul.h ds_routines.h vm_param.h \
util.h queue.h io_req.h if_ether.h machdev.h linux-errno.h \
errno-base.h
@@ -31,3 +31,6 @@ OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
include ../Makeconf
CFLAGS += -I$(top_srcdir)/libddekit/include
+
+ourdevice.defs: device.defs
+ $(CPP) $(CPPFLAGS) -x c $< | sed -e '/out[ ]*device[ ]*:[ ]*device_t/s/device_t/mach_port_send_t/' > $@
diff --git a/libmachdev/block.c b/libmachdev/block.c
index 5400f60b..4aa07672 100644
--- a/libmachdev/block.c
+++ b/libmachdev/block.c
@@ -109,7 +109,8 @@ find_major:
static io_return_t
device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type,
- dev_mode_t mode, char *name, device_t *devp)
+ dev_mode_t mode, char *name, device_t *devp,
+ mach_msg_type_name_t *devicePoly)
{
io_return_t err = D_SUCCESS;
struct block_data *bd = NULL;
@@ -149,7 +150,11 @@ out:
}
}
else
- *devp = ports_get_send_right (bd);
+ {
+ *devp = ports_get_send_right (bd);
+ ports_port_deref (bd);
+ *devicePoly = MACH_MSG_TYPE_MOVE_SEND;
+ }
return err;
}
diff --git a/libmachdev/device_emul.h b/libmachdev/device_emul.h
index a5bc4f77..e27799cb 100644
--- a/libmachdev/device_emul.h
+++ b/libmachdev/device_emul.h
@@ -36,7 +36,8 @@ struct device_emulation_ops
void (*dealloc) (void *);
mach_port_t (*dev_to_port) (void *);
io_return_t (*open) (mach_port_t, mach_msg_type_name_t,
- dev_mode_t, char *, device_t *);
+ dev_mode_t, char *, device_t *,
+ mach_msg_type_name_t *type);
io_return_t (*close) (void *);
io_return_t (*write) (void *, mach_port_t, mach_msg_type_name_t,
dev_mode_t, recnum_t, io_buf_ptr_t, unsigned, int *);
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index df9146a0..71457e03 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -161,7 +161,7 @@ ds_device_irq_enable (mach_port_t master_port,
io_return_t
ds_device_open (mach_port_t open_port, mach_port_t reply_port,
mach_msg_type_name_t reply_port_type, dev_mode_t mode,
- char *name, device_t *devp)
+ char *name, device_t *devp, mach_msg_type_name_t *devicePoly)
{
int i;
io_return_t err;
@@ -181,7 +181,7 @@ ds_device_open (mach_port_t open_port, mach_port_t reply_port,
for (i = 0; i < NUM_EMULATION; i++)
{
err = (*emulation_list[i]->open) (reply_port, reply_port_type,
- mode, name, devp);
+ mode, name, devp, devicePoly);
if (err != D_NO_SUCH_DEVICE)
break;
}
diff --git a/libmachdev/net.c b/libmachdev/net.c
index 8c435b4b..b9d76731 100644
--- a/libmachdev/net.c
+++ b/libmachdev/net.c
@@ -273,7 +273,8 @@ void if_init_queues(ifp)
static io_return_t
device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type,
- dev_mode_t mode, char *name, device_t *devp)
+ dev_mode_t mode, char *name, device_t *devp,
+ mach_msg_type_name_t *devicePoly)
{
io_return_t err = D_SUCCESS;
struct net_device *dev;
@@ -357,6 +358,7 @@ device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type,
}
*devp = ports_get_right (nd);
+ *devicePoly = MACH_MSG_TYPE_COPY_SEND;
return D_SUCCESS;
}