posix style job control - new process groups
[unix-history] / usr / src / sys / stand.att / dev.c
index 9cfdbd9..0988f5a 100644 (file)
@@ -3,13 +3,18 @@
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at 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'' without express or implied warranty.
+ * 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.
  *
  *
- *     @(#)dev.c       7.1 (Berkeley) %G%
+ *     @(#)dev.c       7.4 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
 #include "fs.h"
 #include "saio.h"
 
 #include "fs.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.
+ */
+
 devread(io)
        register struct iob *io;
 {
 devread(io)
        register struct iob *io;
 {
@@ -44,7 +55,41 @@ devwrite(io)
 devopen(io)
        register struct iob *io;
 {
 devopen(io)
        register struct iob *io;
 {
-       return (*devsw[io->i_ino.i_dev].dv_open)(io);
+       int ret;
+
+       if (!(ret = (*devsw[io->i_ino.i_dev].dv_open)(io)))
+               return (0);
+       printf("%s(%d,%d,%d,%d): ", devsw[io->i_ino.i_dev].dv_name,
+               io->i_adapt, io->i_ctlr, io->i_unit, io->i_part);
+       switch(ret) {
+       case EIO:
+               break;          /* already reported */
+       case EADAPT:
+               printf("bad adaptor number\n");
+               break;
+       case ECTLR:
+               printf("bad controller number\n");
+               break;
+       case EUNIT:
+               printf("bad drive number\n");
+               break;
+       case EPART:
+               printf("bad partition\n");
+               break;
+       case ERDLAB:
+               printf("can't read disk label\n");
+               break;
+       case EUNLAB:
+               printf("unlabeled\n");
+               break;
+       case ENXIO:
+               printf("bad device specification\n");
+               break;
+       default:
+               printf("unknown open error\n");
+               break;
+       }
+       return (ret);
 }
 
 devclose(io)
 }
 
 devclose(io)