]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/attr.h
96881d20c7f5c4637edd0f3a1671f1e5069ae095
[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
118 typedef struct vol_attributes_attr {
119 attribute_set_t validattr;
120 attribute_set_t nativeattr;
121 } vol_attributes_attr_t;
122
123 #define DIR_MNTSTATUS_MNTPOINT 0x00000001
124
125 #define ATTR_CMN_NAME 0x00000001
126 #define ATTR_CMN_DEVID 0x00000002
127 #define ATTR_CMN_FSID 0x00000004
128 #define ATTR_CMN_OBJTYPE 0x00000008
129 #define ATTR_CMN_OBJTAG 0x00000010
130 #define ATTR_CMN_OBJID 0x00000020
131 #define ATTR_CMN_OBJPERMANENTID 0x00000040
132 #define ATTR_CMN_PAROBJID 0x00000080
133 #define ATTR_CMN_SCRIPT 0x00000100
134 #define ATTR_CMN_CRTIME 0x00000200
135 #define ATTR_CMN_MODTIME 0x00000400
136 #define ATTR_CMN_CHGTIME 0x00000800
137 #define ATTR_CMN_ACCTIME 0x00001000
138 #define ATTR_CMN_BKUPTIME 0x00002000
139 #define ATTR_CMN_FNDRINFO 0x00004000
140 #define ATTR_CMN_OWNERID 0x00008000
141 #define ATTR_CMN_GRPID 0x00010000
142 #define ATTR_CMN_ACCESSMASK 0x00020000
143 #define ATTR_CMN_FLAGS 0x00040000
144 #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
145 #define ATTR_CMN_NAMEDATTRLIST 0x00100000
146 #define ATTR_CMN_USERACCESS 0x00200000
147
148 #define ATTR_CMN_VALIDMASK 0x003FFFFF
149 #define ATTR_CMN_SETMASK 0x0007FF00
150 #define ATTR_CMN_VOLSETMASK 0x00006700
151
152 #define ATTR_VOL_FSTYPE 0x00000001
153 #define ATTR_VOL_SIGNATURE 0x00000002
154 #define ATTR_VOL_SIZE 0x00000004
155 #define ATTR_VOL_SPACEFREE 0x00000008
156 #define ATTR_VOL_SPACEAVAIL 0x00000010
157 #define ATTR_VOL_MINALLOCATION 0x00000020
158 #define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
159 #define ATTR_VOL_IOBLOCKSIZE 0x00000080
160 #define ATTR_VOL_OBJCOUNT 0x00000100
161 #define ATTR_VOL_FILECOUNT 0x00000200
162 #define ATTR_VOL_DIRCOUNT 0x00000400
163 #define ATTR_VOL_MAXOBJCOUNT 0x00000800
164 #define ATTR_VOL_MOUNTPOINT 0x00001000
165 #define ATTR_VOL_NAME 0x00002000
166 #define ATTR_VOL_MOUNTFLAGS 0x00004000
167 #define ATTR_VOL_MOUNTEDDEVICE 0x00008000
168 #define ATTR_VOL_ENCODINGSUSED 0x00010000
169 #define ATTR_VOL_CAPABILITIES 0x00020000
170 #define ATTR_VOL_ATTRIBUTES 0x40000000
171 #define ATTR_VOL_INFO 0x80000000
172
173 #define ATTR_VOL_VALIDMASK 0xC003FFFF
174 #define ATTR_VOL_SETMASK 0x80002000
175
176
177 /* File/directory attributes: */
178 #define ATTR_DIR_LINKCOUNT 0x00000001
179 #define ATTR_DIR_ENTRYCOUNT 0x00000002
180 #define ATTR_DIR_MOUNTSTATUS 0x00000004
181
182 #define ATTR_DIR_VALIDMASK 0x00000007
183 #define ATTR_DIR_SETMASK 0x00000000
184
185 #define ATTR_FILE_LINKCOUNT 0x00000001
186 #define ATTR_FILE_TOTALSIZE 0x00000002
187 #define ATTR_FILE_ALLOCSIZE 0x00000004
188 #define ATTR_FILE_IOBLOCKSIZE 0x00000008
189 #define ATTR_FILE_CLUMPSIZE 0x00000010
190 #define ATTR_FILE_DEVTYPE 0x00000020
191 #define ATTR_FILE_FILETYPE 0x00000040
192 #define ATTR_FILE_FORKCOUNT 0x00000080
193 #define ATTR_FILE_FORKLIST 0x00000100
194 #define ATTR_FILE_DATALENGTH 0x00000200
195 #define ATTR_FILE_DATAALLOCSIZE 0x00000400
196 #define ATTR_FILE_DATAEXTENTS 0x00000800
197 #define ATTR_FILE_RSRCLENGTH 0x00001000
198 #define ATTR_FILE_RSRCALLOCSIZE 0x00002000
199 #define ATTR_FILE_RSRCEXTENTS 0x00004000
200
201 #define ATTR_FILE_VALIDMASK 0x00007FFF
202 #define ATTR_FILE_SETMASK 0x00000020
203
204 #define ATTR_FORK_TOTALSIZE 0x00000001
205 #define ATTR_FORK_ALLOCSIZE 0x00000002
206
207 #define ATTR_FORK_VALIDMASK 0x00000003
208 #define ATTR_FORK_SETMASK 0x00000000
209
210 #define SRCHFS_START 0x00000001
211 #define SRCHFS_MATCHPARTIALNAMES 0x00000002
212 #define SRCHFS_MATCHDIRS 0x00000004
213 #define SRCHFS_MATCHFILES 0x00000008
214 #define SRCHFS_NEGATEPARAMS 0x80000000
215 #define SRCHFS_VALIDOPTIONSMASK 0x8000000F
216
217 struct fssearchblock {
218 struct attrlist *returnattrs;
219 void *returnbuffer;
220 size_t returnbuffersize;
221 u_long maxmatches;
222 struct timeval timelimit;
223 void *searchparams1;
224 size_t sizeofsearchparams1;
225 void *searchparams2;
226 size_t sizeofsearchparams2;
227 struct attrlist searchattrs;
228 };
229
230
231 struct searchstate {
232 u_char reserved[556]; // sizeof( SearchState )
233 };
234
235
236
237 #define FST_EOF (-1) /* end-of-file offset */
238
239 __BEGIN_DECLS
240 /* XXX PPD This should be moved to dirent.h to be with getdirentries(2) et al. */
241 //int getdirentriesattr(int fd, const struct attrlist *attrspec, void *attrbuf, size_t bufsize, long //*cookie);
242
243 __END_DECLS
244
245 #endif /* !_SYS_ATTR_H_ */