]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/attr.h
96eead6f75e95323913ff05e89207d9186d760ab
[apple/xnu.git] / bsd / sys / attr.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 /*
24 * attr.h - attribute data structures and interfaces
25 *
26 * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved.
27 */
28
29 #ifndef _SYS_ATTR_H_
30 #define _SYS_ATTR_H_
31
32 #ifndef _SYS_TYPES_H_
33 #include <sys/types.h>
34 #endif
35 #ifndef _SYS_UCRED_H
36 #include <sys/ucred.h>
37 #endif
38 #ifndef _SYS_MOUNT_H_
39 #include <sys/mount.h>
40 #endif
41 #ifndef _SYS_TIME_H_
42 #include <sys/time.h>
43 #endif
44
45 #define FSOPT_NOFOLLOW 0x00000001
46 #define FSOPT_NOINMEMUPDATE 0x00000002
47
48 typedef u_int32_t text_encoding_t;
49
50 typedef u_int32_t fsobj_type_t;
51
52 typedef u_int32_t fsobj_tag_t;
53
54 typedef u_int32_t fsfile_type_t;
55
56 typedef u_int32_t fsvolid_t;
57
58 typedef struct fsobj_id {
59 u_int32_t fid_objno;
60 u_int32_t fid_generation;
61 } fsobj_id_t;
62
63 typedef u_int32_t attrgroup_t;
64
65 struct attrlist {
66 u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */
67 u_int16_t reserved; /* (to maintain 4-byte alignment) */
68 attrgroup_t commonattr; /* common attribute group */
69 attrgroup_t volattr; /* Volume attribute group */
70 attrgroup_t dirattr; /* directory attribute group */
71 attrgroup_t fileattr; /* file attribute group */
72 attrgroup_t forkattr; /* fork attribute group */
73 };
74 #define ATTR_BIT_MAP_COUNT 5
75
76 typedef struct attribute_set {
77 attrgroup_t commonattr; /* common attribute group */
78 attrgroup_t volattr; /* Volume attribute group */
79 attrgroup_t dirattr; /* directory attribute group */
80 attrgroup_t fileattr; /* file attribute group */
81 attrgroup_t forkattr; /* fork attribute group */
82 } attribute_set_t;
83
84 typedef struct attrreference {
85 long attr_dataoffset;
86 size_t attr_length;
87 } attrreference_t;
88
89 /* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */
90
91 struct diskextent {
92 u_int32_t startblock; /* first block allocated */
93 u_int32_t blockcount; /* number of blocks allocated */
94 };
95
96 typedef struct diskextent extentrecord[8];
97
98 typedef u_int32_t vol_capabilities_set_t[4];
99
100 #define VOL_CAPABILITIES_FORMAT 0
101 #define VOL_CAPABILITIES_INTERFACES 1
102 #define VOL_CAPABILITIES_RESERVED1 2
103 #define VOL_CAPABILITIES_RESERVED2 3
104
105 typedef struct vol_capabilities_attr {
106 vol_capabilities_set_t capabilities;
107 vol_capabilities_set_t valid;
108 } vol_capabilities_attr_t;
109
110 #define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001
111 #define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002
112 #define VOL_CAP_FMT_HARDLINKS 0x00000004
113
114 #define VOL_CAP_INT_SEARCHFS 0x00000001
115 #define VOL_CAP_INT_ATTRLIST 0x00000002
116 #define VOL_CAP_INT_NFSEXPORT 0x00000004
117 #define VOL_CAP_INT_READDIRATTR 0x00000008
118
119 typedef struct vol_attributes_attr {
120 attribute_set_t validattr;
121 attribute_set_t nativeattr;
122 } vol_attributes_attr_t;
123
124 #define DIR_MNTSTATUS_MNTPOINT 0x00000001
125
126 #define ATTR_CMN_NAME 0x00000001
127 #define ATTR_CMN_DEVID 0x00000002
128 #define ATTR_CMN_FSID 0x00000004
129 #define ATTR_CMN_OBJTYPE 0x00000008
130 #define ATTR_CMN_OBJTAG 0x00000010
131 #define ATTR_CMN_OBJID 0x00000020
132 #define ATTR_CMN_OBJPERMANENTID 0x00000040
133 #define ATTR_CMN_PAROBJID 0x00000080
134 #define ATTR_CMN_SCRIPT 0x00000100
135 #define ATTR_CMN_CRTIME 0x00000200
136 #define ATTR_CMN_MODTIME 0x00000400
137 #define ATTR_CMN_CHGTIME 0x00000800
138 #define ATTR_CMN_ACCTIME 0x00001000
139 #define ATTR_CMN_BKUPTIME 0x00002000
140 #define ATTR_CMN_FNDRINFO 0x00004000
141 #define ATTR_CMN_OWNERID 0x00008000
142 #define ATTR_CMN_GRPID 0x00010000
143 #define ATTR_CMN_ACCESSMASK 0x00020000
144 #define ATTR_CMN_FLAGS 0x00040000
145 #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
146 #define ATTR_CMN_NAMEDATTRLIST 0x00100000
147 #define ATTR_CMN_USERACCESS 0x00200000
148
149 #define ATTR_CMN_VALIDMASK 0x003FFFFF
150 #define ATTR_CMN_SETMASK 0x0007FF00
151 #define ATTR_CMN_VOLSETMASK 0x00006700
152
153 #define ATTR_VOL_FSTYPE 0x00000001
154 #define ATTR_VOL_SIGNATURE 0x00000002
155 #define ATTR_VOL_SIZE 0x00000004
156 #define ATTR_VOL_SPACEFREE 0x00000008
157 #define ATTR_VOL_SPACEAVAIL 0x00000010
158 #define ATTR_VOL_MINALLOCATION 0x00000020
159 #define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
160 #define ATTR_VOL_IOBLOCKSIZE 0x00000080
161 #define ATTR_VOL_OBJCOUNT 0x00000100
162 #define ATTR_VOL_FILECOUNT 0x00000200
163 #define ATTR_VOL_DIRCOUNT 0x00000400
164 #define ATTR_VOL_MAXOBJCOUNT 0x00000800
165 #define ATTR_VOL_MOUNTPOINT 0x00001000
166 #define ATTR_VOL_NAME 0x00002000
167 #define ATTR_VOL_MOUNTFLAGS 0x00004000
168 #define ATTR_VOL_MOUNTEDDEVICE 0x00008000
169 #define ATTR_VOL_ENCODINGSUSED 0x00010000
170 #define ATTR_VOL_CAPABILITIES 0x00020000
171 #define ATTR_VOL_ATTRIBUTES 0x40000000
172 #define ATTR_VOL_INFO 0x80000000
173
174 #define ATTR_VOL_VALIDMASK 0xC003FFFF
175 #define ATTR_VOL_SETMASK 0x80002000
176
177
178 /* File/directory attributes: */
179 #define ATTR_DIR_LINKCOUNT 0x00000001
180 #define ATTR_DIR_ENTRYCOUNT 0x00000002
181 #define ATTR_DIR_MOUNTSTATUS 0x00000004
182
183 #define ATTR_DIR_VALIDMASK 0x00000007
184 #define ATTR_DIR_SETMASK 0x00000000
185
186 #define ATTR_FILE_LINKCOUNT 0x00000001
187 #define ATTR_FILE_TOTALSIZE 0x00000002
188 #define ATTR_FILE_ALLOCSIZE 0x00000004
189 #define ATTR_FILE_IOBLOCKSIZE 0x00000008
190 #define ATTR_FILE_CLUMPSIZE 0x00000010
191 #define ATTR_FILE_DEVTYPE 0x00000020
192 #define ATTR_FILE_FILETYPE 0x00000040
193 #define ATTR_FILE_FORKCOUNT 0x00000080
194 #define ATTR_FILE_FORKLIST 0x00000100
195 #define ATTR_FILE_DATALENGTH 0x00000200
196 #define ATTR_FILE_DATAALLOCSIZE 0x00000400
197 #define ATTR_FILE_DATAEXTENTS 0x00000800
198 #define ATTR_FILE_RSRCLENGTH 0x00001000
199 #define ATTR_FILE_RSRCALLOCSIZE 0x00002000
200 #define ATTR_FILE_RSRCEXTENTS 0x00004000
201
202 #define ATTR_FILE_VALIDMASK 0x00007FFF
203 #define ATTR_FILE_SETMASK 0x00000020
204
205 #define ATTR_FORK_TOTALSIZE 0x00000001
206 #define ATTR_FORK_ALLOCSIZE 0x00000002
207
208 #define ATTR_FORK_VALIDMASK 0x00000003
209 #define ATTR_FORK_SETMASK 0x00000000
210
211 #define SRCHFS_START 0x00000001
212 #define SRCHFS_MATCHPARTIALNAMES 0x00000002
213 #define SRCHFS_MATCHDIRS 0x00000004
214 #define SRCHFS_MATCHFILES 0x00000008
215 #define SRCHFS_NEGATEPARAMS 0x80000000
216 #define SRCHFS_VALIDOPTIONSMASK 0x8000000F
217
218 struct fssearchblock {
219 struct attrlist *returnattrs;
220 void *returnbuffer;
221 size_t returnbuffersize;
222 u_long maxmatches;
223 struct timeval timelimit;
224 void *searchparams1;
225 size_t sizeofsearchparams1;
226 void *searchparams2;
227 size_t sizeofsearchparams2;
228 struct attrlist searchattrs;
229 };
230
231
232 struct searchstate {
233 u_char reserved[556]; // sizeof( SearchState )
234 };
235
236
237
238 #define FST_EOF (-1) /* end-of-file offset */
239
240 __BEGIN_DECLS
241 /* XXX PPD This should be moved to dirent.h to be with getdirentries(2) et al. */
242 //int getdirentriesattr(int fd, const struct attrlist *attrspec, void *attrbuf, size_t bufsize, long //*cookie);
243
244 __END_DECLS
245
246 #endif /* !_SYS_ATTR_H_ */