summaryrefslogtreecommitdiff
path: root/device
diff options
context:
space:
mode:
Diffstat (limited to 'device')
-rw-r--r--device/conf.h39
-rw-r--r--device/dev_name.c38
-rw-r--r--device/ds_routines.c2
-rw-r--r--device/kmsg.c3
-rw-r--r--device/kmsg.h2
5 files changed, 66 insertions, 18 deletions
diff --git a/device/conf.h b/device/conf.h
index a0d5010..fea1822 100644
--- a/device/conf.h
+++ b/device/conf.h
@@ -32,22 +32,30 @@
#define _DEVICE_CONF_H_
#include <mach/machine/vm_types.h>
+#include <sys/types.h>
+#include <mach/port.h>
+#include <mach/vm_prot.h>
+
+struct io_req;
+typedef struct io_req *io_req_t;
+
+typedef int io_return_t;
/*
* Operations list for major device types.
*/
struct dev_ops {
- char * d_name; /* name for major device */
- int (*d_open)(); /* open device */
- int (*d_close)(); /* close device */
- int (*d_read)(); /* read */
- int (*d_write)(); /* write */
- int (*d_getstat)(); /* get status/control */
- int (*d_setstat)(); /* set status/control */
- vm_offset_t (*d_mmap)(); /* map memory */
- int (*d_async_in)();/* asynchronous input setup */
- int (*d_reset)(); /* reset device */
- int (*d_port_death)();
+ char * d_name; /* name for major device */
+ int (*d_open)(dev_t, int, io_req_t);/* open device */
+ void (*d_close)(dev_t, int); /* close device */
+ int (*d_read)(dev_t, io_req_t); /* read */
+ int (*d_write)(dev_t, io_req_t); /* write */
+ int (*d_getstat)(dev_t, int, int *, natural_t *); /* get status/control */
+ int (*d_setstat)(dev_t, int, int *, natural_t); /* set status/control */
+ int (*d_mmap)(dev_t, vm_offset_t, vm_prot_t); /* map memory */
+ int (*d_async_in)(); /* asynchronous input setup */
+ int (*d_reset)(); /* reset device */
+ int (*d_port_death)(dev_t, mach_port_t);
/* clean up reply ports */
int d_subdev; /* number of sub-devices per
unit */
@@ -59,8 +67,15 @@ typedef struct dev_ops *dev_ops_t;
* Routines for null entries.
*/
extern int nulldev(void); /* no operation - OK */
+extern int nulldev_open(dev_t dev, int flag, io_req_t ior);
+extern void nulldev_close(dev_t dev, int flags);
+extern int nulldev_read(dev_t dev, io_req_t ior);
+extern int nulldev_write(dev_t dev, io_req_t ior);
+extern io_return_t nulldev_getstat(dev_t dev, int flavor, int *data, natural_t *count);
+extern io_return_t nulldev_setstat(dev_t dev, int flavor, int *data, natural_t count);
+extern io_return_t nulldev_portdeath(dev_t dev, mach_port_t port);
extern int nodev(void); /* no operation - error */
-extern vm_offset_t nomap(void); /* no operation - error */
+extern int nomap(dev_t dev, vm_offset_t off, int prot); /* no operation - error */
/*
* Flavor constants for d_dev_info routine
diff --git a/device/dev_name.c b/device/dev_name.c
index 4cc046a..cd3a28a 100644
--- a/device/dev_name.c
+++ b/device/dev_name.c
@@ -44,13 +44,47 @@ int nulldev(void)
return (D_SUCCESS);
}
+int nulldev_open(dev_t dev, int flags, io_req_t ior)
+{
+ return (D_SUCCESS);
+}
+
+void nulldev_close(dev_t dev, int flags)
+{
+}
+
+int nulldev_read(dev_t dev, io_req_t ior)
+{
+ return (D_SUCCESS);
+}
+
+int nulldev_write(dev_t dev, io_req_t ior)
+{
+ return (D_SUCCESS);
+}
+
+io_return_t nulldev_getstat(dev_t dev, int flavor, int *data, natural_t *count)
+{
+ return (D_SUCCESS);
+}
+
+io_return_t nulldev_setstat(dev_t dev, int flavor, int *data, natural_t count)
+{
+ return (D_SUCCESS);
+}
+
+int nulldev_portdeath(dev_t dev, mach_port_t port)
+{
+ return (D_SUCCESS);
+}
+
int nodev(void)
{
return (D_INVALID_OPERATION);
}
-vm_offset_t
-nomap(void)
+int
+nomap(dev_t dev, vm_offset_t off, int prot)
{
return (D_INVALID_OPERATION);
}
diff --git a/device/ds_routines.c b/device/ds_routines.c
index 82b5252..4e04445 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -639,7 +639,7 @@ device_close(device)
/*
* Close the device
*/
- (*device->dev_ops->d_close)(device->dev_number);
+ (*device->dev_ops->d_close)(device->dev_number, 0);
/*
* Finally mark it closed. If someone else is trying
diff --git a/device/kmsg.c b/device/kmsg.c
index 40956dd..c80775d 100644
--- a/device/kmsg.c
+++ b/device/kmsg.c
@@ -77,14 +77,13 @@ kmsgopen (dev_t dev, int flag, const io_req_t ior)
}
/* Kernel Message Close Handler */
-io_return_t
+void
kmsgclose (dev_t dev, int flag)
{
simple_lock (&kmsg_lock);
kmsg_in_use = FALSE;
simple_unlock (&kmsg_lock);
- return D_SUCCESS;
}
static boolean_t kmsg_read_done (io_req_t ior);
diff --git a/device/kmsg.h b/device/kmsg.h
index b8c1f36..8d907f1 100644
--- a/device/kmsg.h
+++ b/device/kmsg.h
@@ -8,7 +8,7 @@
#include <device/io_req.h>
io_return_t kmsgopen (dev_t dev, int flag, io_req_t ior);
-io_return_t kmsgclose (dev_t dev, int flag);
+void kmsgclose (dev_t dev, int flag);
io_return_t kmsgread (dev_t dev, io_req_t ior);
io_return_t kmsggetstat (dev_t dev, int flavor,
int *data, unsigned int *count);