root/dev/ramdisk.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


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

/* [<][>][^][v][top][bottom][index][help] */