]> git.saurik.com Git - apple/cf.git/blob - CFURLPriv.h
c17faf3aeb51e15ed1da8805e9de134ab1f326cf
[apple/cf.git] / CFURLPriv.h
1 /*
2 * Copyright (c) 2011 Apple Inc. All rights reserved.
3 *
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /* CFURLPriv.h
25 Copyright (c) 2008-2011, Apple Inc. All rights reserved.
26 */
27
28 #if !defined(__COREFOUNDATION_CFURLPRIV__)
29 #define __COREFOUNDATION_CFURLPRIV__ 1
30
31 #include <CoreFoundation/CFBase.h>
32 #include <CoreFoundation/CFError.h>
33 #include <CoreFoundation/CFArray.h>
34 #include <CoreFoundation/CFDictionary.h>
35 #include <CoreFoundation/CFString.h>
36 #include <CoreFoundation/CFURL.h>
37 #if TARGET_OS_MAC
38 #include <sys/param.h>
39 #include <sys/mount.h>
40 #include <CoreFoundation/CFFileSecurity.h>
41 #include <CoreFoundation/CFURLEnumerator.h>
42 #include <CoreFoundation/CFDate.h>
43 #endif
44
45 CF_EXTERN_C_BEGIN
46
47 #if TARGET_OS_MAC
48
49 #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
50 enum {
51 // Resource I/O related errors, with kCFErrorURLKey containing URL
52 kCFURLNoSuchResourceError = 4, // Attempt to do a file system operation on a non-existent file
53 kCFURLResourceLockingError = 255, // Couldn't get a lock on file
54 kCFURLReadUnknownError = 256, // Read error (reason unknown)
55 kCFURLReadNoPermissionError = 257, // Read error (permission problem)
56 kCFURLReadInvalidResourceNameError = 258, // Read error (invalid file name)
57 kCFURLReadCorruptResourceError = 259, // Read error (file corrupt, bad format, etc)
58 kCFURLReadNoSuchResourceError = 260, // Read error (no such file)
59 kCFURLReadInapplicableStringEncodingError = 261, // Read error (string encoding not applicable) also kCFStringEncodingErrorKey
60 kCFURLReadUnsupportedSchemeError = 262, // Read error (unsupported URL scheme)
61 kCFURLReadTooLargeError = 263, // Read error (file too large)
62 kCFURLReadUnknownStringEncodingError = 264, // Read error (string encoding of file contents could not be determined)
63 kCFURLWriteUnknownError = 512, // Write error (reason unknown)
64 kCFURLWriteNoPermissionError = 513, // Write error (permission problem)
65 kCFURLWriteInvalidResourceNameError = 514, // Write error (invalid file name)
66 kCFURLWriteInapplicableStringEncodingError = 517, // Write error (string encoding not applicable) also kCFStringEncodingErrorKey
67 kCFURLWriteUnsupportedSchemeError = 518, // Write error (unsupported URL scheme)
68 kCFURLWriteOutOfSpaceError = 640, // Write error (out of storage space)
69 kCFURLWriteVolumeReadOnlyError = 642, // Write error (readonly volume)
70 };
71 #endif
72
73
74 enum {
75 kCFURLFileReferencePathStyle = 14,
76 };
77
78
79 /*
80 Error user dictionary keys
81 */
82 CF_EXPORT
83 const CFStringRef kCFURLKeyArrayErrorKey CF_AVAILABLE(10_6, 4_0);
84
85
86 /*
87 Private File System Property Keys
88 */
89 CF_EXPORT const CFStringRef _kCFURLPathKey CF_AVAILABLE(10_6, 4_0);
90 /* File system path (CFString) */
91
92 CF_EXPORT const CFStringRef _kCFURLVolumeIDKey CF_AVAILABLE(10_6, 4_0);
93 /* Volume ID (CFNumber) */
94
95 CF_EXPORT const CFStringRef _kCFURLInodeNumberKey CF_AVAILABLE(10_6, 4_0);
96 /* 64-bit inode number (the inode number from the file system) (CFNumber) */
97
98 CF_EXPORT const CFStringRef _kCFURLFileIDKey CF_AVAILABLE(10_6, 4_0);
99 /* 64-bit file ID (for tracking a file by ID. This may or may not be the inode number) (CFNumber) */
100
101 CF_EXPORT const CFStringRef _kCFURLParentDirectoryIDKey CF_AVAILABLE(10_6, 4_0);
102 /* 64-bit file ID (for tracking a parent directory by ID. This may or may not be the inode number) (CFNumber) */
103
104 /* OBSOLETE */CF_EXPORT const CFStringRef _kCFURLFilePathKey CF_DEPRECATED(10_0, 10_6, 2_0, 4_0);
105 /* _kCFURLFilePathKey was never implemented. Use _kCFURLPathKey instead. */
106
107 CF_EXPORT const CFStringRef _kCFURLDistinctLocalizedNameKey CF_AVAILABLE(10_6, 4_0);
108 /* The localized name, if it is disnct from the real name. Otherwise, NULL (CFString) */
109
110 CF_EXPORT const CFStringRef _kCFURLNameExtensionKey CF_AVAILABLE(10_6, 4_0);
111 /* The name extenison (CFString) */
112
113 CF_EXPORT const CFStringRef _kCFURLFinderInfoKey CF_AVAILABLE(10_6, 4_0);
114 /* A 16-byte Finder Info structure immediately followed by a 16-byte Extended Finder Info structure (CFData) */
115
116 CF_EXPORT const CFStringRef _kCFURLIsCompressedKey CF_AVAILABLE(10_6, 4_0);
117 /* True if resource's data is transparently compressed by the system on its storage device (CFBoolean) */
118
119 CF_EXPORT const CFStringRef _kCFURLIsApplicationKey CF_AVAILABLE(10_6, 4_0);
120 /* True if resource is an application (CFBoolean) */
121
122 CF_EXPORT const CFStringRef _kCFURLCanSetHiddenExtensionKey CF_AVAILABLE(10_6, 4_0);
123 /* True if the filename extension can be hidden or unhidden (CFBoolean) */
124
125 CF_EXPORT const CFStringRef _kCFURLIsReadableKey CF_AVAILABLE(10_6, 4_0);
126 /* OBSOLETE */CF_EXPORT const CFStringRef _kCFURLUserCanReadKey CF_DEPRECATED(10_0, 10_6, 2_0, 4_0);
127 /* True if current user can read the resource (CFBoolean) */
128
129 CF_EXPORT const CFStringRef _kCFURLIsWriteableKey CF_AVAILABLE(10_6, 4_0);
130 /* OBSOLETE */CF_EXPORT const CFStringRef _kCFURLUserCanWriteKey CF_DEPRECATED(10_0, 10_6, 2_0, 4_0);
131 /* True if current user can write to the resource (CFBoolean) */
132
133 CF_EXPORT const CFStringRef _kCFURLIsExecutableKey CF_AVAILABLE(10_6, 4_0);
134 /* OBSOLETE */CF_EXPORT const CFStringRef _kCFURLUserCanExecuteKey CF_DEPRECATED(10_0, 10_6, 2_0, 4_0);
135 /* True if current user can execute a file resource or search a directory resource (CFBoolean) */
136
137 CF_EXPORT const CFStringRef _kCFURLParentDirectoryIsVolumeRootKey CF_AVAILABLE(10_6, 4_0);
138 /* True if the parent directory is the root of a volume (CFBoolean) */
139
140 CF_EXPORT const CFStringRef _kCFURLFileSecurityKey CF_AVAILABLE(10_6, 4_0);
141 /* The file's security settings (FSFileSecurity, CarbonCore/Files.h) */
142
143 CF_EXPORT const CFStringRef _kCFURLFileSizeOfResourceForkKey CF_AVAILABLE(10_6, 4_0);
144 /* Size in bytes of the resource fork (CFNumber) */
145
146 CF_EXPORT const CFStringRef _kCFURLFileAllocatedSizeOfResourceForkKey CF_AVAILABLE(10_6, 4_0);
147 /* Size in bytes of the blocks allocated for the resource fork (CFNumber) */
148
149 CF_EXPORT const CFStringRef _kCFURLEffectiveIconImageDataKey CF_AVAILABLE(10_6, 4_0);
150 /* Icon image data, i.e. raw pixel data (CFData) */
151
152 CF_EXPORT const CFStringRef _kCFURLCustomIconImageDataKey CF_AVAILABLE(10_6, 4_0);
153 /* Icon image data of the item's custom icon, if any (CFData) */
154
155 CF_EXPORT const CFStringRef _kCFURLEffectiveIconFlattenedReferenceDataKey CF_AVAILABLE(10_6, 4_0);
156 /* Icon flattened reference, suitable for cheaply sharing the effective icon reference across processess (CFData) */
157
158 CF_EXPORT const CFStringRef _kCFURLBundleIdentifierKey CF_AVAILABLE(10_6, 4_0);
159 /* If resource is a bundle, the bundle identifier (CFString) */
160
161 CF_EXPORT const CFStringRef _kCFURLVersionKey CF_AVAILABLE(10_6, 4_0);
162 /* If resource is a bundle, the bundle version (CFBundleVersion) as a string (CFString) */
163
164 CF_EXPORT const CFStringRef _kCFURLShortVersionStringKey CF_AVAILABLE(10_6, 4_0);
165 /* If resource is a bundle, the bundle short version (CFBundleShortVersionString) as a string (CFString) */
166
167 CF_EXPORT const CFStringRef _kCFURLOwnerIDKey CF_AVAILABLE(10_6, 4_0);
168 /* 32-bit owner ID (uid_t) (CFNumber) */
169
170 CF_EXPORT const CFStringRef _kCFURLGroupIDKey CF_AVAILABLE(10_6, 4_0);
171 /* 32-bit group ID (gid_t) (CFNumber) */
172
173 CF_EXPORT const CFStringRef _kCFURLStatModeKey CF_AVAILABLE(10_6, 4_0);
174 /* 32-bit group ID (mode_t) (CFNumber) */
175
176 CF_EXPORT const CFStringRef _kCFURLLocalizedNameDictionaryKey CF_AVAILABLE(10_7, NA);
177 /* For items with localized display names, the dictionary of all available localizations. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */
178
179 CF_EXPORT const CFStringRef _kCFURLLocalizedTypeDescriptionDictionaryKey CF_AVAILABLE(10_7, NA);
180 /* The dictionary of all available localizations of the item kind string. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */
181
182 CF_EXPORT const CFStringRef _kCFURLApplicationCategoriesKey CF_AVAILABLE(10_7, NA);
183 /* The array of category UTI strings associated with the url. (CFArray) */
184
185 /* Additional volume properties */
186
187 CF_EXPORT const CFStringRef _kCFURLVolumeRefNumKey CF_AVAILABLE(10_6, 4_0);
188 /* The Carbon File Manager's FSVolumeRefNum for the resource volume (CFNumber) */
189
190 CF_EXPORT const CFStringRef _kCFURLVolumeUUIDStringKey CF_AVAILABLE(10_6, 4_0);
191 /* The volume's persistent unique ID as a string, or NULL if not available (CFString) */
192
193 CF_EXPORT const CFStringRef _kCFURLVolumeCreationDateKey CF_AVAILABLE(10_6, 4_0);
194 /* Value type CFDate */
195
196 CF_EXPORT const CFStringRef _kCFURLVolumeIsLocalKey CF_AVAILABLE(10_6, 4_0);
197 /* Volume is on a locally connected device -- not a network volume (CFBoolean) */
198
199 CF_EXPORT const CFStringRef _kCFURLVolumeIsAutomountKey CF_AVAILABLE(10_6, 4_0);
200 /* Volume was mounted by the automounter (CFBoolean) */
201
202 CF_EXPORT const CFStringRef _kCFURLVolumeDontBrowseKey CF_AVAILABLE(10_6, 4_0);
203 /* Don't browse: generally, not shown to users (CFBoolean) */
204
205 CF_EXPORT const CFStringRef _kCFURLVolumeIsReadOnlyKey CF_AVAILABLE(10_6, 4_0);
206 /* Mounted read-only (CFBoolean) */
207
208 CF_EXPORT const CFStringRef _kCFURLVolumeIsQuarantinedKey CF_AVAILABLE(10_6, 4_0);
209 /* Mounted quarantined (CFBoolean) */
210
211 CF_EXPORT const CFStringRef _kCFURLVolumeIsEjectableKey CF_AVAILABLE(10_6, 4_0);
212 /* Volume is ejectable media (CD, DVD, etc) (CFBoolean) */
213
214 CF_EXPORT const CFStringRef _kCFURLVolumeIsRemovableKey CF_AVAILABLE(10_6, 4_0);
215 /* Volume can be disconnected (USB, FireWire) (CFBoolean) */
216
217 CF_EXPORT const CFStringRef _kCFURLVolumeIsInternalKey CF_AVAILABLE(10_6, 4_0);
218 /* Device is on an internal bus/channel (Note: this has different behavior than the public VolumeIsInternal key) (CFBoolean) */
219
220 CF_EXPORT const CFStringRef _kCFURLVolumeIsExternalKey CF_AVAILABLE(10_6, 4_0);
221 /* Device is on an external bus/channel (CFBoolean) */
222
223 CF_EXPORT const CFStringRef _kCFURLVolumeIsDiskImageKey CF_AVAILABLE(10_6, 4_0);
224 /* Volume is a mounted disk image (CFBoolean) */
225
226 CF_EXPORT const CFStringRef _kCFURLDiskImageBackingURLKey CF_AVAILABLE(10_6, 4_0);
227 /* If volume is a mounted disk image, the URL of the backing disk image (CFURL) */
228
229 CF_EXPORT const CFStringRef _kCFURLVolumeIsFileVaultKey CF_AVAILABLE(10_6, 4_0);
230 /* Volume uses File Vault encryption (CFBoolean) */
231
232 CF_EXPORT const CFStringRef _kCFURLVolumeIsiDiskKey CF_AVAILABLE(10_6, 4_0);
233 /* Volume is an iDisk (CFBoolean) */
234
235 CF_EXPORT const CFStringRef _kCFURLVolumeiDiskUserNameKey CF_AVAILABLE(10_6, 4_0);
236 /* If volume is an iDisk, the base member name of the iDisk owner (CFString) */
237
238 CF_EXPORT const CFStringRef _kCFURLVolumeIsLocaliDiskMirrorKey CF_AVAILABLE(10_6, 4_0);
239 /* Volume is a local mirror of an iDisk (CFBoolean) */
240
241 CF_EXPORT const CFStringRef _kCFURLVolumeIsiPodKey CF_AVAILABLE(10_6, 4_0);
242 /* Volume is on an iPod (CFBoolean) */
243
244 CF_EXPORT const CFStringRef _kCFURLVolumeIsCDKey CF_AVAILABLE(10_6, 4_0);
245 /* Volume is a CD (audio or CD-ROM). (CFBoolean) */
246
247 CF_EXPORT const CFStringRef _kCFURLVolumeIsDVDKey CF_AVAILABLE(10_6, 4_0);
248 /* Volume is a DVD (CFBoolean) */
249
250 CF_EXPORT const CFStringRef _kCFURLVolumeIsDeviceFileSystemKey CF_AVAILABLE(10_7, 5_0);
251 /* Volume is devfs (CFBoolean) */
252
253 CF_EXPORT const CFStringRef _kCFURLVolumeIsHFSStandardKey CF_AVAILABLE(10_6, 4_0);
254 /* Volume is HFS standard (which includes AFP volumes). Directory IDs, but not file IDs, can be looked up. (CFBoolean) */
255
256 /* Keys specific to bookmarks at this time */
257 CF_EXPORT const CFStringRef _kCFURLPropertyKeyFullPathString CF_AVAILABLE(10_6, 4_0);
258 /* the full filesystem path of the item the bookmark was create against */
259
260 CF_EXPORT const CFStringRef _kCFURLURLString CF_AVAILABLE(10_6, 4_0);
261 /* the url string ( possibly relative to a base url ) of the url this bookmark was created against. */
262
263 CF_EXPORT const CFStringRef _kCFURLFileIDData CF_AVAILABLE(10_6, 4_0);
264 /* the url string ( possibly relative to a base url ) of the url this bookmark was created against. */
265
266 CF_EXPORT const CFStringRef _kCFURLResolvedFromBookmarkDataKey CF_AVAILABLE(10_6, 4_0);
267 /* the bookmark data that was resolved to produce the URL, if any (CFData) */
268
269 CF_EXPORT const CFStringRef _kCFURLVolumeMountPointStringKey CF_AVAILABLE(10_6, 4_0);
270 /* the volume mountpoint string (Read-only, value type CFString) */
271
272 CF_EXPORT const CFStringRef _kCFURLCompleteMountURLKey CF_AVAILABLE(10_6, 4_0);
273 /* the URL to mount the volume on which the resource is stored, if any (Read-only, value type CFURL) */
274
275
276
277 /*
278 Some common boolean properties can be accessed as a bitfield
279 for better performance -- see _CFURLGetResourcePropertyFlags() and
280 _CFURLCopyResourcePropertyValuesAndFlags(), below.
281 */
282 enum {
283 kCFURLResourceIsRegularFile = 0x00000001,
284 kCFURLResourceIsDirectory = 0x00000002,
285 kCFURLResourceIsSymbolicLink = 0x00000004,
286 kCFURLResourceIsVolume = 0x00000008,
287 kCFURLResourceIsPackage = 0x00000010,
288 kCFURLResourceIsSystemImmutable = 0x00000020,
289 kCFURLResourceIsUserImmutable = 0x00000040,
290 kCFURLResourceIsHidden = 0x00000080,
291 kCFURLResourceHasHiddenExtension = 0x00000100,
292 kCFURLResourceIsApplication = 0x00000200,
293 kCFURLResourceIsCompressed = 0x00000400,
294 /* OBSOLETE */ kCFURLResourceIsSystemCompressed = 0x00000400, /* -> kCFURLResourceIsCompressed */
295 kCFURLCanSetHiddenExtension = 0x00000800,
296 kCFURLResourceIsReadable = 0x00001000,
297 kCFURLResourceIsWriteable = 0x00002000,
298 kCFURLResourceIsExecutable = 0x00004000, /* execute files or search directories */
299 kCFURLIsAliasFile = 0x00008000,
300 kCFURLIsMountTrigger = 0x00010000,
301 };
302 typedef unsigned long long CFURLResourcePropertyFlags;
303
304
305 /*
306 _CFURLGetResourceFlags - Returns a bit array of resource flags in the "flags"
307 output parameter. Only flags whose corresponding bits are set in the "mask" parameter
308 are valid in the output bit array. Returns true on success, false if an error occurs.
309 Optional output error: the error is set to a valid CFErrorRef if and only if the function
310 returns false. A valid output error must be released by the caller.
311 */
312 CF_EXPORT
313 Boolean _CFURLGetResourcePropertyFlags(CFURLRef url, CFURLResourcePropertyFlags mask, CFURLResourcePropertyFlags *flags, CFErrorRef *error) CF_AVAILABLE(10_6, 4_0);
314
315
316 /*
317 File resource properties which can be obtained with _CFURLCopyFilePropertyValuesAndFlags().
318 */
319 enum {
320 kCFURLName = 0x0000000000000001,
321 kCFURLLinkCount = 0x0000000000000002,
322 kCFURLVolumeIdentifier = 0x0000000000000004,
323 kCFURLObjectIdentifier = 0x0000000000000008,
324 kCFURLCreationDate = 0x0000000000000010,
325 kCFURLContentModificationDate = 0x0000000000000020,
326 kCFURLAttributeModificationDate = 0x0000000000000040,
327 kCFURLFileSize = 0x0000000000000080,
328 kCFURLFileAllocatedSize = 0x0000000000000100,
329 kCFURLFileSizeOfResourceFork = 0x0000000000000200,
330 kCFURLFileAllocatedSizeOfResourceFork = 0x0000000000000400,
331 kCFURLFinderInfo = 0x0000000000000800,
332 kCFURLFileSecurity = 0x0000000000001000,
333 };
334 typedef unsigned long long CFURLFilePropertyBitmap;
335
336 /*
337 The structure where _CFURLCopyFilePropertyValuesAndFlags() returns file resource properties.
338 */
339 struct _CFURLFilePropertyValues {
340 CFStringRef name; /* you are responsible for releasing this if you ask for it and get it */
341 uint32_t linkCount;
342 uint64_t volumeIdentifier;
343 uint64_t objectIdentifier;
344 CFAbsoluteTime creationDate;
345 CFAbsoluteTime contentModificationDate;
346 CFAbsoluteTime attributeModificationDate;
347 uint64_t fileSize;
348 uint64_t fileAllocatedSize;
349 uint64_t fileSizeOfResourceFork;
350 uint64_t fileAllocatedSizeOfResourceFork;
351 uint8_t finderInfo[32];
352 CFFileSecurityRef fileSecurity; /* you are responsible for releasing this if you ask for it and get it */
353 };
354 typedef struct _CFURLFilePropertyValues _CFURLFilePropertyValues;
355
356 /*
357 _CFURLCopyResourcePropertyValuesAndFlags - Returns property values as simple types
358 whenever possible. Returns a bit array of resource flags in the "flags"
359 output parameter. Only flags whose corresponding bits are set in the "mask" parameter
360 are valid in the output bit array. Returns true on success, false if an error occurs.
361 Optional output error: the error is set to a valid CFErrorRef if and only if the function
362 returns false. A valid output error must be released by the caller.
363 */
364 CF_EXPORT
365 Boolean _CFURLCopyResourcePropertyValuesAndFlags( CFURLRef url, CFURLFilePropertyBitmap requestProperties, CFURLFilePropertyBitmap *actualProperties, struct _CFURLFilePropertyValues *properties, CFURLResourcePropertyFlags propertyFlagsMask, CFURLResourcePropertyFlags *propertyFlags, CFErrorRef *error) CF_AVAILABLE(10_7, 4_0);
366
367 /*
368 Volume property flags
369 */
370 enum {
371 kCFURLVolumeIsLocal = 0x1LL, // Local device (vs. network device)
372 kCFURLVolumeIsAutomount = 0x2LL, // Mounted by the automounter
373 kCFURLVolumeDontBrowse = 0x4LL, // Hidden from user browsing
374 kCFURLVolumeIsReadOnly = 0x8LL, // Mounted read-only
375 kCFURLVolumeIsQuarantined = 0x10LL, // Mounted with quarantine bit
376 kCFURLVolumeIsEjectable = 0x20LL,
377 kCFURLVolumeIsRemovable = 0x40LL,
378 kCFURLVolumeIsInternal = 0x80LL,
379 kCFURLVolumeIsExternal = 0x100LL,
380 kCFURLVolumeIsDiskImage = 0x200LL,
381 kCFURLVolumeIsFileVault = 0x400LL,
382 kCFURLVolumeIsLocaliDiskMirror = 0x800LL,
383 kCFURLVolumeIsiPod = 0x1000LL,
384 kCFURLVolumeIsiDisk = 0x2000LL,
385 kCFURLVolumeIsCD = 0x4000LL,
386 kCFURLVolumeIsDVD = 0x8000LL,
387 kCFURLVolumeIsDeviceFileSystem = 0x10000LL,
388 // IMPORTANT: The values of the following flags must stay in sync with the
389 // VolumeCapabilities flags in CarbonCore (FileIDTreeStorage.h)
390 kCFURLVolumeSupportsPersistentIDs = 0x100000000LL,
391 kCFURLVolumeSupportsSearchFS = 0x200000000LL,
392 kCFURLVolumeSupportsExchange = 0x400000000LL,
393 // reserved 0x800000000LL,
394 kCFURLVolumeSupportsSymbolicLinks = 0x1000000000LL,
395 kCFURLVolumeSupportsDenyModes = 0x2000000000LL,
396 kCFURLVolumeSupportsCopyFile = 0x4000000000LL,
397 kCFURLVolumeSupportsReadDirAttr = 0x8000000000LL,
398 kCFURLVolumeSupportsJournaling = 0x10000000000LL,
399 kCFURLVolumeSupportsRename = 0x20000000000LL,
400 kCFURLVolumeSupportsFastStatFS = 0x40000000000LL,
401 kCFURLVolumeSupportsCaseSensitiveNames = 0x80000000000LL,
402 kCFURLVolumeSupportsCasePreservedNames = 0x100000000000LL,
403 kCFURLVolumeSupportsFLock = 0x200000000000LL,
404 kCFURLVolumeHasNoRootDirectoryTimes = 0x400000000000LL,
405 kCFURLVolumeSupportsExtendedSecurity = 0x800000000000LL,
406 kCFURLVolumeSupports2TBFileSize = 0x1000000000000LL,
407 kCFURLVolumeSupportsHardLinks = 0x2000000000000LL,
408 kCFURLVolumeSupportsMandatoryByteRangeLocks = 0x4000000000000LL,
409 kCFURLVolumeSupportsPathFromID = 0x8000000000000LL,
410 // reserved 0x10000000000000LL,
411 kCFURLVolumeIsJournaling = 0x20000000000000LL,
412 kCFURLVolumeSupportsSparseFiles = 0x40000000000000LL,
413 kCFURLVolumeSupportsZeroRuns = 0x80000000000000LL,
414 kCFURLVolumeSupportsVolumeSizes = 0x100000000000000LL,
415 kCFURLVolumeSupportsRemoteEvents = 0x200000000000000LL,
416 kCFURLVolumeSupportsHiddenFiles = 0x400000000000000LL,
417 kCFURLVolumeSupportsDecmpFSCompression = 0x800000000000000LL,
418 kCFURLVolumeHas64BitObjectIDs = 0x1000000000000000LL,
419 kCFURLVolumePropertyFlagsAll = 0xffffffffffffffffLL
420 };
421 typedef unsigned long long CFURLVolumePropertyFlags;
422
423
424 /*
425 _CFURLGetVolumePropertyFlags - Returns a bit array of volume properties.
426 Only flags whose corresponding bits are set in the "mask" parameter are valid
427 in the output bit array. Returns true on success, false if an error occurs.
428 Optional output error: the error is set to a valid CFErrorRef if and only if the function
429 returns false. A valid output error must be released by the caller.
430 */
431 CF_EXPORT
432 Boolean _CFURLGetVolumePropertyFlags(CFURLRef url, CFURLVolumePropertyFlags mask, CFURLVolumePropertyFlags *flags, CFErrorRef *error) CF_AVAILABLE(10_6, 4_0);
433
434 /*
435 _CFURLSetResourcePropertyForKeyAndUpdateFileCache - Works mostly like CFURLSetResourcePropertyForKey
436 except that file system properties are updated in the URL's file cache (if it has a valid cache)
437 and dependant properties are not flushed. This means that values in the cache may not match what
438 is on the file system (see <rdar://problem/8371295> for details).
439
440 Only for use by DesktopServices!
441 */
442 CF_EXPORT
443 Boolean _CFURLSetResourcePropertyForKeyAndUpdateFileCache(CFURLRef url, CFStringRef key, CFTypeRef propertyValue, CFErrorRef *error) CF_AVAILABLE(10_7, NA);
444
445 /*
446 _CFURLCreateDisplayPathComponentsArray()
447
448 Summary:
449 _FileURLCreateDisplayPathComponentsArray creates a CFArray of
450 CFURLs for each component in the path leading up to the target
451 URL. This routine is suitable for clients who wish to show the
452 path leading up to a file system item. NOTE: This routine can be
453 I/O intensive, so use it sparingly, and cache the results if
454 possible.
455
456 Discussion:
457 The CFURLs in the result CFArray are ordered from the target URL
458 to the root of the display path. For example, if the target URL
459 is file://localhost/System/Library/ the CFURLs in the array will
460 be ordered: file://localhost/System/Library/,
461 file://localhost/System/, and then file://localhost/
462
463 Parameters:
464
465 targetURL:
466 The target URL.
467
468 error:
469 A pointer to a CFErrorRef, or NULL. If error is non-NULL and
470 the function result is NULL, this will be filled in with a
471 CFErrorRef representing the error that occurred.
472
473 Result:
474 A CFArray or NULL if an error occurred.
475 */
476 CF_EXPORT
477 CFArrayRef _CFURLCreateDisplayPathComponentsArray(CFURLRef url, CFErrorRef *error) CF_AVAILABLE(10_7, 4_0);
478
479 #if 0
480 /* Not implemented */
481 CF_EXPORT
482 CFURLRef _CFURLCreateFileIDURLFromFSRef(CFAllocatorRef allocator, const struct FSRef *fsRef);
483 #endif
484
485 CF_EXPORT
486 CFURLRef _CFURLCreateAbsoluteURLWithDirectoryURLAndName(CFAllocatorRef allocator, CFURLRef directoryURL, CFStringRef name) CF_AVAILABLE(10_6, 4_0);
487
488 /* Returns true for URLs that locate file system resources. */
489 CF_EXPORT
490 Boolean _CFURLIsFileURL(CFURLRef url) CF_AVAILABLE(10_6, 4_0);
491
492 /* Returns true for file URLs that use the file reference form */
493 CF_EXPORT
494 Boolean _CFURLIsFileReferenceURL(CFURLRef url) CF_AVAILABLE(10_6, 4_0);
495
496 /* For use by Core Services */
497 CF_EXPORT
498 void *__CFURLResourceInfoPtr(CFURLRef url) CF_AVAILABLE(10_6, 4_0);
499
500 CF_EXPORT
501 void __CFURLSetResourceInfoPtr(CFURLRef url, void *ptr) CF_AVAILABLE(10_6, 4_0);
502
503 #if TARGET_OS_MAC
504
505 CF_EXPORT
506 CFURLRef _CFURLCreateFileReferenceURLFromIDs( CFAllocatorRef allocator, fsid_t fsid, UInt64 inodeNumber ) CF_AVAILABLE(10_7, NA);
507
508 /* _CFURLVolumeIdentifierGetVolumeRefNum is used by LaunchServices */
509 CF_EXPORT
510 SInt16 _CFURLVolumeIdentifierGetVolumeRefNum(UInt64 volumeIdentifier) CF_AVAILABLE(10_7, NA);
511
512 CF_EXPORT
513 CFURLRef _CFURLCreateFileReferenceURLFromFSRef(CFAllocatorRef allocator, const struct FSRef *ref) CF_AVAILABLE(10_7, NA);
514
515 /* _CFURLGetFSRef is a very lightweight version of CFURLGetFSRef that assumes the CFURL is a file URL and the properties needed to create a FSRef are available in the file URL's cache. This is for use only by CarbonCore's FileOperations SPI and API. */
516 CF_EXPORT
517 Boolean _CFURLGetFSRef(CFURLRef url, struct FSRef *fsRef) CF_AVAILABLE(10_7, NA);
518
519 /* _CFURLGetObjectInformationNoIO is used by LaunchServices */
520 CF_EXPORT
521 Boolean _CFURLGetObjectInformationNoIO(CFURLRef url, UInt64 * volumeIdentifier, UInt64 * objectIdentifier, UInt32 * statMode) CF_AVAILABLE(10_7, NA);
522
523 #endif
524
525 struct FSCatalogInfo;
526 struct HFSUniStr255;
527
528 /* _CFURLGetCatalogInfo is used by LaunchServices */
529 CF_EXPORT
530 SInt32 _CFURLGetCatalogInfo(CFURLRef url, UInt32 whichInfo, struct FSCatalogInfo *catalogInfo, struct HFSUniStr255 *name) CF_AVAILABLE(10_7, 5_0);
531
532 /* _CFURLReplaceObject SPI */
533
534 /* options for _CFURLReplaceObject */
535 enum {
536 // _CFURLItemReplacementUsingOriginalMetadataOnly = 1, // not used
537 _CFURLItemReplacementUsingNewMetadataOnly = 2,
538 // _CFURLItemReplacementByMergingMetadata = 3, // not used
539 _CFURLItemReplacementWithoutDeletingBackupItem = 1 << 4
540 };
541
542 CF_EXPORT
543 Boolean _CFURLReplaceObject( CFAllocatorRef allocator, CFURLRef originalItemURL, CFURLRef newItemURL, CFStringRef newName, CFStringRef backupItemName, CFOptionFlags options, CFURLRef *resultingURL, CFErrorRef *error ) CF_AVAILABLE(10_7, 5_0);
544
545
546 #if (TARGET_OS_MAC) || CF_BUILDING_CF || NSBUILDINGFOUNDATION
547 CF_EXPORT
548 CFURLEnumeratorResult _CFURLEnumeratorGetURLsBulk(CFURLEnumeratorRef enumerator, CFIndex maximumURLs, CFIndex *actualURLs, CFURLRef *urls, CFErrorRef *error) CF_AVAILABLE(10_6, 4_0);
549 #endif
550
551 #if TARGET_OS_MAC
552
553 enum {
554 kCFBookmarkFileCreationWithoutOverwritingExistingFile = ( 1UL << 8 ), // if destination file already exists don't overwrite it and return an error
555 kCFBookmarkFileCreationWithoutAppendingAliasExtension = ( 1UL << 9 ), // don't add / change whatever extension is on the created alias file
556 kCFBookmarkFileCreationWithoutCreatingResourceFork = ( 1UL << 10 ), // don't create the resource-fork half of the alias file
557
558 kCFURLBookmarkCreationAllowCreationIfResourceDoesNotExistMask = ( 1 << 28 ), // allow creation of a bookmark to a file: scheme with a CFURLRef of item which may not exist. If the filesystem item does not exist, the created bookmark contains essentially no properties beyond the url string.
559
560 kCFURLBookmarkCreationDoNotIncludeSandboxExtensionsMask = ( 1 << 29 ), // If set, sandbox extensions are not included in created bookmarks. Ordinarily, bookmarks ( except those created suitable for putting into a bookmark file ) will have a sandbox extension added for the item
561 };
562
563 enum {
564 kCFBookmarkResolutionPerformRelativeResolutionFirstMask = ( 1 << 10 ), // perform relative resolution before absolute resolution. If this bit is set, for this to be useful a relative URL must also have been passed in and the bookmark when created must have been created relative to another url.
565 };
566
567 enum {
568 kCFURLBookmarkComparisonUnableToCompare = 0x00000000, /* the two bookmarks could not be compared for some reason */
569 kCFURLBookmarkComparisonNoMatch = 0x00001000, /* Bookmarks do not refer to the same item */
570 kCFURLBookmarkComparisonUnlikelyToMatch = 0x00002000, /* it is unlikely that the two items refer to the same filesystem item */
571 kCFURLBookmarkComparisonLikelyToMatch = 0x00004000, /* it is likely that the two items refer to the same filesystem item ( but, they may not ) */
572 kCFURLBookmarkComparisonMatch = 0x00008000, /* the two items refer to the same item, but other information in the bookmarks may not match */
573 kCFURLBookmarkComparisonExactMatch = 0x0000f000 /* the two bookmarks are identical */
574 };
575 typedef CFIndex CFURLBookmarkMatchResult;
576
577 /* Keys specific to bookmarks at this time */
578 CF_EXPORT const CFStringRef _kCFURLPropertyKeyFullPathString; // the full filesystem path of the item the bookmark was create against
579 CF_EXPORT const CFStringRef _kCFURLURLString; // the url string ( possibly relative to a base url ) of the url this bookmark was created against.
580 CF_EXPORT const CFStringRef _kCFURLFileIDData; // the url string ( possibly relative to a base url ) of the url this bookmark was created against.
581
582 CFURLBookmarkMatchResult _CFURLCompareBookmarkData( CFDataRef bookmark1Ref, CFDataRef bookmark2Ref, CFURLRef relativeToURL, CFArrayRef* matchingPropertyKeys ) CF_AVAILABLE(10_7, NA);
583
584 CF_EXPORT
585 CFURLBookmarkMatchResult _CFURLBookmarkDataCompare(CFDataRef bookmark1Ref, CFDataRef bookmark2Ref, CFURLRef relativeToURL, CFArrayRef* matchingPropertyKeys) CF_AVAILABLE(10_7, NA); // Use _CFURLCompareBookmarkData() instead
586
587 CF_EXPORT
588 OSStatus _CFURLBookmarkDataToAliasHandle(CFDataRef bookmarkRef, void* aliasHandleP) CF_AVAILABLE(10_7, NA);
589
590 #endif
591
592 /*
593 The following are properties that can be asked of bookmark data objects in addition to the resource properties
594 from CFURL itself.
595 */
596
597 extern const CFStringRef kCFURLBookmarkOriginalPathKey CF_AVAILABLE(10_7, 5_0);
598 extern const CFStringRef kCFURLBookmarkOriginalRelativePathKey CF_AVAILABLE(10_7, 5_0);
599 extern const CFStringRef kCFURLBookmarkOriginalRelativePathComponentsArrayKey CF_AVAILABLE(10_7, 5_0);
600 extern const CFStringRef kCFURLBookmarkOriginalVolumeNameKey CF_AVAILABLE(10_7, 5_0);
601 extern const CFStringRef kCFURLBookmarkOriginalVolumeCreationDateKey CF_AVAILABLE(10_7, 5_0);
602
603 #endif /* TARGET_OS_MAC */
604
605 CF_EXTERN_C_END
606
607 #endif /* ! __COREFOUNDATION_CFURLPRIV__ */
608