1: /*
   2:  * Copyright (c) 1992, 1993
   3:  *	The Regents of the University of California.  All rights reserved.
   4:  *
   5:  * This software was developed by the Computer Systems Engineering group
   6:  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
   7:  * contributed to Berkeley.
   8:  *
   9:  * All advertising materials mentioning features or use of this software
  10:  * must display the following acknowledgement:
  11:  *	This product includes software developed by the University of
  12:  *	California, Lawrence Berkeley Laboratory.
  13:  *
  14:  * Redistribution and use in source and binary forms, with or without
  15:  * modification, are permitted provided that the following conditions
  16:  * are met:
  17:  * 1. Redistributions of source code must retain the above copyright
  18:  *    notice, this list of conditions and the following disclaimer.
  19:  * 2. Redistributions in binary form must reproduce the above copyright
  20:  *    notice, this list of conditions and the following disclaimer in the
  21:  *    documentation and/or other materials provided with the distribution.
  22:  * 3. All advertising materials mentioning features or use of this software
  23:  *    must display the following acknowledgement:
  24:  *	This product includes software developed by the University of
  25:  *	California, Berkeley and its contributors.
  26:  * 4. Neither the name of the University nor the names of its contributors
  27:  *    may be used to endorse or promote products derived from this software
  28:  *    without specific prior written permission.
  29:  *
  30:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  31:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  33:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  34:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  38:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  39:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  40:  * SUCH DAMAGE.
  41:  *
  42:  *	@(#)disk.h	8.1.2 (2.11BSD GTE) 1995/05/21
  43:  *
  44:  * from: $Header: disk.h,v 1.5 92/11/19 04:33:03 torek Exp $ (LBL)
  45:  */
  46: 
  47: #ifndef _SYS_DISK_H_
  48: #define _SYS_DISK_H_
  49: #include <sys/disklabel.h>
  50: 
  51: /*
  52:  * Disk device structures.
  53:  *
  54:  * Note that this is only a preliminary outline.  The final disk structures
  55:  * may be somewhat different.
  56:  *
  57:  * Note:  the 2.11BSD version is very different.  The 4.4 version served
  58:  *        as the inspiration. I needed something similar but for slightly
  59:  *	  different purposes.
  60:  */
  61: 
  62: /*
  63:  * Disk device structures.  Rather than replicate driver specific variations
  64:  * of the following in each driver it was made common here.
  65:  *
  66:  * Some of the flags are specific to various drivers. For example ALIVE and
  67:  * ONLINE apply to MSCP devices more than to SMD devices while the SEEK flag
  68:  * applies to the SMD (xp) driver but not to the MSCP driver.  The rest
  69:  * of the flags as well as the open partition bitmaps are usable by any disk
  70:  * driver.  One 'dkdevice' structure is needed for each disk drive supported
  71:  * by a driver.
  72:  *
  73:  * The entire disklabel is not resident in the kernel address space.  Only
  74:  * the partition table is directly accessible by the kernel.  The MSCP driver
  75:  * does not care (or know) about the geometry of the disk.  Not holding
  76:  * the entire label in the kernel saved quite a bit of D space.  Other drivers
  77:  * which need geometry information from the label will have to map in the
  78:  * label and copy out the geometry data they require.  This is unlikely to
  79:  * cause much overhead since labels are read and written infrequently - when
  80:  * mounting a drive, assigning a label, running newfs, etc.
  81:  */
  82: 
  83: struct dkdevice {
  84:     int dk_bopenmask;       /* block devices open */
  85:     int dk_copenmask;       /* character devices open */
  86:     int dk_openmask;        /* composite (bopen|copen) */
  87:     int dk_flags;       /* label state   see below */
  88:     memaddr dk_label;       /* sector containing label */
  89:     struct  partition dk_parts[MAXPARTITIONS];  /* inkernel portion */
  90: };
  91: 
  92: #define DKF_OPENING 0x0001      /* drive is being opened */
  93: #define DKF_CLOSING 0x0002      /* drive is being closed */
  94: #define DKF_WANTED  0x0004      /* drive is being waited for */
  95: #define DKF_ALIVE   0x0008      /* drive is alive */
  96: #define DKF_ONLINE  0x0010      /* drive is online */
  97: #define DKF_WLABEL  0x0020      /* label area is being written */
  98: #define DKF_SEEK    0x0040      /* drive is seeking */
  99: #define DKF_SWAIT   0x0080      /* waiting for seek to complete */
 100: 
 101: /* encoding of disk minor numbers, should be elsewhere... but better
 102:  * here than in ufs_disksubr.c
 103:  *
 104:  * Note: the controller number in bits 6 and 7 of the minor device are NOT
 105:  *	 removed.  It is the responsibility of the driver to extract or mask
 106:  *	 these bits.
 107: */
 108: 
 109: #define dkunit(dev)     (minor(dev) >> 3)
 110: #define dkpart(dev)     (minor(dev) & 07)
 111: #define dkminor(unit, part) (((unit) << 3) | (part))
 112: 
 113: #ifdef KERNEL
 114: char    *readdisklabel();
 115: int setdisklabel();
 116: int writedisklabel();
 117: #endif
 118: #endif /* _SYS_DISK_H_ */

Defined struct's

dkdevice defined in line 83; used 50 times

Defined macros

DKF_ONLINE defined in line 96; used 17 times
DKF_OPENING defined in line 92; used 12 times
DKF_SEEK defined in line 98; never used
DKF_SWAIT defined in line 99; never used
DKF_WANTED defined in line 94; used 8 times
DKF_WLABEL defined in line 97; used 6 times
_SYS_DISK_H_ defined in line 48; used 1 times
  • in line 47
dkminor defined in line 111; used 1 times

Usage of this include

Last modified: 1995-06-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 654
Valid CSS Valid XHTML 1.0 Strict