Home | History | Annotate | Line # | Download | only in dev
md.h revision 1.2
      1  1.2  gwr /*	$NetBSD: md.h,v 1.2 1995/10/26 15:46:24 gwr Exp $	*/
      2  1.2  gwr 
      3  1.2  gwr /*
      4  1.2  gwr  * Copyright (c) 1995 Gordon W. Ross
      5  1.2  gwr  * All rights reserved.
      6  1.2  gwr  *
      7  1.2  gwr  * Redistribution and use in source and binary forms, with or without
      8  1.2  gwr  * modification, are permitted provided that the following conditions
      9  1.2  gwr  * are met:
     10  1.2  gwr  * 1. Redistributions of source code must retain the above copyright
     11  1.2  gwr  *    notice, this list of conditions and the following disclaimer.
     12  1.2  gwr  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.2  gwr  *    notice, this list of conditions and the following disclaimer in the
     14  1.2  gwr  *    documentation and/or other materials provided with the distribution.
     15  1.2  gwr  * 3. The name of the author may not be used to endorse or promote products
     16  1.2  gwr  *    derived from this software without specific prior written permission.
     17  1.2  gwr  * 4. All advertising materials mentioning features or use of this software
     18  1.2  gwr  *    must display the following acknowledgement:
     19  1.2  gwr  *      This product includes software developed by Gordon W. Ross
     20  1.2  gwr  *
     21  1.2  gwr  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.2  gwr  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.2  gwr  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.2  gwr  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.2  gwr  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.2  gwr  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.2  gwr  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.2  gwr  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.2  gwr  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.2  gwr  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.2  gwr  */
     32  1.1  gwr 
     33  1.1  gwr /*
     34  1.1  gwr  * RAM-disk ioctl functions:
     35  1.1  gwr  */
     36  1.1  gwr 
     37  1.1  gwr #include <sys/ioccom.h>
     38  1.1  gwr 
     39  1.1  gwr struct rd_conf {
     40  1.1  gwr 	caddr_t rd_addr;
     41  1.1  gwr 	size_t  rd_size;
     42  1.1  gwr 	int     rd_type;
     43  1.1  gwr };
     44  1.1  gwr 
     45  1.1  gwr #define RD_GETCONF	_IOR('r', 0, struct rd_conf)	/* get unit config */
     46  1.1  gwr #define RD_SETCONF	_IOW('r', 1, struct rd_conf)	/* set unit config */
     47  1.1  gwr 
     48  1.1  gwr /*
     49  1.1  gwr  * There are three configurations supported for each unit,
     50  1.1  gwr  * reflected in the value of the rd_type field:
     51  1.1  gwr  */
     52  1.1  gwr #define RD_UNCONFIGURED 0
     53  1.1  gwr /*
     54  1.1  gwr  *     Not yet configured.  Open returns ENXIO.
     55  1.1  gwr  */
     56  1.1  gwr #define RD_KMEM_FIXED	1
     57  1.1  gwr /*
     58  1.1  gwr  *     Disk image resident in kernel (patched in or loaded).
     59  1.1  gwr  *     Requires that the function: rd_set_kmem() is called to
     60  1.1  gwr  *     attach the (initialized) kernel memory to be used by the
     61  1.2  gwr  *     device.  It can be initialized by an "open hook" if this
     62  1.1  gwr  *     driver is compiled with the RD_OPEN_HOOK option.
     63  1.2  gwr  *     No attempt will ever be made to free this memory.
     64  1.1  gwr  */
     65  1.1  gwr #define RD_KMEM_ALLOCATED 2
     66  1.1  gwr /*
     67  1.1  gwr  *     Small, wired-down chunk of kernel memory obtained from
     68  1.1  gwr  *     kmem_alloc().  The allocation is performed by an ioctl
     69  1.1  gwr  *     call on the "control" unit (regular unit + 16)
     70  1.1  gwr  */
     71  1.1  gwr #define RD_UMEM_SERVER 3
     72  1.1  gwr /*
     73  1.1  gwr  *     Indirect access to user-space of a user-level server.
     74  1.1  gwr  *     (Like the MFS hack, but better! 8^)  Device operates
     75  1.1  gwr  *     only while the server has the control device open and
     76  1.1  gwr  *     continues to service I/O requests.  The process that
     77  1.2  gwr  *     does this setconf will become the I/O server.  This
     78  1.2  gwr  *     configuration type can be disabled using:
     79  1.2  gwr  *         option  RAMDISK_SERVER=0
     80  1.1  gwr  */
     81  1.1  gwr 
     82  1.1  gwr #ifdef	_KERNEL
     83  1.1  gwr /*
     84  1.1  gwr  * If the option RAMDISK_HOOKS is on, then these functions are
     85  1.1  gwr  * called by the ramdisk driver to allow machine-dependent to
     86  1.1  gwr  * configure and/or load each ramdisk unit.
     87  1.1  gwr  */
     88  1.1  gwr extern void rd_attach_hook __P((int unit, struct rd_conf *));
     89  1.1  gwr extern void rd_open_hook   __P((int unit, struct rd_conf *));
     90  1.1  gwr #endif
     91