BSD 4_3_Tahoe release
[unix-history] / usr / src / sys / stand / saio.h
index 33578a6..188ed07 100644 (file)
@@ -1,25 +1,40 @@
 /*
 /*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1982, 1988 The Regents of the University of California.
+ * All rights reserved.
  *
  *
- *     @(#)saio.h      7.1 (Berkeley) 6/5/86
+ * 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.
+ *
+ *     @(#)saio.h      7.6 (Berkeley) 5/23/89
  */
 
  */
 
-/*
- * Header file for standalone package
- */
+#include "saioctl.h"
+#include "saerrno.h"
+
+#define        UNIX    "hd(6,0,0) /vmunix"
+#define        NULL    0
 
 /*
 
 /*
- * Io block: includes an
- * inode, cells for the use of seek, etc,
+ * Io block: includes an inode, cells for the use of seek, etc.,
  * and a buffer.
  */
  * and a buffer.
  */
-struct iob {
+struct iob {
        int     i_flgs;         /* see F_ below */
        int     i_flgs;         /* see F_ below */
-       struct  inode i_ino;    /* inode, if file */
+       int     i_adapt;        /* adapter or bus */
+       int     i_ctlr;         /* controller */
        int     i_unit;         /* pseudo device unit */
        int     i_unit;         /* pseudo device unit */
+       int     i_part;         /* disk partition */
        daddr_t i_boff;         /* block offset on device */
        daddr_t i_boff;         /* block offset on device */
+       struct  inode i_ino;    /* inode, if file */
        daddr_t i_cyloff;       /* cylinder offset on device */
        off_t   i_offset;       /* seek offset in file */
        daddr_t i_bn;           /* 1st block # of next read */
        daddr_t i_cyloff;       /* cylinder offset on device */
        off_t   i_offset;       /* seek offset in file */
        daddr_t i_bn;           /* 1st block # of next read */
@@ -34,24 +49,41 @@ struct      iob {
                char dummy[SBSIZE];
        } i_un;
 };
                char dummy[SBSIZE];
        } i_un;
 };
-#define i_fs i_un.ui_fs
-#define NULL 0
 
 
-#define F_READ         0x1     /* file opened for reading */
-#define F_WRITE                0x2     /* file opened for writing */
-#define F_ALLOC                0x4     /* buffer allocated */
-#define F_FILE         0x8     /* file instead of device */
-#define F_NBSF         0x10    /* no bad sector forwarding */
-#define F_SSI          0x40    /* set skip sector inhibit */
+#define        i_fs    i_un.ui_fs
+#define        i_bus   i_adapt
+
+/* codes for sector header word 1 */
+#define        HDR1_FMT22      0x1000  /* standard 16 bit format */
+#define        HDR1_OKSCT      0xc000  /* sector ok */
+#define        HDR1_SSF        0x2000  /* skip sector flag */
+
+#define        F_READ          0x0001  /* file opened for reading */
+#define        F_WRITE         0x0002  /* file opened for writing */
+#define        F_ALLOC         0x0004  /* buffer allocated */
+#define        F_FILE          0x0008  /* file instead of device */
+#define        F_NBSF          0x0010  /* no bad sector forwarding */
+#define        F_ECCLM         0x0020  /* limit # of bits in ecc correction */
+#define        F_SSI           0x0040  /* set skip sector inhibit */
+#define        F_SEVRE         0x0080  /* Severe burnin (no retries, no ECC) */
+
 /* io types */
 #define        F_RDDATA        0x0100  /* read data */
 #define        F_WRDATA        0x0200  /* write data */
 /* io types */
 #define        F_RDDATA        0x0100  /* read data */
 #define        F_WRDATA        0x0200  /* write data */
