]> git.saurik.com Git - apple/xnu.git/blame - bsd/hfs/hfs_fsctl.h
xnu-2782.1.97.tar.gz
[apple/xnu.git] / bsd / hfs / hfs_fsctl.h
CommitLineData
91447636 1/*
fe8ab488 2 * Copyright (c) 2004-2014 Apple Computer, Inc. All rights reserved.
5d5c5d0d 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
A
27 */
28
29#ifndef _HFS_FSCTL_H_
30#define _HFS_FSCTL_H_
31
32#include <sys/appleapiopts.h>
33
2d21ac55 34#include <sys/param.h>
91447636
A
35#include <sys/ioccom.h>
36#include <sys/time.h>
fe8ab488 37#include <stdint.h>
91447636
A
38
39#ifdef __APPLE_API_UNSTABLE
40
41struct hfs_backingstoreinfo {
42 int signature; /* == 3419115 */
43 int version; /* version of this struct (1) */
44 int backingfd; /* disk image file (on backing fs) */
45 int bandsize; /* sparse disk image band size */
46};
47
48
2d21ac55
A
49typedef char pathname_t[MAXPATHLEN];
50
b0d623f7
A
51struct hfs_journal_info {
52 off_t jstart;
53 off_t jsize;
54};
55
2d21ac55 56
fe8ab488
A
57struct hfsinfo_metadata {
58 uint32_t total;
59 uint32_t extents;
60 uint32_t catalog;
61 uint32_t allocation;
62 uint32_t attribute;
63 uint32_t journal;
64 uint32_t reserved[4];
65};
66
67
91447636
A
68/* HFS FS CONTROL COMMANDS */
69
0c530ab8
A
70#define HFSIOC_RESIZE_PROGRESS _IOR('h', 1, u_int32_t)
71#define HFS_RESIZE_PROGRESS IOCBASECMD(HFSIOC_RESIZE_PROGRESS)
72
91447636
A
73#define HFSIOC_RESIZE_VOLUME _IOW('h', 2, u_int64_t)
74#define HFS_RESIZE_VOLUME IOCBASECMD(HFSIOC_RESIZE_VOLUME)
75
76#define HFSIOC_CHANGE_NEXT_ALLOCATION _IOWR('h', 3, u_int32_t)
77#define HFS_CHANGE_NEXT_ALLOCATION IOCBASECMD(HFSIOC_CHANGE_NEXT_ALLOCATION)
2d21ac55
A
78/* Magic value for next allocation to use with fcntl to set next allocation
79 * to zero and never update it again on new block allocation.
80 */
81#define HFS_NO_UPDATE_NEXT_ALLOCATION 0xffffFFFF
91447636
A
82
83#define HFSIOC_GETCREATETIME _IOR('h', 4, time_t)
84#define HFS_GETCREATETIME IOCBASECMD(HFSIOC_GETCREATETIME)
85
86#define HFSIOC_SETBACKINGSTOREINFO _IOW('h', 7, struct hfs_backingstoreinfo)
87#define HFS_SETBACKINGSTOREINFO IOCBASECMD(HFSIOC_SETBACKINGSTOREINFO)
88
89#define HFSIOC_CLRBACKINGSTOREINFO _IO('h', 8)
90#define HFS_CLRBACKINGSTOREINFO IOCBASECMD(HFSIOC_CLRBACKINGSTOREINFO)
91
b0d623f7 92#define HFSIOC_BULKACCESS _IOW('h', 9, struct user32_access_t)
2d21ac55
A
93#define HFS_BULKACCESS_FSCTL IOCBASECMD(HFSIOC_BULKACCESS)
94
6d2010ae
A
95/* Unsupported - Previously used to enable/disable ACLs */
96#define HFSIOC_UNSUPPORTED _IOW('h', 10, int32_t)
91447636 97
2d21ac55
A
98#define HFSIOC_PREV_LINK _IOWR('h', 11, u_int32_t)
99#define HFS_PREV_LINK IOCBASECMD(HFSIOC_PREV_LINK)
100
101#define HFSIOC_NEXT_LINK _IOWR('h', 12, u_int32_t)
102#define HFS_NEXT_LINK IOCBASECMD(HFSIOC_NEXT_LINK)
103
104#define HFSIOC_GETPATH _IOWR('h', 13, pathname_t)
105#define HFS_GETPATH IOCBASECMD(HFSIOC_GETPATH)
39236c6e
A
106/* By default, the path returned by HFS_GETPATH is an absolute path,
107 * i.e. it also contains the mount point of the volume on which the
108 * fileID exists. If the following bit is set, the path returned is
109 * relative to the root of the volume.
110 */
111#define HFS_GETPATH_VOLUME_RELATIVE 0x1
2d21ac55
A
112
113/* Enable/disable extent-based extended attributes */
114#define HFSIOC_SET_XATTREXTENTS_STATE _IOW('h', 14, u_int32_t)
115#define HFS_SET_XATTREXTENTS_STATE IOCBASECMD(HFSIOC_SET_XATTREXTENTS_STATE)
116
b0d623f7 117#define HFSIOC_EXT_BULKACCESS _IOW('h', 15, struct user32_ext_access_t)
2d21ac55
A
118#define HFS_EXT_BULKACCESS_FSCTL IOCBASECMD(HFSIOC_EXT_BULKACCESS)
119
120#define HFSIOC_MARK_BOOT_CORRUPT _IO('h', 16)
121#define HFS_MARK_BOOT_CORRUPT IOCBASECMD(HFSIOC_MARK_BOOT_CORRUPT)
122
b0d623f7
A
123#define HFSIOC_GET_JOURNAL_INFO _IOR('h', 17, struct hfs_journal_info)
124#define HFS_FSCTL_GET_JOURNAL_INFO IOCBASECMD(HFSIOC_GET_JOURNAL_INFO)
125
126#define HFSIOC_SET_VERY_LOW_DISK _IOW('h', 20, u_int32_t)
127#define HFS_FSCTL_SET_VERY_LOW_DISK IOCBASECMD(HFSIOC_SET_VERY_LOW_DISK)
128
129#define HFSIOC_SET_LOW_DISK _IOW('h', 21, u_int32_t)
130#define HFS_FSCTL_SET_LOW_DISK IOCBASECMD(HFSIOC_SET_LOW_DISK)
131
132#define HFSIOC_SET_DESIRED_DISK _IOW('h', 22, u_int32_t)
133#define HFS_FSCTL_SET_DESIRED_DISK IOCBASECMD(HFSIOC_SET_DESIRED_DISK)
134
135#define HFSIOC_SET_ALWAYS_ZEROFILL _IOW('h', 23, int32_t)
136#define HFS_SET_ALWAYS_ZEROFILL IOCBASECMD(HFSIOC_SET_ALWAYS_ZEROFILL)
137
138#define HFSIOC_VOLUME_STATUS _IOR('h', 24, u_int32_t)
139#define HFS_VOLUME_STATUS IOCBASECMD(HFSIOC_VOLUME_STATUS)
140
6d2010ae
A
141/* Disable metadata zone for given volume */
142#define HFSIOC_DISABLE_METAZONE _IO('h', 25)
143#define HFS_DISABLE_METAZONE IOCBASECMD(HFSIOC_DISABLE_METAZONE)
91447636 144
316670eb
A
145/* Change the next CNID value */
146#define HFSIOC_CHANGE_NEXTCNID _IOWR('h', 26, u_int32_t)
147#define HFS_CHANGE_NEXTCNID IOCBASECMD(HFSIOC_CHANGE_NEXTCNID)
148
149/* Get the low disk space values */
150#define HFSIOC_GET_VERY_LOW_DISK _IOR('h', 27, u_int32_t)
151#define HFS_FSCTL_GET_VERY_LOW_DISK IOCBASECMD(HFSIOC_GET_VERY_LOW_DISK)
152
153#define HFSIOC_GET_LOW_DISK _IOR('h', 28, u_int32_t)
154#define HFS_FSCTL_GET_LOW_DISK IOCBASECMD(HFSIOC_GET_LOW_DISK)
155
156#define HFSIOC_GET_DESIRED_DISK _IOR('h', 29, u_int32_t)
157#define HFS_FSCTL_GET_DESIRED_DISK IOCBASECMD(HFSIOC_GET_DESIRED_DISK)
158
fe8ab488 159/* 30 was HFSIOC_GET_WRITE_GEN_COUNTER and is now deprecated */
22ba694c 160
fe8ab488 161/* 31 was HFSIOC_GET_DOCUMENT_ID and is now deprecated */
22ba694c
A
162
163/* revisiond only uses this when something transforms in a way the kernel can't track such as "foo.rtf" -> "foo.rtfd" */
164#define HFSIOC_TRANSFER_DOCUMENT_ID _IOW('h', 32, u_int32_t)
165#define HFS_TRANSFER_DOCUMENT_ID IOCBASECMD(HFSIOC_TRANSFER_DOCUMENT_ID)
166
fe8ab488
A
167
168/*
169 * Get information about number of file system allocation blocks used by metadata
170 * files on the volume, including individual btrees and journal file. The caller
171 * can determine the size of file system allocation block using value returned as
172 * f_bsize by statfs(2).
173 */
174#define HFSIOC_FSINFO_METADATA_BLOCKS _IOWR('h', 38, struct hfsinfo_metadata)
175#define HFS_FSINFO_METADATA_BLOCKS IOCBASECMD(HFSIOC_FSINFO_METADATA_BLOCKS)
176
177/* Send TRIMs for all free blocks to the underlying device */
178#define HFSIOC_CS_FREESPACE_TRIM _IOWR('h', 39, u_int32_t)
179#define HFS_CS_FREESPACE_TRIM IOCBASECMD(HFSIOC_CS_FREESPACE_TRIM)
180
6d2010ae 181#endif /* __APPLE_API_UNSTABLE */
91447636
A
182
183#endif /* ! _HFS_FSCTL_H_ */