vndvar.h revision 1.2
1/* $NetBSD: vndvar.h,v 1.2 1997/10/09 07:47:50 jtc Exp $ */ 2 3/*- 4 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jason R. Thorpe. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39/* 40 * Copyright (c) 1988 University of Utah. 41 * Copyright (c) 1990, 1993 42 * The Regents of the University of California. All rights reserved. 43 * 44 * This code is derived from software contributed to Berkeley by 45 * the Systems Programming Group of the University of Utah Computer 46 * Science Department. 47 * 48 * Redistribution and use in source and binary forms, with or without 49 * modification, are permitted provided that the following conditions 50 * are met: 51 * 1. Redistributions of source code must retain the above copyright 52 * notice, this list of conditions and the following disclaimer. 53 * 2. Redistributions in binary form must reproduce the above copyright 54 * notice, this list of conditions and the following disclaimer in the 55 * documentation and/or other materials provided with the distribution. 56 * 3. All advertising materials mentioning features or use of this software 57 * must display the following acknowledgement: 58 * This product includes software developed by the University of 59 * California, Berkeley and its contributors. 60 * 4. Neither the name of the University nor the names of its contributors 61 * may be used to endorse or promote products derived from this software 62 * without specific prior written permission. 63 * 64 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 65 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 66 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 67 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 68 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 69 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 70 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 71 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 72 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 73 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 74 * SUCH DAMAGE. 75 * 76 * from: Utah $Hdr: fdioctl.h 1.1 90/07/09$ 77 * 78 * @(#)vnioctl.h 8.1 (Berkeley) 6/10/93 79 */ 80 81/* 82 * Vnode disk pseudo-geometry information. 83 */ 84struct vndgeom { 85 u_int32_t vng_secsize; /* # bytes per sector */ 86 u_int32_t vng_nsectors; /* # data sectors per track */ 87 u_int32_t vng_ntracks; /* # tracks per cylinder */ 88 u_int32_t vng_ncylinders; /* # cylinders per unit */ 89}; 90 91/* 92 * Ioctl definitions for file (vnode) disk pseudo-device. 93 */ 94struct vnd_ioctl { 95 char *vnd_file; /* pathname of file to mount */ 96 int vnd_flags; /* flags; see below */ 97 struct vndgeom vnd_geom; /* geometry to emulate */ 98 int vnd_size; /* (returned) size of disk */ 99}; 100 101/* vnd_flags */ 102#define VNDIOF_HASGEOM 0x01 /* use specified geometry */ 103 104struct vnode; 105struct ucred; 106 107/* 108 * A vnode disk's state information. 109 */ 110struct vnd_softc { 111 int sc_unit; /* logical unit number */ 112 int sc_flags; /* flags */ 113 size_t sc_size; /* size of vnd */ 114 struct vnode *sc_vp; /* vnode */ 115 struct ucred *sc_cred; /* credentials */ 116 int sc_maxactive; /* max # of active requests */ 117 struct buf sc_tab; /* transfer queue */ 118 char sc_xname[8]; /* XXX external name */ 119 struct disk sc_dkdev; /* generic disk device info */ 120 struct vndgeom sc_geom; /* virtual geometry */ 121}; 122 123/* sc_flags */ 124#define VNF_INITED 0x01 /* unit has been initialized */ 125#define VNF_WLABEL 0x02 /* label area is writable */ 126#define VNF_LABELLING 0x04 /* unit is currently being labelled */ 127#define VNF_WANTED 0x08 /* someone is waiting to obtain a lock */ 128#define VNF_LOCKED 0x10 /* unit is locked */ 129 130/* 131 * Before you can use a unit, it must be configured with VNDIOCSET. 132 * The configuration persists across opens and closes of the device; 133 * an VNDIOCCLR must be used to reset a configuration. An attempt to 134 * VNDIOCSET an already active unit will return EBUSY. 135 */ 136#define VNDIOCSET _IOWR('F', 0, struct vnd_ioctl) /* enable disk */ 137#define VNDIOCCLR _IOW('F', 1, struct vnd_ioctl) /* disable disk */ 138