-#define F_HDR          0x0400  /* include header on next i/o */
-#define F_CHECK                0x0800  /* perform check of data read/write */
-#define F_HCHECK       0x1000  /* perform check of header and data */
+#define        F_HDR           0x0400  /* include header on next i/o */
+#define        F_CHECK         0x0800  /* perform check of data read/write */
+#define        F_HCHECK        0x1000  /* perform check of header and data */
 
 #define        F_TYPEMASK      0xff00
 
 
 #define        F_TYPEMASK      0xff00
 
+#define        READ    F_READ
+#define        WRITE   F_WRITE
+
+/*
+ * Lseek call.
+ */
+#define        L_SET           0       /* absolute offset */
+
 /*
  * Device switch.
  */
 /*
  * Device switch.
  */
@@ -63,11 +95,13 @@ struct devsw {
        int     (*dv_ioctl)();
 };
 
        int     (*dv_ioctl)();
 };
 
-struct devsw devsw[];
+extern struct devsw devsw[];   /* device array */
+extern int ndevs;              /* number of elements in devsw[] */
 
 
+#ifdef COMPAT_42
 /*
 /*
- * Drive description table.
- * Returned from SAIODEVDATA call.
+ * Old drive description table.
+ * still used by some drivers for now.
  */
 struct st {
        short   nsect;          /* # sectors/track */
  */
 struct st {
        short   nsect;          /* # sectors/track */
@@ -76,48 +110,7 @@ struct st {
        short   ncyl;           /* # cylinders */
        short   *off;           /* partition offset table (cylinders) */
 };
        short   ncyl;           /* # cylinders */
        short   *off;           /* partition offset table (cylinders) */
 };
-
-/*
- * Request codes. Must be the same a F_XXX above
- */
-#define        READ    1
-#define        WRITE   2
-
-#define        NBUFS   4
-
-char   b[NBUFS][MAXBSIZE];
-daddr_t        blknos[NBUFS];
+#endif
 
 #define        NFILES  4
 
 #define        NFILES  4
-struct iob iob[NFILES];
-
-extern int errno;      /* just like unix */
-
-/* error codes */
-#define        EBADF   1       /* bad file descriptor */
-#define        EOFFSET 2       /* relative seek not supported */
-#define        EDEV    3       /* improper device specification on open */
-#define        ENXIO   4       /* unknown device specified */
-#define        EUNIT   5       /* improper unit specification */
-#define        ESRCH   6       /* directory search for file failed */
-#define        EIO     7       /* generic error */
-#define        ECMD    10      /* undefined driver command */
-#define        EBSE    11      /* bad sector error */
-#define        EWCK    12      /* write check error */
-#define        EECC    13      /* uncorrectable ecc error */
-#define        EHER    14      /* hard error */
-
-/* ioctl's -- for disks just now */
-#define        SAIOHDR         (('d'<<8)|1)    /* next i/o includes header */
-#define        SAIOCHECK       (('d'<<8)|2)    /* next i/o checks data */
-#define        SAIOHCHECK      (('d'<<8)|3)    /* next i/o checks header & data */
-#define        SAIONOBAD       (('d'<<8)|4)    /* inhibit bad sector forwarding */
-#define        SAIODOBAD       (('d'<<8)|5)    /* enable bad sector forwarding */
-#define        SAIOECCLIM      (('d'<<8)|6)    /* set limit to ecc correction, bits */
-#define        SAIORETRIES     (('d'<<8)|7)    /* set retry count for unit */
-#define        SAIODEVDATA     (('d'<<8)|8)    /* get device data */
-#define        SAIOSSI         (('d'<<8)|9)    /* set skip sector inhibit */
-#define        SAIONOSSI       (('d'<<8)|10)   /* inhibit skip sector handling */
-#define        SAIOSSDEV       (('d'<<8)|11)   /* is device skip sector type? */
-#define        SAIODEBUG       (('d'<<8)|12)   /* enable/disable debugging */
-#define        SAIOGBADINFO    (('d'<<8)|13)   /* get bad-sector table */
+extern struct  iob iob[NFILES];