2005-03-30 23:23:08 +04:00
|
|
|
/* $NetBSD: vndvar.h,v 1.14 2005/03/30 19:23:08 bouyer Exp $ */
|
1997-06-24 01:03:55 +04:00
|
|
|
|
2005-02-27 03:26:58 +03:00
|
|
|
/*-
|
1998-07-31 06:24:26 +04:00
|
|
|
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
1997-06-24 01:03:55 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Jason R. Thorpe.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
2005-02-27 03:26:58 +03:00
|
|
|
* must display the following acknowledgement:
|
1997-06-24 01:03:55 +04:00
|
|
|
* This product includes software developed by the NetBSD
|
2005-02-27 03:26:58 +03:00
|
|
|
* Foundation, Inc. and its contributors.
|
1997-06-24 01:03:55 +04:00
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
2005-02-27 03:26:58 +03:00
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
1997-06-24 01:03:55 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
1997-10-09 11:37:50 +04:00
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
1997-06-24 01:03:55 +04:00
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1990, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* the Systems Programming Group of the University of Utah Computer
|
|
|
|
* Science Department.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
2003-08-07 20:26:28 +04:00
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* from: Utah $Hdr: fdioctl.h 1.1 90/07/09$
|
|
|
|
*
|
|
|
|
* @(#)vnioctl.h 8.1 (Berkeley) 6/10/93
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1988 University of Utah.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* the Systems Programming Group of the University of Utah Computer
|
|
|
|
* Science Department.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
1997-06-24 01:03:55 +04:00
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* from: Utah $Hdr: fdioctl.h 1.1 90/07/09$
|
|
|
|
*
|
|
|
|
* @(#)vnioctl.h 8.1 (Berkeley) 6/10/93
|
|
|
|
*/
|
|
|
|
|
1998-07-31 06:24:26 +04:00
|
|
|
#include <sys/pool.h>
|
|
|
|
|
1997-06-24 01:03:55 +04:00
|
|
|
/*
|
|
|
|
* Vnode disk pseudo-geometry information.
|
|
|
|
*/
|
|
|
|
struct vndgeom {
|
|
|
|
u_int32_t vng_secsize; /* # bytes per sector */
|
|
|
|
u_int32_t vng_nsectors; /* # data sectors per track */
|
|
|
|
u_int32_t vng_ntracks; /* # tracks per cylinder */
|
|
|
|
u_int32_t vng_ncylinders; /* # cylinders per unit */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ioctl definitions for file (vnode) disk pseudo-device.
|
|
|
|
*/
|
|
|
|
struct vnd_ioctl {
|
|
|
|
char *vnd_file; /* pathname of file to mount */
|
|
|
|
int vnd_flags; /* flags; see below */
|
|
|
|
struct vndgeom vnd_geom; /* geometry to emulate */
|
|
|
|
int vnd_size; /* (returned) size of disk */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* vnd_flags */
|
|
|
|
#define VNDIOF_HASGEOM 0x01 /* use specified geometry */
|
2003-03-27 18:34:36 +03:00
|
|
|
#define VNDIOF_READONLY 0x02 /* as read-only device */
|
2003-04-11 20:11:49 +04:00
|
|
|
#define VNDIOF_FORCE 0x04 /* force close */
|
1997-06-24 01:03:55 +04:00
|
|
|
|
2000-03-20 16:17:47 +03:00
|
|
|
#ifdef _KERNEL
|
|
|
|
|
1997-06-24 01:03:55 +04:00
|
|
|
struct vnode;
|
|
|
|
struct ucred;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A vnode disk's state information.
|
|
|
|
*/
|
|
|
|
struct vnd_softc {
|
|
|
|
int sc_unit; /* logical unit number */
|
|
|
|
int sc_flags; /* flags */
|
|
|
|
size_t sc_size; /* size of vnd */
|
|
|
|
struct vnode *sc_vp; /* vnode */
|
|
|
|
struct ucred *sc_cred; /* credentials */
|
|
|
|
int sc_maxactive; /* max # of active requests */
|
2002-07-20 15:28:07 +04:00
|
|
|
struct bufq_state sc_tab; /* transfer queue */
|
2000-01-22 02:39:55 +03:00
|
|
|
int sc_active; /* number of active transfers */
|
1997-06-24 01:03:55 +04:00
|
|
|
char sc_xname[8]; /* XXX external name */
|
|
|
|
struct disk sc_dkdev; /* generic disk device info */
|
|
|
|
struct vndgeom sc_geom; /* virtual geometry */
|
1998-07-31 06:24:26 +04:00
|
|
|
struct pool sc_vxpool; /* vndxfer pool */
|
|
|
|
struct pool sc_vbpool; /* vndbuf pool */
|
2005-03-30 23:23:08 +04:00
|
|
|
struct proc *sc_kthread; /* kernel thread */
|
1997-06-24 01:03:55 +04:00
|
|
|
};
|
2000-03-20 16:17:47 +03:00
|
|
|
#endif
|
1997-06-24 01:03:55 +04:00
|
|
|
|
|
|
|
/* sc_flags */
|
2003-05-17 20:11:52 +04:00
|
|
|
#define VNF_INITED 0x001 /* unit has been initialized */
|
|
|
|
#define VNF_WLABEL 0x002 /* label area is writable */
|
|
|
|
#define VNF_LABELLING 0x004 /* unit is currently being labelled */
|
|
|
|
#define VNF_WANTED 0x008 /* someone is waiting to obtain a lock */
|
|
|
|
#define VNF_LOCKED 0x010 /* unit is locked */
|
2005-03-30 23:23:08 +04:00
|
|
|
#define VNF_READONLY 0x020 /* unit is read-only */
|
|
|
|
#define VNF_KLABEL 0x040 /* keep label on close */
|
|
|
|
#define VNF_VLABEL 0x080 /* label is valid */
|
|
|
|
#define VNF_KTHREAD 0x100 /* thread is running */
|
|
|
|
#define VNF_VUNCONF 0x200 /* device is unconfiguring */
|
1997-06-24 01:03:55 +04:00
|
|
|
|
2002-06-21 23:09:29 +04:00
|
|
|
/*
|
|
|
|
* A simple structure for describing which vnd units are in use.
|
|
|
|
*/
|
|
|
|
struct vnd_user {
|
|
|
|
int vnu_unit; /* which vnd unit */
|
|
|
|
dev_t vnu_dev; /* file is on this device... */
|
|
|
|
ino_t vnu_ino; /* ...at this inode */
|
|
|
|
};
|
|
|
|
|
1997-06-24 01:03:55 +04:00
|
|
|
/*
|
|
|
|
* Before you can use a unit, it must be configured with VNDIOCSET.
|
|
|
|
* The configuration persists across opens and closes of the device;
|
|
|
|
* an VNDIOCCLR must be used to reset a configuration. An attempt to
|
|
|
|
* VNDIOCSET an already active unit will return EBUSY.
|
|
|
|
*/
|
|
|
|
#define VNDIOCSET _IOWR('F', 0, struct vnd_ioctl) /* enable disk */
|
|
|
|
#define VNDIOCCLR _IOW('F', 1, struct vnd_ioctl) /* disable disk */
|
2002-06-21 23:09:29 +04:00
|
|
|
#define VNDIOCGET _IOWR('F', 2, struct vnd_user) /* get list */
|