Index: trunk/minix/drivers/log/.depend
===================================================================
--- trunk/minix/drivers/log/.depend	(revision 9)
+++ 	(revision )
@@ -1,166 +1,0 @@
-
-diag.o:	../../kernel/config.h
-diag.o:	../../kernel/const.h
-diag.o:	../../kernel/type.h
-diag.o:	../drivers.h
-diag.o:	../libdriver/driver.h
-diag.o:	/usr/include/ansi.h
-diag.o:	/usr/include/errno.h
-diag.o:	/usr/include/fcntl.h
-diag.o:	/usr/include/ibm/bios.h
-diag.o:	/usr/include/ibm/cpu.h
-diag.o:	/usr/include/ibm/interrupt.h
-diag.o:	/usr/include/ibm/ports.h
-diag.o:	/usr/include/limits.h
-diag.o:	/usr/include/minix/bitmap.h
-diag.o:	/usr/include/minix/callnr.h
-diag.o:	/usr/include/minix/com.h
-diag.o:	/usr/include/minix/config.h
-diag.o:	/usr/include/minix/const.h
-diag.o:	/usr/include/minix/devio.h
-diag.o:	/usr/include/minix/dmap.h
-diag.o:	/usr/include/minix/ipc.h
-diag.o:	/usr/include/minix/partition.h
-diag.o:	/usr/include/minix/sys_config.h
-diag.o:	/usr/include/minix/syslib.h
-diag.o:	/usr/include/minix/sysutil.h
-diag.o:	/usr/include/minix/type.h
-diag.o:	/usr/include/minix/u64.h
-diag.o:	/usr/include/signal.h
-diag.o:	/usr/include/stddef.h
-diag.o:	/usr/include/stdio.h
-diag.o:	/usr/include/stdlib.h
-diag.o:	/usr/include/string.h
-diag.o:	/usr/include/sys/dir.h
-diag.o:	/usr/include/sys/types.h
-diag.o:	/usr/include/unistd.h
-diag.o:	diag.c
-diag.o:	log.h
-
-kputc.o:	../drivers.h
-kputc.o:	../libdriver/driver.h
-kputc.o:	/usr/include/ansi.h
-kputc.o:	/usr/include/errno.h
-kputc.o:	/usr/include/ibm/bios.h
-kputc.o:	/usr/include/ibm/interrupt.h
-kputc.o:	/usr/include/ibm/ports.h
-kputc.o:	/usr/include/limits.h
-kputc.o:	/usr/include/minix/bitmap.h
-kputc.o:	/usr/include/minix/callnr.h
-kputc.o:	/usr/include/minix/com.h
-kputc.o:	/usr/include/minix/config.h
-kputc.o:	/usr/include/minix/const.h
-kputc.o:	/usr/include/minix/devio.h
-kputc.o:	/usr/include/minix/dmap.h
-kputc.o:	/usr/include/minix/ipc.h
-kputc.o:	/usr/include/minix/partition.h
-kputc.o:	/usr/include/minix/sys_config.h
-kputc.o:	/usr/include/minix/syslib.h
-kputc.o:	/usr/include/minix/sysutil.h
-kputc.o:	/usr/include/minix/type.h
-kputc.o:	/usr/include/minix/u64.h
-kputc.o:	/usr/include/signal.h
-kputc.o:	/usr/include/stddef.h
-kputc.o:	/usr/include/stdlib.h
-kputc.o:	/usr/include/string.h
-kputc.o:	/usr/include/sys/dir.h
-kputc.o:	/usr/include/sys/types.h
-kputc.o:	/usr/include/unistd.h
-kputc.o:	kputc.c
-kputc.o:	log.h
-
-log.o:	../../kernel/config.h
-log.o:	../../kernel/const.h
-log.o:	../../kernel/type.h
-log.o:	../drivers.h
-log.o:	../libdriver/driver.h
-log.o:	/usr/include/ansi.h
-log.o:	/usr/include/errno.h
-log.o:	/usr/include/ibm/bios.h
-log.o:	/usr/include/ibm/cpu.h
-log.o:	/usr/include/ibm/interrupt.h
-log.o:	/usr/include/ibm/ports.h
-log.o:	/usr/include/limits.h
-log.o:	/usr/include/minix/bitmap.h
-log.o:	/usr/include/minix/callnr.h
-log.o:	/usr/include/minix/com.h
-log.o:	/usr/include/minix/config.h
-log.o:	/usr/include/minix/const.h
-log.o:	/usr/include/minix/devio.h
-log.o:	/usr/include/minix/dmap.h
-log.o:	/usr/include/minix/ipc.h
-log.o:	/usr/include/minix/partition.h
-log.o:	/usr/include/minix/sys_config.h
-log.o:	/usr/include/minix/syslib.h
-log.o:	/usr/include/minix/sysutil.h
-log.o:	/usr/include/minix/type.h
-log.o:	/usr/include/minix/u64.h
-log.o:	/usr/include/signal.h
-log.o:	/usr/include/stddef.h
-log.o:	/usr/include/stdlib.h
-log.o:	/usr/include/string.h
-log.o:	/usr/include/sys/dir.h
-log.o:	/usr/include/sys/select.h
-log.o:	/usr/include/sys/time.h
-log.o:	/usr/include/sys/types.h
-log.o:	/usr/include/unistd.h
-log.o:	log.c
-log.o:	log.h
-
-../libdriver/driver.o:	../libdriver/../drivers.h
-../libdriver/driver.o:	../libdriver/driver.c
-../libdriver/driver.o:	../libdriver/driver.h
-../libdriver/driver.o:	/usr/include/ansi.h
-../libdriver/driver.o:	/usr/include/errno.h
-../libdriver/driver.o:	/usr/include/ibm/bios.h
-../libdriver/driver.o:	/usr/include/ibm/interrupt.h
-../libdriver/driver.o:	/usr/include/ibm/ports.h
-../libdriver/driver.o:	/usr/include/limits.h
-../libdriver/driver.o:	/usr/include/minix/bitmap.h
-../libdriver/driver.o:	/usr/include/minix/callnr.h
-../libdriver/driver.o:	/usr/include/minix/com.h
-../libdriver/driver.o:	/usr/include/minix/config.h
-../libdriver/driver.o:	/usr/include/minix/const.h
-../libdriver/driver.o:	/usr/include/minix/devio.h
-../libdriver/driver.o:	/usr/include/minix/dmap.h
-../libdriver/driver.o:	/usr/include/minix/ioctl.h
-../libdriver/driver.o:	/usr/include/minix/ipc.h
-../libdriver/driver.o:	/usr/include/minix/partition.h
-../libdriver/driver.o:	/usr/include/minix/sys_config.h
-../libdriver/driver.o:	/usr/include/minix/syslib.h
-../libdriver/driver.o:	/usr/include/minix/sysutil.h
-../libdriver/driver.o:	/usr/include/minix/type.h
-../libdriver/driver.o:	/usr/include/minix/u64.h
-../libdriver/driver.o:	/usr/include/signal.h
-../libdriver/driver.o:	/usr/include/stddef.h
-../libdriver/driver.o:	/usr/include/stdlib.h
-../libdriver/driver.o:	/usr/include/string.h
-../libdriver/driver.o:	/usr/include/sys/dir.h
-../libdriver/driver.o:	/usr/include/sys/ioc_disk.h
-../libdriver/driver.o:	/usr/include/sys/types.h
-../libdriver/driver.o:	/usr/include/unistd.h
-
-../libdriver/drvlib.o:	../libdriver/driver.h
-../libdriver/drvlib.o:	../libdriver/drvlib.c
-../libdriver/drvlib.o:	../libdriver/drvlib.h
-../libdriver/drvlib.o:	/usr/include/ansi.h
-../libdriver/drvlib.o:	/usr/include/errno.h
-../libdriver/drvlib.o:	/usr/include/ibm/partition.h
-../libdriver/drvlib.o:	/usr/include/limits.h
-../libdriver/drvlib.o:	/usr/include/minix/callnr.h
-../libdriver/drvlib.o:	/usr/include/minix/com.h
-../libdriver/drvlib.o:	/usr/include/minix/config.h
-../libdriver/drvlib.o:	/usr/include/minix/const.h
-../libdriver/drvlib.o:	/usr/include/minix/devio.h
-../libdriver/drvlib.o:	/usr/include/minix/ipc.h
-../libdriver/drvlib.o:	/usr/include/minix/partition.h
-../libdriver/drvlib.o:	/usr/include/minix/sys_config.h
-../libdriver/drvlib.o:	/usr/include/minix/syslib.h
-../libdriver/drvlib.o:	/usr/include/minix/sysutil.h
-../libdriver/drvlib.o:	/usr/include/minix/type.h
-../libdriver/drvlib.o:	/usr/include/minix/u64.h
-../libdriver/drvlib.o:	/usr/include/stddef.h
-../libdriver/drvlib.o:	/usr/include/string.h
-../libdriver/drvlib.o:	/usr/include/sys/dir.h
-../libdriver/drvlib.o:	/usr/include/sys/types.h
-../libdriver/drvlib.o:	/usr/include/unistd.h
Index: trunk/minix/drivers/log/Makefile
===================================================================
--- trunk/minix/drivers/log/Makefile	(revision 9)
+++ 	(revision )
@@ -1,45 +1,0 @@
-# Makefile for log driver
-DRIVER = log
-
-# directories
-u = /usr
-i = $u/include
-s = $i/sys
-m = $i/minix
-d = ..
-
-# programs, flags, etc.
-MAKE = exec make
-CC =	exec cc
-CFLAGS = -I$i
-LDFLAGS = -i
-LIBS = -lsys -lsysutil
-
-OBJ = log.o diag.o kputc.o
-LIBDRIVER = $d/libdriver/driver.o
-
-
-# build local binary
-all build:	$(DRIVER)
-$(DRIVER):	$(OBJ) $(LIBDRIVER)
-	$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
-	install -S 4kb $(DRIVER)
-
-$(LIBDRIVER): 
-	cd $d/libdriver && $(MAKE) 
-
-# install with other drivers
-install:	$(DRIVER)
-	install -o root -cs $? /sbin/$(DRIVER) 
-
-# clean up local files
-clean:
-	rm -f $(DRIVER) *.o *.bak 
-
-
-depend: 
-	/usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libdriver/*.c > .depend
-
-# Include generated dependencies.
-include .depend
-
Index: trunk/minix/drivers/log/diag.c
===================================================================
--- trunk/minix/drivers/log/diag.c	(revision 9)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/* This file handle diagnostic output that is directly sent to the LOG driver.
- * This output can either be a kernel message (announced through a SYS_EVENT
- * with a SIGKMESS in the signal set) or output from another system process
- * (announced through a DIAGNOSTICS message).
- *
- * Changes:
- *	21 July 2005:	Created  (Jorrit N. Herder)
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "log.h"
-#include "../../kernel/const.h"
-#include "../../kernel/config.h"
-#include "../../kernel/type.h"
-
-/*==========================================================================*
- *				do_new_kmess				    *
- *==========================================================================*/
-PUBLIC int do_new_kmess(m)
-message *m;					/* notification message */
-{
-/* Notification for a new kernel message. */
-  struct kmessages kmess;		/* entire kmess structure */
-  char print_buf[KMESS_BUF_SIZE];	/* copy new message here */
-  static int prev_next = 0;
-  int bytes;
-  int i, r;
-
-  if (m->m_source == TTY_PROC_NR)
-  {
-	message mess;
-
-	/* Ask TTY driver for log output */
-	mess.GETKM_PTR= (char *) &kmess;
-	mess.m_type = GET_KMESS;
-	r= sendrec(TTY_PROC_NR, &mess);
-	if (r == OK) r= mess.m_type;
-	if (r != OK)
-	{
-		report("LOG","couldn't get copy of kmessages from TTY", r);
-		return EDONTREPLY;
-	}
-  }
-  else
-  {
-	/* Try to get a fresh copy of the buffer with kernel messages. */
-	if ((r=sys_getkmessages(&kmess)) != OK) {
-		report("LOG","couldn't get copy of kmessages", r);
-		return EDONTREPLY;
-	}
-  }
-
-  /* Print only the new part. Determine how many new bytes there are with 
-   * help of the current and previous 'next' index. Note that the kernel
-   * buffer is circular. This works fine if less then KMESS_BUF_SIZE bytes
-   * is new data; else we miss % KMESS_BUF_SIZE here.  
-   * Check for size being positive, the buffer might as well be emptied!
-   */
-  if (kmess.km_size > 0) {
-      bytes = ((kmess.km_next + KMESS_BUF_SIZE) - prev_next) % KMESS_BUF_SIZE;
-      r=prev_next;				/* start at previous old */ 
-      i=0;
-      while (bytes > 0) {			
-          print_buf[i] = kmess.km_buf[(r%KMESS_BUF_SIZE)];
-          bytes --;
-          r ++;
-          i ++;
-      }
-      /* Now terminate the new message and save it in the log. */
-      print_buf[i] = 0;
-      log_append(print_buf, i);
-  }
-
-  /* Almost done, store 'next' so that we can determine what part of the
-   * kernel messages buffer to print next time a notification arrives.
-   */
-  prev_next = kmess.km_next;
-  return EDONTREPLY;
-}
-
-/*===========================================================================*
- *				do_diagnostics				     *
- *===========================================================================*/
-PUBLIC int do_diagnostics(message *m)
-{
-/* The LOG server handles all diagnostic messages from servers and device 
- * drivers. It forwards the message to the TTY driver to display it to the
- * user. It also saves a copy in a local buffer so that messages can be 
- * reviewed at a later time.
- */
-  int proc_nr_e; 
-  vir_bytes src;
-  int count;
-  char c;
-  int i = 0;
-  static char diagbuf[10240];
-
-  /* Change SELF to actual process number. */
-  if ((proc_nr_e = m->DIAG_ENDPT) == SELF)
-      m->DIAG_ENDPT = proc_nr_e = m->m_source;
-
-  /* Now also make a copy for the private buffer at the LOG server, so
-   * that the messages can be reviewed at a later time.
-   */
-  src = (vir_bytes) m->DIAG_PRINT_BUF;
-  count = m->DIAG_BUF_COUNT; 
-  while (count > 0 && i < sizeof(diagbuf)-1) {
-      if (sys_datacopy(proc_nr_e, src, SELF, (vir_bytes) &c, 1) != OK) 
-          break;		/* stop copying on error */
-      src ++;
-      count --;
-      diagbuf[i++] = c;
-  }
-  log_append(diagbuf, i);
-
-  return OK;
-}
Index: trunk/minix/drivers/log/kputc.c
===================================================================
--- trunk/minix/drivers/log/kputc.c	(revision 9)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/* A server must occasionally print some message.  It uses a simple version of 
- * printf() found in the system library that calls putk() to output characters.
- * The LOG driver cannot use the regular putk().  Hence, it uses a special
- * version of putk() that directly sends to the TTY task. 
- *
- * Changes:
- *	21 July 2005:	Created  (Jorrit N. Herder)
- */
-
-#include "log.h"
-
-/*===========================================================================*
- *				kputc					     *
- *===========================================================================*/
-void kputc(c)
-int c;
-{
-/* Accumulate another character.  If 0 or buffer full, print it. */
-  static int buf_count;		/* # characters in the buffer */
-  static char print_buf[80];	/* output is buffered here */
-  message m;
-
-  if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) {
-	m.DIAG_BUF_COUNT = buf_count;
-	m.DIAG_PRINT_BUF = print_buf;
-	m.DIAG_ENDPT = SELF;
-	m.m_type = DIAGNOSTICS;		/* request TTY to output this buffer */
-	_sendrec(TTY_PROC_NR, &m);	/* if it fails, we give up */ 
-	buf_count = 0;			/* clear buffer for next batch */
-  }
-  if (c != 0) {
-  	print_buf[buf_count++] = c;
-  }
-}
-
Index: trunk/minix/drivers/log/log.c
===================================================================
--- trunk/minix/drivers/log/log.c	(revision 9)
+++ 	(revision )
@@ -1,480 +1,0 @@
-/* This file contains a driver for:
- *     /dev/klog	- system log device
- *
- * Changes:
- *   21 July 2005   - Support for diagnostic messages (Jorrit N. Herder)
- *    7 July 2005   - Created (Ben Gras)
- */
-
-#include "log.h"
-#include <sys/time.h>
-#include <sys/select.h>
-#include "../../kernel/const.h"
-#include "../../kernel/type.h"
-
-#define LOG_DEBUG		0	/* enable/ disable debugging */
-
-#define NR_DEVS            	1	/* number of minor devices */
-#define MINOR_KLOG		0	/* /dev/klog */
-
-#define LOGINC(n, i)	do { (n) = (((n) + (i)) % LOG_SIZE); } while(0)
-
-PUBLIC struct logdevice logdevices[NR_DEVS];
-PRIVATE struct device log_geom[NR_DEVS];  	/* base and size of devices */
-PRIVATE int log_device = -1;	 		/* current device */
-
-FORWARD _PROTOTYPE( char *log_name, (void) );
-FORWARD _PROTOTYPE( struct device *log_prepare, (int device) );
-FORWARD _PROTOTYPE( int log_transfer, (int proc_nr, int opcode, off_t position,
-					iovec_t *iov, unsigned nr_req) );
-FORWARD _PROTOTYPE( int log_do_open, (struct driver *dp, message *m_ptr) );
-FORWARD _PROTOTYPE( int log_cancel, (struct driver *dp, message *m_ptr) );
-FORWARD _PROTOTYPE( int log_select, (struct driver *dp, message *m_ptr) );
-FORWARD _PROTOTYPE( void log_signal, (struct driver *dp, message *m_ptr) );
-FORWARD _PROTOTYPE( int log_other, (struct driver *dp, message *m_ptr) );
-FORWARD _PROTOTYPE( void log_geometry, (struct partition *entry) );
-FORWARD _PROTOTYPE( int subread, (struct logdevice *log, int count, int proc_nr, vir_bytes user_vir) );
-
-/* Entry points to this driver. */
-PRIVATE struct driver log_dtab = {
-  log_name,	/* current device's name */
-  log_do_open,	/* open or mount */
-  do_nop,	/* nothing on a close */
-  do_nop,	/* ioctl nop */
-  log_prepare,	/* prepare for I/O on a given minor device */
-  log_transfer,	/* do the I/O */
-  nop_cleanup,	/* no need to clean up */
-  log_geometry,	/* geometry */
-  log_signal,	/* handle system signal */
-  nop_alarm, 	/* no alarm */
-  log_cancel,	/* CANCEL request */
-  log_select,	/* DEV_SELECT request */
-  log_other,	/* Unrecognized messages */
-  NULL		/* HW int */
-};
-
-extern int device_caller;
-
-/*===========================================================================*
- *				   main 				     *
- *===========================================================================*/
-PUBLIC int main(void)
-{
-  int i;
-  for(i = 0; i < NR_DEVS; i++) {
-  	log_geom[i].dv_size = cvul64(LOG_SIZE);
- 	log_geom[i].dv_base = cvul64((long)logdevices[i].log_buffer);
- 	logdevices[i].log_size = logdevices[i].log_read =
-	 	logdevices[i].log_write =
-	 	logdevices[i].log_select_alerted =
-	 	logdevices[i].log_selected =
-	 	logdevices[i].log_select_ready_ops = 0;
- 	logdevices[i].log_proc_nr = 0;
- 	logdevices[i].log_revive_alerted = 0;
-  }
-  driver_task(&log_dtab);
-  return(OK);
-}
-
-/*===========================================================================*
- *				 log_name					     *
- *===========================================================================*/
-PRIVATE char *log_name()
-{
-/* Return a name for the current device. */
-  static char name[] = "log";
-  return name;  
-}
-
-/*===========================================================================*
- *				log_prepare				     *
- *===========================================================================*/
-PRIVATE struct device *log_prepare(device)
-int device;
-{
-/* Prepare for I/O on a device: check if the minor device number is ok. */
-
-  if (device < 0 || device >= NR_DEVS) return(NIL_DEV);
-  log_device = device;
-
-  return(&log_geom[device]);
-}
-
-/*===========================================================================*
- *				subwrite					     *
- *===========================================================================*/
-PRIVATE int
-subwrite(struct logdevice *log, int count, int proc_nr, vir_bytes user_vir)
-{
-	char *buf;
-	int r;
-	if (log->log_write + count > LOG_SIZE)
-		count = LOG_SIZE - log->log_write;
-	buf = log->log_buffer + log->log_write;
-
-	if(proc_nr == SELF) {
-		memcpy(buf, (char *) user_vir, count);
-	}
-	else {
-		if((r=sys_vircopy(proc_nr,D,user_vir, SELF,D,(int)buf, count)) != OK)
-			return r;
-	}
-
-	LOGINC(log->log_write, count);
-	log->log_size += count;
-
-        if(log->log_size > LOG_SIZE) {
-        	int overflow;
-        	overflow = log->log_size - LOG_SIZE;
-        	log->log_size -= overflow;
-        	LOGINC(log->log_read, overflow);
-        }
-
-        if(log->log_size > 0 && log->log_proc_nr && !log->log_revive_alerted) {
-        	/* Someone who was suspended on read can now
-        	 * be revived.
-        	 */
-    		log->log_status = subread(log, log->log_iosize,
-    			log->log_proc_nr, log->log_user_vir);
-    		notify(log->log_source); 
-    		log->log_revive_alerted = 1;
- 	} 
-
-	if(log->log_size > 0)
-		log->log_select_ready_ops |= SEL_RD;
-
-	if(log->log_size > 0 && log->log_selected &&
-	  !(log->log_select_alerted)) {
-  		/* Someone(s) who was/were select()ing can now
-  		 * be awoken. If there was a blocking read (above),
-  		 * this can only happen if the blocking read didn't
-  		 * swallow all the data (log_size > 0).
-  		 */
-  		if(log->log_selected & SEL_RD) {
-    			notify(log->log_select_proc);
-    			log->log_select_alerted = 1;
-#if LOG_DEBUG
-			printf("log notified %d\n", log->log_select_proc);
-#endif
-  		}
-  	}
-
-        return count;
-}
-
-/*===========================================================================*
- *				log_append				*
- *===========================================================================*/
-PUBLIC void
-log_append(char *buf, int count)
-{
-	int w = 0, skip = 0;
-
-	if(count < 1) return;
-	if(count > LOG_SIZE) skip = count - LOG_SIZE;
-	count -= skip;
-	buf += skip;
-	w = subwrite(&logdevices[0], count, SELF, (vir_bytes) buf);
-
-	if(w > 0 && w < count)
-		subwrite(&logdevices[0], count-w, SELF, (vir_bytes) buf+w);
-	return;
-}
-
-/*===========================================================================*
- *				subread					     *
- *===========================================================================*/
-PRIVATE int
-subread(struct logdevice *log, int count, int proc_nr, vir_bytes user_vir)
-{
-	char *buf;
-	int r;
-    	if (count > log->log_size)
-    		count = log->log_size;
-        if (log->log_read + count > LOG_SIZE)
-        	count = LOG_SIZE - log->log_read;
-
-    	buf = log->log_buffer + log->log_read;
-        if((r=sys_vircopy(SELF,D,(int)buf,proc_nr,D,user_vir, count)) != OK)
-        	return r;
-
-  	LOGINC(log->log_read, count);
-        log->log_size -= count;
-
-        return count;
-}
-
-/*===========================================================================*
- *				log_transfer				     *
- *===========================================================================*/
-PRIVATE int log_transfer(proc_nr, opcode, position, iov, nr_req)
-int proc_nr;			/* process doing the request */
-int opcode;			/* DEV_GATHER or DEV_SCATTER */
-off_t position;			/* offset on device to read or write */
-iovec_t *iov;			/* pointer to read or write request vector */
-unsigned nr_req;		/* length of request vector */
-{
-/* Read or write one the driver's minor devices. */
-  unsigned count;
-  vir_bytes user_vir;
-  struct device *dv;
-  unsigned long dv_size;
-  int accumulated_read = 0;
-  struct logdevice *log;
-  static int f;
-
-  if(log_device < 0 || log_device >= NR_DEVS)
-  	return EIO;
-
-  /* Get minor device number and check for /dev/null. */
-  dv = &log_geom[log_device];
-  dv_size = cv64ul(dv->dv_size);
-  log = &logdevices[log_device];
-
-  while (nr_req > 0) {
-	/* How much to transfer and where to / from. */
-	count = iov->iov_size;
-	user_vir = iov->iov_addr;
-
-	switch (log_device) {
-
-	case MINOR_KLOG:
-	    if (opcode == DEV_GATHER) {
-	    	if (log->log_proc_nr || count < 1) {
-	    		/* There's already someone hanging to read, or
-	    		 * no real I/O requested.
-	    		 */
-	    		return(OK);
-	    	}
-
-	    	if (!log->log_size) {
-	    		if(accumulated_read)
-	    			return OK;
-	    		/* No data available; let caller block. */
-	    		log->log_proc_nr = proc_nr;
-	    		log->log_iosize = count;
-	    		log->log_user_vir = user_vir;
-	    		log->log_revive_alerted = 0;
-
-			/* Device_caller is a global in drivers library. */
-	    		log->log_source = device_caller;
-#if LOG_DEBUG
-	    		printf("blocked %d (%d)\n", 
-	    			log->log_source, log->log_proc_nr);
-#endif
-	    		return(SUSPEND);
-	    	}
-	    	count = subread(log, count, proc_nr, user_vir);
-	    	if(count < 0) {
-	    		return count;
-	    	}
-	    	accumulated_read += count;
-	    } else {
-	    	count = subwrite(log, count, proc_nr, user_vir);
-	    	if(count < 0)
-	    		return count;
-	    }
-	    break;
-	/* Unknown (illegal) minor device. */
-	default:
-	    return(EINVAL);
-	}
-
-	/* Book the number of bytes transferred. */
-	iov->iov_addr += count;
-  	if ((iov->iov_size -= count) == 0) { iov++; nr_req--; }
-  }
-  return(OK);
-}
-
-/*============================================================================*
- *				log_do_open				      *
- *============================================================================*/
-PRIVATE int log_do_open(dp, m_ptr)
-struct driver *dp;
-message *m_ptr;
-{
-  if (log_prepare(m_ptr->DEVICE) == NIL_DEV) return(ENXIO);
-  return(OK);
-}
-
-/*============================================================================*
- *				log_geometry				      *
- *============================================================================*/
-PRIVATE void log_geometry(entry)
-struct partition *entry;
-{
-  /* take a page from the fake memory device geometry */
-  entry->heads = 64;
-  entry->sectors = 32;
-  entry->cylinders = div64u(log_geom[log_device].dv_size, SECTOR_SIZE) /
-  	(entry->heads * entry->sectors);
-}
-
-/*============================================================================*
- *				log_cancel				      *
- *============================================================================*/
-PRIVATE int log_cancel(dp, m_ptr)
-struct driver *dp;
-message *m_ptr;
-{
-  int d;
-  d = m_ptr->TTY_LINE;
-  if(d < 0 || d >= NR_DEVS)
-  	return EINVAL;
-  logdevices[d].log_proc_nr = 0;
-  logdevices[d].log_revive_alerted = 0;
-  return(OK);
-}
-
-/*============================================================================*
- *				do_status				      *
- *============================================================================*/
-PRIVATE void do_status(message *m_ptr)
-{
-	int d; 
-	message m;
-
-	/* Caller has requested pending status information, which currently
-	 * can be pending available select()s, or REVIVE events. One message
-	 * is returned for every event, or DEV_NO_STATUS if no (more) events
-	 * are to be returned.
-	 */
-
-	for(d = 0; d < NR_DEVS; d++) {
-		/* Check for revive callback. */
-		if(logdevices[d].log_proc_nr && logdevices[d].log_revive_alerted
-		   && logdevices[d].log_source == m_ptr->m_source) {
-			m.m_type = DEV_REVIVE;
-			m.REP_ENDPT = logdevices[d].log_proc_nr;
-			m.REP_STATUS  = logdevices[d].log_status;
-  			send(m_ptr->m_source, &m);
-			logdevices[d].log_proc_nr = 0;
-			logdevices[d].log_revive_alerted = 0;
-#if LOG_DEBUG
-    		printf("revived %d with %d bytes\n", 
-			m.REP_ENDPT, m.REP_STATUS);
-#endif
-			return;
-		}
-
-		/* Check for select callback. */
-		if(logdevices[d].log_selected && logdevices[d].log_select_proc == m_ptr->m_source 
-			&& logdevices[d].log_select_alerted) {
-			m.m_type = DEV_IO_READY;
-			m.DEV_SEL_OPS = logdevices[d].log_select_ready_ops;
-			m.DEV_MINOR   = d;
-#if LOG_DEBUG
-    		printf("select sending sent\n");
-#endif
-  			send(m_ptr->m_source, &m);
-			logdevices[d].log_selected &= ~logdevices[d].log_select_ready_ops;
-			logdevices[d].log_select_alerted = 0;
-#if LOG_DEBUG
-    		printf("select send sent\n");
-#endif
-			return;
-		}
-	}
-
-	/* No event found. */
-	m.m_type = DEV_NO_STATUS;
-  	send(m_ptr->m_source, &m);
-
-	return;
-}
-
-/*============================================================================*
- *				log_signal				      *
- *============================================================================*/
-PRIVATE void log_signal(dp, m_ptr)
-struct driver *dp;
-message *m_ptr;
-{
-  sigset_t sigset = m_ptr->NOTIFY_ARG;
-  if (sigismember(&sigset, SIGKMESS)) {
-	do_new_kmess(m_ptr);
-  }	
-}
-
-	
-/*============================================================================*
- *				log_other				      *
- *============================================================================*/
-PRIVATE int log_other(dp, m_ptr)
-struct driver *dp;
-message *m_ptr;
-{
-	int r;
-
-	/* This function gets messages that the generic driver doesn't
-	 * understand.
-	 */
-	switch(m_ptr->m_type) {
-	case DIAGNOSTICS: {
-		r = do_diagnostics(m_ptr);
-		break;
-	}
-	case DEV_STATUS: {
-		do_status(m_ptr);
-		r = EDONTREPLY;
-		break;
-	}
-	case NOTIFY_FROM(TTY_PROC_NR):
-		do_new_kmess(m_ptr);
-		r = EDONTREPLY;
-		break;
-	default:
-		r = EINVAL;
-		break;
-	}
-	return r;
-}
-
-/*============================================================================*
- *				log_select				      *
- *============================================================================*/
-PRIVATE int log_select(dp, m_ptr)
-struct driver *dp;
-message *m_ptr;
-{
-  int d, ready_ops = 0, ops = 0;
-  d = m_ptr->TTY_LINE;
-  if(d < 0 || d >= NR_DEVS) {
-#if LOG_DEBUG
-  	printf("line %d? EINVAL\n", d);
-#endif
-  	return EINVAL;
-  }
-
-  ops = m_ptr->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
-
-  	/* Read blocks when there is no log. */
-  if((m_ptr->IO_ENDPT & SEL_RD) && logdevices[d].log_size > 0) {
-#if LOG_DEBUG
-  	printf("log can read; size %d\n", logdevices[d].log_size);
-#endif
-  	ready_ops |= SEL_RD; /* writes never block */
- }
-
-  	/* Write never blocks. */
-  if(m_ptr->IO_ENDPT & SEL_WR) ready_ops |= SEL_WR;
-
-	/* Enable select calback if no operations were
-	 * ready to go, but operations were requested,
-	 * and notify was enabled.
-	 */
-  if((m_ptr->IO_ENDPT & SEL_NOTIFY) && ops && !ready_ops) {
-  	logdevices[d].log_selected |= ops;
-  	logdevices[d].log_select_proc = m_ptr->m_source;
-#if LOG_DEBUG
-  	printf("log setting selector.\n");
-#endif
-  }
-
-#if LOG_DEBUG
-  printf("log returning ops %d\n", ready_ops);
-#endif
-
-  return(ready_ops);
-}
Index: trunk/minix/drivers/log/log.h
===================================================================
--- trunk/minix/drivers/log/log.h	(revision 9)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/* Includes. */
-#include "../drivers.h"
-#include "../libdriver/driver.h"
-#include <minix/type.h>
-#include <minix/const.h>
-#include <minix/com.h>
-#include <sys/types.h>
-#include <minix/ipc.h>
-
-/* Constants and types. */
-
-#define LOG_SIZE	(50*1024) 
-#define SUSPENDABLE 	      1
-
-struct logdevice {
-	char log_buffer[LOG_SIZE];
-	int	log_size,	/* no. of bytes in log buffer */
-		log_read,	/* read mark */
-		log_write;	/* write mark */
-#if SUSPENDABLE
-	int log_proc_nr,
-		log_source,
-		log_iosize,
-		log_revive_alerted,
-		log_status;	/* proc that is blocking on read */
-	vir_bytes log_user_vir;
-#endif
-	int	log_selected, log_select_proc,
-		log_select_alerted, log_select_ready_ops;
-};
-
-/* Function prototypes. */
-_PROTOTYPE( void kputc, (int c)						);
-_PROTOTYPE( int do_new_kmess, (message *m)				);
-_PROTOTYPE( int do_diagnostics, (message *m)				);
-_PROTOTYPE( void log_append, (char *buf, int len)				);
-
