_PROTOTYPE( int driver_receive, (endpoint_t src, message *m_ptr,
int *status_ptr) );
_PROTOTYPE( int driver_receive_mq, (message *m_ptr, int *status_ptr) );
+_PROTOTYPE( void driver_terminate, (void) );
_PROTOTYPE( void driver_task, (struct driver *dr, int type) );
_PROTOTYPE( int driver_mq_queue, (message *m_ptr, int status) );
_PROTOTYPE( void driver_init_buffer, (void) );
PRIVATE mq_t *queue_head = NULL;
PRIVATE int open_devs[MAX_NR_OPEN_DEVICES];
PRIVATE int next_open_devs_slot = 0;
+PRIVATE int driver_running;
/*===========================================================================*
* clear_open_devs *
return driver_receive(ANY, m_ptr, status_ptr);
}
+/*===========================================================================*
+ * driver_terminate *
+ *===========================================================================*/
+PUBLIC void driver_terminate(void)
+{
+/* Break out of the main driver loop after finishing the current request.
+ */
+
+ driver_running = FALSE;
+}
+
/*===========================================================================*
* driver_task *
*===========================================================================*/
int r, proc_nr, ipc_status;
message mess;
+ driver_running = TRUE;
+
/* Here is the main loop of the disk task. It waits for a message, carries
* it out, and sends a reply.
*/
- while (TRUE) {
+ while (driver_running) {
if ((r=driver_receive_mq(&mess, &ipc_status)) != OK)
panic("driver_receive_mq failed: %d", r);