]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/vnioctl.h
xnu-1699.32.7.tar.gz
[apple/xnu.git] / bsd / sys / vnioctl.h
CommitLineData
91447636 1/*
2d21ac55 2 * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
91447636 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
91447636 5 *
2d21ac55
A
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.
8f6c56a5 14 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
91447636 27 */
1c79356b 28/*
9bccf70c 29 * Copyright (c) 1988 University of Utah.
1c79356b
A
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
9bccf70c
A
34 * the Systems Programming Group of the University of Utah Computer
35 * Science Department.
1c79356b
A
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 *
9bccf70c
A
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 $
1c79356b
A
70 */
71
9bccf70c
A
72#ifndef _SYS_VNIOCTL_H_
73#define _SYS_VNIOCTL_H_
74
75#include <sys/appleapiopts.h>
91447636 76#include <sys/cdefs.h>
9bccf70c 77
9bccf70c 78
9bccf70c
A
79/*
80 * Ioctl definitions for file (vnode) disk pseudo-device.
81 */
1c79356b 82
9bccf70c 83#define _PATH_VNTAB "/etc/vntab" /* default config file */
1c79356b 84
9bccf70c 85typedef enum {
55e303ae 86 vncontrol_readwrite_io_e = 0
9bccf70c 87} vncontrol_t;
1c79356b 88
9bccf70c
A
89struct vn_ioctl {
90 char * vn_file; /* pathname of file to mount */
91447636 91 int vn_size; /* (returned) size of disk */
9bccf70c
A
92 vncontrol_t vn_control;
93};
1c79356b 94
91447636
A
95#ifdef KERNEL_PRIVATE
96
b0d623f7 97struct vn_ioctl_64 {
91447636
A
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
b0d623f7
A
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
91447636
A
109#endif /* KERNEL_PRIVATE */
110
1c79356b 111/*
9bccf70c
A
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.
1c79356b 116 */
9bccf70c
A
117#define VNIOCATTACH _IOWR('F', 0, struct vn_ioctl) /* attach file */
118#define VNIOCDETACH _IOWR('F', 1, struct vn_ioctl) /* detach disk */
91447636
A
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 --//-- */
9bccf70c 123#define VNIOCSHADOW _IOWR('F', 6, struct vn_ioctl) /* attach shadow */
91447636 124#ifdef KERNEL_PRIVATE
b0d623f7
A
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
91447636 133#endif /* KERNEL_PRIVATE */
1c79356b 134
9bccf70c
A
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 */
1c79356b 141
1c79356b 142
9bccf70c 143#endif /* _SYS_VNIOCTL_H_*/