|
|
1.1 ! root 1: #ifndef _DS_REQUEST_H_ ! 2: #define _DS_REQUEST_H_ ! 3: ! 4: #include "ds_oskit.h" ! 5: #include <kern/zalloc.h> ! 6: #include <kern/queue.h> ! 7: #include <kern/lock.h> ! 8: ! 9: /* This structure describes a pending asynchronous device request. ! 10: ! 11: That is, an i/o that is in progress but with no thread waiting for it. ! 12: We store here all the information we need to complete the i/o and send ! 13: the reply message to complete the device RPC. ! 14: ! 15: This is currently only used for oskit asyncio devices, but can be ! 16: extended for other types e.g. when the oskit gives us a way not to ! 17: block the device request thread doing disk i/o. ! 18: ! 19: These structures are queued on the device's read_queue or write_queue. ! 20: Notifications from the device put the device itself onto the ! 21: device_ready_queue and wake the io_done_thread. The io_done_thread ! 22: takes devices off the ready queue, polls them for i/o availability ! 23: and then dequeues requests from their read_queue and/or write_queue ! 24: as long as there is i/o available. ! 25: ! 26: All of these queues are accessed at splio and locked by ! 27: device_ready_queue_lock. */ ! 28: ! 29: struct pending_request { ! 30: queue_chain_t chain; /* on device's read_queue or write_queue */ ! 31: ! 32: void (*completer) (device_t, struct pending_request *); ! 33: ! 34: struct ipc_port *reply_port; ! 35: mach_msg_type_name_t reply_port_type; ! 36: ! 37: oskit_size_t count, offset; ! 38: ! 39: union device_data { ! 40: vm_map_copy_t outofband; ! 41: char *inband; /* from io_inband_zone */ ! 42: vm_offset_t inbando; /* rather than casting */ ! 43: #define IO_SMALL_MAX (sizeof (vm_map_copy_t)) ! 44: char small[IO_SMALL_MAX]; ! 45: } data; ! 46: }; ! 47: ! 48: extern zone_t io_req_zone; ! 49: #define request_allocate() ((void *) zalloc (io_req_zone)) ! 50: #define request_free(req) (zfree (io_req_zone, (vm_offset_t) (req))) ! 51: ! 52: ! 53: extern queue_head_t device_ready_queue; ! 54: decl_simple_lock_data(extern, device_ready_queue_lock) ! 55: ! 56: extern void ds_request_init (void); ! 57: extern void ds_device_ready (device_t); ! 58: extern void ds_asyncio_ready (device_t); ! 59: ! 60: ! 61: ! 62: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.