reorganization to move ufsmount ops to be vnode ops;
[unix-history] / usr / src / sys / stand.att / dev.c
index fbaf499..4e7ce34 100644 (file)
@@ -2,34 +2,23 @@
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  *
  *
- *     @(#)dev.c       7.5 (Berkeley) %G%
+ *     @(#)dev.c       7.14 (Berkeley) %G%
  */
 
  */
 
-#include "sys/param.h"
-#include "sys/time.h"
-#include "sys/vnode.h"
-#include "ufs/inode.h"
-#include "ufs/fs.h"
+#include <sys/param.h>
+#include <setjmp.h>
 #include "saio.h"
 
 /*
 #include "saio.h"
 
 /*
- * NB: the value "io->i_ino.i_dev", used to offset the devsw[] array
- * in the routines below, is munged by the vaxstand Makefile to work
- * for certain boots.
+ * NB: the value "io->i_dev", used to offset the devsw[] array in the
+ * routines below, is munged by the machine specific stand Makefiles
+ * to work for certain boots.
  */
 
  */
 
+jmp_buf exception;
+
 devread(io)
        register struct iob *io;
 {
 devread(io)
        register struct iob *io;
 {
@@ -37,8 +26,12 @@ devread(io)
 
        io->i_flgs |= F_RDDATA;
        io->i_error = 0;
 
        io->i_flgs |= F_RDDATA;
        io->i_error = 0;
-       cc = (*devsw[io->i_ino.i_dev].dv_strategy)(io, READ);
+       cc = (*devsw[io->i_dev].dv_strategy)(io, F_READ);
        io->i_flgs &= ~F_TYPEMASK;
        io->i_flgs &= ~F_TYPEMASK;
+#ifndef SMALL
+       if (scankbd())
+               _longjmp(exception, 1);
+#endif
        return (cc);
 }
 
        return (cc);
 }
 
@@ -49,8 +42,12 @@ devwrite(io)
 
        io->i_flgs |= F_WRDATA;
        io->i_error = 0;
 
        io->i_flgs |= F_WRDATA;
        io->i_error = 0;
-       cc = (*devsw[io->i_ino.i_dev].dv_strategy)(io, WRITE);
+       cc = (*devsw[io->i_dev].dv_strategy)(io, F_WRITE);
        io->i_flgs &= ~F_TYPEMASK;
        io->i_flgs &= ~F_TYPEMASK;
+#ifndef SMALL
+       if (scankbd())
+               _longjmp(exception, 1);
+#endif
        return (cc);
 }
 
        return (cc);
 }
 
@@ -59,9 +56,12 @@ devopen(io)
 {
        int ret;
 
 {
        int ret;
 
-       if (!(ret = (*devsw[io->i_ino.i_dev].dv_open)(io)))
+       if (!(ret = (*devsw[io->i_dev].dv_open)(io)))
                return (0);
                return (0);
-       printf("%s(%d,%d,%d,%d): ", devsw[io->i_ino.i_dev].dv_name,
+#ifdef SMALL
+       printf("open error\n");
+#else
+       printf("%s(%d,%d,%d,%d): ", devsw[io->i_dev].dv_name,
                io->i_adapt, io->i_ctlr, io->i_unit, io->i_part);
        switch(ret) {
        case EIO:
                io->i_adapt, io->i_ctlr, io->i_unit, io->i_part);
        switch(ret) {
        case EIO:
@@ -91,13 +91,14 @@ devopen(io)
                printf("unknown open error\n");
                break;
        }
                printf("unknown open error\n");
                break;
        }
+#endif
        return (ret);
 }
 
 devclose(io)
        register struct iob *io;
 {
        return (ret);
 }
 
 devclose(io)
        register struct iob *io;
 {
-       (*devsw[io->i_ino.i_dev].dv_close)(io);
+       (*devsw[io->i_dev].dv_close)(io);
 }
 
 devioctl(io, cmd, arg)
 }
 
 devioctl(io, cmd, arg)
@@ -105,22 +106,23 @@ devioctl(io, cmd, arg)
        int cmd;
        caddr_t arg;
 {
        int cmd;
        caddr_t arg;
 {
-       return ((*devsw[io->i_ino.i_dev].dv_ioctl)(io, cmd, arg));
+       return ((*devsw[io->i_dev].dv_ioctl)(io, cmd, arg));
 }
 
 }
 
-/*ARGSUSED*/
+/* ARGSUSED */
 nullsys(io)
        struct iob *io;
 {}
 
 nullsys(io)
        struct iob *io;
 {}
 
-/*ARGSUSED*/
+/* ARGSUSED */
 nodev(io)
        struct iob *io;
 {
        errno = EBADF;
 nodev(io)
        struct iob *io;
 {
        errno = EBADF;
+       return(-1);
 }
 
 }
 
-/*ARGSUSED*/
+/* ARGSUSED */
 noioctl(io, cmd, arg)
        struct iob *io;
        int cmd;
 noioctl(io, cmd, arg)
        struct iob *io;
        int cmd;