summaryrefslogtreecommitdiff
path: root/device/conf.h
diff options
context:
space:
mode:
authorMarin Ramesa <mpr@hi.t-com.hr>2014-04-04 21:52:39 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-04-04 21:52:39 +0200
commit2a8d65dfceb4ac35b09935a5e5fb62be1a44ab14 (patch)
treec61230f378b7488908c5f4ab1cf0217a75ab7b12 /device/conf.h
parent32be3a889794a212a5a4083de279134c22c314a3 (diff)
Use explicit prototypes for struct dev_ops fields
* device/conf.h: Include <sys/types.h>, <mach/port.h>, <mach/vm_prot.h>. Predefine struct io_req, io_req_t and io_return_t. (dev_ops): Add explicit prototypes for d_open, d_close, d_read, d_write, d_getstat, d_setstat, d_mmap, d_port_death. (nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath): Add prototypes. (nomap): Fix prototype. * device/dev_name.c (nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath): New functions. (nomap): Fix prototype. * device/ds_routines.c (dev_close): Pass 0 as flag parameter. * device/kmsg.c (kmsgclose): Drop return value. * device/kmsg.h (kmsgclose): Fix prototype. * i386/i386at/com.c (comopen): Fix prototype. (comclose): Fix prototype, drop return value. (comread, comwrite): Fix prototype. * i386/i386at/com.h (comopen, comclose, comread, comwrite): Fix prototype. * i386/i386at/conf.c (dev_ops): Use nulldev_open, nulldev_close, nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath where appropriate. * i386/i386at/kd.c (kdclose, kdread, kdwrite, kdmmap): Fix prototype. * i386/i386at/kd.h (kdclose, kdread, kdwrite, kdmmap): Likewise. * i386/i386at/kd_event.c (kbdopen): Likewise. * i386/i386at/kd_event.h (kbdopen): Likewise. * i386/i386at/kd_mouse.c (mouseopen): Likewise. * i386/i386at/kd_mouse.h (mouseopen): Likewise. * i386/i386at/lpr.c (lpropen, lprclose, lprread, lprwrite): Likewise. * i386/i386at/lpr.h (lpropen, lprclose, lprread, lprwrite): Likewise. * i386/i386at/mem.c (memmmap): Likewise. * i386/i386at/mem.h (memmmap): Likewise. * i386/i386at/model_dep.c (timemmap): Likewise. * i386/i386at/model_dep.h (timemmap): Likewise. * kern/mach_clock.c (timeopen, timeclose): Likewise. * kern/mach_clock.h: Include <sys/types.h>, predefine struct io_req and io_req_t. (timeopen, timeclose): Fix prototype.
Diffstat (limited to 'device/conf.h')
-rw-r--r--device/conf.h39
1 files changed, 27 insertions, 12 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