1/*
2 * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1988 University of Utah.
30 * Copyright (c) 1990, 1993
31 *	The Regents of the University of California.  All rights reserved.
32 *
33 * This code is derived from software contributed to Berkeley by
34 * the Systems Programming Group of the University of Utah Computer
35 * Science Department.
36 *
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
39 * are met:
40 * 1. Redistributions of source code must retain the above copyright
41 *    notice, this list of conditions and the following disclaimer.
42 * 2. Redistributions in binary form must reproduce the above copyright
43 *    notice, this list of conditions and the following disclaimer in the
44 *    documentation and/or other materials provided with the distribution.
45 * 3. All advertising materials mentioning features or use of this software
46 *    must display the following acknowledgement:
47 *	This product includes software developed by the University of
48 *	California, Berkeley and its contributors.
49 * 4. Neither the name of the University nor the names of its contributors
50 *    may be used to endorse or promote products derived from this software
51 *    without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64 *
65 * from: Utah $Hdr: fdioctl.h 1.1 90/07/09$
66 *
67 *	@(#)vnioctl.h	8.1 (Berkeley) 6/10/93
68 *
69 * $FreeBSD: src/sys/sys/vnioctl.h,v 1.4 1999/09/17 05:33:58 dillon Exp $
70 */
71
72#ifndef _SYS_VNIOCTL_H_
73#define _SYS_VNIOCTL_H_
74
75#include <sys/appleapiopts.h>
76#include <sys/cdefs.h>
77
78
79/*
80 * Ioctl definitions for file (vnode) disk pseudo-device.
81 */
82
83#define _PATH_VNTAB	"/etc/vntab"	/* default config file */
84
85typedef enum {
86	vncontrol_readwrite_io_e = 0
87} vncontrol_t;
88
89struct vn_ioctl {
90	char *		vn_file;	/* pathname of file to mount */
91	int			vn_size;	/* (returned) size of disk */
92	vncontrol_t	vn_control;
93};
94
95#ifdef KERNEL_PRIVATE
96
97struct vn_ioctl_64 {
98	u_int64_t	vn_file;	/* pathname of file to mount */
99	int			vn_size;	/* (returned) size of disk */
100	vncontrol_t	vn_control;
101};
102
103struct vn_ioctl_32 {
104	u_int32_t	vn_file;	/* pathname of file to mount */
105	int			vn_size;	/* (returned) size of disk */
106	vncontrol_t	vn_control;
107};
108
109#endif /* KERNEL_PRIVATE */
110
111/*
112 * Before you can use a unit, it must be configured with VNIOCSET.
113 * The configuration persists across opens and closes of the device;
114 * an VNIOCCLR must be used to reset a configuration.  An attempt to
115 * VNIOCSET an already active unit will return EBUSY.
116 */
117#define VNIOCATTACH	_IOWR('F', 0, struct vn_ioctl)	/* attach file */
118#define VNIOCDETACH	_IOWR('F', 1, struct vn_ioctl)	/* detach disk */
119#define VNIOCGSET	_IOWR('F', 2, u_int32_t )		/* set global option */
120#define VNIOCGCLEAR	_IOWR('F', 3, u_int32_t )		/* reset --//-- */
121#define VNIOCUSET	_IOWR('F', 4, u_int32_t )		/* set unit option */
122#define VNIOCUCLEAR	_IOWR('F', 5, u_int32_t )		/* reset --//-- */
123#define VNIOCSHADOW	_IOWR('F', 6, struct vn_ioctl)	/* attach shadow */
124#ifdef KERNEL_PRIVATE
125#define VNIOCATTACH64	_IOWR('F', 0, struct vn_ioctl_64)	/* attach file - LP64 */
126#define VNIOCDETACH64	_IOWR('F', 1, struct vn_ioctl_64)	/* detach disk - LP64 */
127#define VNIOCSHADOW64	_IOWR('F', 6, struct vn_ioctl_64)	/* attach shadow - LP64 */
128#ifdef __LP64__
129#define VNIOCATTACH32	_IOWR('F', 0, struct vn_ioctl_32)	/* attach file - U32 version for K64 */
130#define VNIOCDETACH32	_IOWR('F', 1, struct vn_ioctl_32)	/* detach disk - U32 version for K64 */
131#define VNIOCSHADOW32	_IOWR('F', 6, struct vn_ioctl_32)	/* attach shadow - U32 version for K64 */
132#endif
133#endif /* KERNEL_PRIVATE */
134
135#define VN_LABELS	0x1	/* Use disk(/slice) labels */
136#define VN_FOLLOW	0x2	/* Debug flow in vn driver */
137#define VN_DEBUG	0x4	/* Debug data in vn driver */
138#define VN_IO		0x8	/* Debug I/O in vn driver */
139#define VN_DONTCLUSTER	0x10	/* Don't cluster */
140#define VN_RESERVE	0x20	/* Pre-reserve swap */
141
142
143#endif	/* _SYS_VNIOCTL_H_*/
144