2 * Copyright (c) 1997-2013 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
31 * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
32 * support for mandatory and extensible security protections. This notice
33 * is included in support of clause 2.2 (b) of the Apple Public License,
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/kernel.h>
43 #include <mach/machine/vm_types.h>
44 #include <sys/vnode.h>
45 #include <sys/malloc.h>
46 #include <sys/signalvar.h>
48 #include <sys/utfconv.h>
49 #include <sys/kauth.h>
50 #include <sys/vnode_internal.h>
51 #include <sys/mount_internal.h>
54 #include <security/mac_framework.h>
59 #include "hfs_catalog.h"
60 #include "hfs_attrlist.h"
61 #include "hfs_endian.h"
63 #include "hfscommon/headers/FileMgrInternal.h"
64 #include "hfscommon/headers/HFSUnicodeWrappers.h"
65 #include "hfscommon/headers/BTreesPrivate.h"
66 #include "hfscommon/headers/BTreeScanner.h"
67 #include "hfscommon/headers/CatalogPrivate.h"
71 /* Search criterea. */
72 struct directoryInfoSpec
79 off_t dataLogicalLength
;
80 off_t dataPhysicalLength
;
81 off_t resourceLogicalLength
;
82 off_t resourcePhysicalLength
;
87 u_char name
[kHFSPlusMaxFileNameBytes
];
89 char attributes
; // see IM:Files 2-100
91 u_int32_t parentDirID
;
92 struct timespec creationDate
;
93 struct timespec modificationDate
;
94 struct timespec changeDate
;
95 struct timespec accessDate
;
96 struct timespec lastBackupDate
;
97 u_int8_t finderInfo
[32];
101 struct fileInfoSpec f
;
102 struct directoryInfoSpec d
;
104 typedef struct searchinfospec searchinfospec_t
;
106 static void ResolveHardlink(struct hfsmount
*hfsmp
, HFSPlusCatalogFile
*recp
);
109 static int UnpackSearchAttributeBlock(struct hfsmount
*hfsmp
, struct attrlist
*alist
,
110 searchinfospec_t
*searchInfo
, void *attributeBuffer
, int firstblock
);
112 static int CheckCriteria( ExtendedVCB
*vcb
,
114 struct attrlist
*attrList
,
117 searchinfospec_t
*searchInfo1
,
118 searchinfospec_t
*searchInfo2
,
119 struct vfs_context
*ctx
);
121 static int CheckAccess(ExtendedVCB
*vcb
, u_long searchBits
, CatalogKey
*key
, struct vfs_context
*ctx
);
123 static int InsertMatch(struct hfsmount
*hfsmp
, uio_t a_uio
, CatalogRecord
*rec
,
124 CatalogKey
*key
, struct attrlist
*returnAttrList
,
125 void *attributesBuffer
, void *variableBuffer
,
126 uint32_t * nummatches
);
128 static Boolean
CompareRange(u_long val
, u_long low
, u_long high
);
129 static Boolean
CompareWideRange(u_int64_t val
, u_int64_t low
, u_int64_t high
);
131 static Boolean
CompareRange( u_long val
, u_long low
, u_long high
)
133 return( (val
>= low
) && (val
<= high
) );
136 static Boolean
CompareWideRange( u_int64_t val
, u_int64_t low
, u_int64_t high
)
138 return( (val
>= low
) && (val
<= high
) );
140 //#define CompareRange(val, low, high) ((val >= low) && (val <= high))
143 /************************************************************************/
144 /* Entry for searchfs() */
145 /************************************************************************/
147 #define errSearchBufferFull 101 /* Internal search errors */
156 IN kauth_cred_t cred;
163 struct vnop_searchfs_args
*ap
; /*
164 struct vnodeop_desc *a_desc;
166 void *a_searchparams1;
167 void *a_searchparams2;
168 struct attrlist *a_searchattrs;
170 struct timeval *a_timelimit;
171 struct attrlist *a_returnattrs;
172 u_long *a_nummatches;
176 struct searchstate *a_searchstate;
177 vfs_context_t a_context;
180 ExtendedVCB
*vcb
= VTOVCB(ap
->a_vp
);
181 struct hfsmount
*hfsmp
;
183 searchinfospec_t searchInfo1
;
184 searchinfospec_t searchInfo2
;
185 void *attributesBuffer
= NULL
;
186 void *variableBuffer
;
187 u_int32_t fixedBlockSize
;
188 u_int32_t eachReturnBufferSize
;
189 struct proc
*p
= current_proc();
192 CatalogKey
* myCurrentKeyPtr
;
193 CatalogRecord
* myCurrentDataPtr
;
194 CatPosition
* myCatPositionPtr
;
195 BTScanState myBTScanState
;
196 user_addr_t user_start
= 0;
197 user_size_t user_len
= 0;
201 boolean_t timerExpired
= FALSE
;
202 boolean_t needThrottle
= FALSE
;
204 /* XXX Parameter check a_searchattrs? */
206 *(ap
->a_nummatches
) = 0;
208 if (ap
->a_options
& ~SRCHFS_VALIDOPTIONSMASK
) {
213 * Fail requests for attributes that HFS does not support for the
214 * items that match the search criteria. Note that these checks
215 * are for the OUTBOUND attributes to be returned (not search criteria).
217 if ((ap
->a_returnattrs
->commonattr
& ~HFS_ATTR_CMN_VALID
) ||
218 (ap
->a_returnattrs
->volattr
!= 0) ||
219 (ap
->a_returnattrs
->dirattr
& ~HFS_ATTR_DIR_VALID
) ||
220 (ap
->a_returnattrs
->fileattr
& ~HFS_ATTR_FILE_VALID
) ||
221 (ap
->a_returnattrs
->forkattr
!= 0)) {
226 /* SRCHFS_SKIPLINKS requires root access.
227 * This option cannot be used with either
228 * the ATTR_CMN_NAME or ATTR_CMN_PAROBJID
231 if (ap
->a_options
& SRCHFS_SKIPLINKS
) {
234 attrs
= ap
->a_searchattrs
->commonattr
| ap
->a_returnattrs
->commonattr
;
235 if (attrs
& (ATTR_CMN_NAME
| ATTR_CMN_PAROBJID
)) {
239 if ((err
= vfs_context_suser(ap
->a_context
))) {
244 // If both 32-bit and 64-bit parent ids or file ids are given
245 // then return an error.
247 attrgroup_t test_attrs
=ap
->a_searchattrs
->commonattr
;
249 if (((test_attrs
& ATTR_CMN_OBJID
) && (test_attrs
& ATTR_CMN_FILEID
)) ||
250 ((test_attrs
& ATTR_CMN_PARENTID
) && (test_attrs
& ATTR_CMN_PAROBJID
))) {
254 if (uio_resid(ap
->a_uio
) <= 0) {
258 isHFSPlus
= (vcb
->vcbSigWord
== kHFSPlusSigWord
);
259 hfsmp
= VTOHFS(ap
->a_vp
);
261 searchTime
= kMaxMicroSecsInKernel
;
262 if (ap
->a_timelimit
->tv_sec
== 0 &&
263 ap
->a_timelimit
->tv_usec
> 0 &&
264 ap
->a_timelimit
->tv_usec
< kMaxMicroSecsInKernel
) {
265 searchTime
= ap
->a_timelimit
->tv_usec
;
268 /* UnPack the search boundries, searchInfo1, searchInfo2 */
269 err
= UnpackSearchAttributeBlock(hfsmp
, ap
->a_searchattrs
,
270 &searchInfo1
, ap
->a_searchparams1
, 1);
274 err
= UnpackSearchAttributeBlock(hfsmp
, ap
->a_searchattrs
,
275 &searchInfo2
, ap
->a_searchparams2
, 0);
279 //shadow search bits if 64-bit file/parent ids are used
280 if (ap
->a_searchattrs
->commonattr
& ATTR_CMN_FILEID
)
281 ap
->a_searchattrs
->commonattr
|= ATTR_CMN_OBJID
;
282 if (ap
->a_searchattrs
->commonattr
& ATTR_CMN_PARENTID
)
283 ap
->a_searchattrs
->commonattr
|= ATTR_CMN_PAROBJID
;
285 fixedBlockSize
= sizeof(u_int32_t
) + hfs_attrblksize(ap
->a_returnattrs
); /* u_int32_t for length word */
287 eachReturnBufferSize
= fixedBlockSize
;
289 if ( ap
->a_returnattrs
->commonattr
& ATTR_CMN_NAME
) /* XXX should be more robust! */
290 eachReturnBufferSize
+= kHFSPlusMaxFileNameBytes
+ 1;
292 MALLOC( attributesBuffer
, void *, eachReturnBufferSize
, M_TEMP
, M_WAITOK
);
293 if (attributesBuffer
== NULL
) {
295 goto ExitThisRoutine
;
297 bzero(attributesBuffer
, eachReturnBufferSize
);
298 variableBuffer
= (void*)((char*) attributesBuffer
+ fixedBlockSize
);
300 // XXXdbg - have to lock the user's buffer so we don't fault
301 // while holding the shared catalog file lock. see the comment
302 // in hfs_readdir() for more details.
304 if (hfsmp
->jnl
&& uio_isuserspace(ap
->a_uio
)) {
305 user_start
= uio_curriovbase(ap
->a_uio
);
306 user_len
= uio_curriovlen(ap
->a_uio
);
308 if ((err
= vslock(user_start
, user_len
)) != 0) {
310 goto ExitThisRoutine
;
314 lockflags
= hfs_systemfile_lock(hfsmp
, SFL_CATALOG
, HFS_SHARED_LOCK
);
316 catalogFCB
= GetFileControlBlock(vcb
->catalogRefNum
);
317 myCurrentKeyPtr
= NULL
;
318 myCurrentDataPtr
= NULL
;
319 myCatPositionPtr
= (CatPosition
*)ap
->a_searchstate
;
321 if (ap
->a_options
& SRCHFS_START
) {
322 /* Starting a new search. */
323 /* Make sure the on-disk Catalog file is current */
324 (void) hfs_fsync(vcb
->catalogRefNum
, MNT_WAIT
, 0, p
);
326 hfs_systemfile_unlock(hfsmp
, lockflags
);
327 hfs_journal_flush(hfsmp
, FALSE
);
328 lockflags
= hfs_systemfile_lock(hfsmp
, SFL_CATALOG
, HFS_SHARED_LOCK
);
331 ap
->a_options
&= ~SRCHFS_START
;
332 bzero((caddr_t
)myCatPositionPtr
, sizeof(*myCatPositionPtr
));
333 err
= BTScanInitialize(catalogFCB
, 0, 0, 0, kCatSearchBufferSize
, &myBTScanState
);
335 goto ExitThisRoutine
;
338 /* Resuming a search. */
339 err
= BTScanInitialize(catalogFCB
, myCatPositionPtr
->nextNode
,
340 myCatPositionPtr
->nextRecord
,
341 myCatPositionPtr
->recordsFound
,
342 kCatSearchBufferSize
,
344 /* Make sure Catalog hasn't changed. */
346 && myCatPositionPtr
->writeCount
!= myBTScanState
.btcb
->writeCount
) {
347 myCatPositionPtr
->writeCount
= myBTScanState
.btcb
->writeCount
;
348 err
= EBUSY
; /* catChangedErr */
351 hfs_systemfile_unlock(hfsmp
, lockflags
);
354 goto ExitThisRoutine
;
356 if (throttle_get_io_policy(&ut
) == IOPOL_THROTTLE
)
359 * Check all the catalog btree records...
360 * return the attributes for matching items
363 struct timeval myCurrentTime
;
364 struct timeval myElapsedTime
;
366 err
= BTScanNextRecord(&myBTScanState
, timerExpired
,
367 (void **)&myCurrentKeyPtr
, (void **)&myCurrentDataPtr
,
372 /* Resolve any hardlinks */
373 if (isHFSPlus
&& (ap
->a_options
& SRCHFS_SKIPLINKS
) == 0) {
374 ResolveHardlink(vcb
, (HFSPlusCatalogFile
*)myCurrentDataPtr
);
376 if (CheckCriteria( vcb
, ap
->a_options
, ap
->a_searchattrs
, myCurrentDataPtr
,
377 myCurrentKeyPtr
, &searchInfo1
, &searchInfo2
, ap
->a_context
)
378 && CheckAccess(vcb
, ap
->a_options
, myCurrentKeyPtr
, ap
->a_context
)) {
379 err
= InsertMatch(hfsmp
, ap
->a_uio
, myCurrentDataPtr
,
380 myCurrentKeyPtr
, ap
->a_returnattrs
,
381 attributesBuffer
, variableBuffer
, ap
->a_nummatches
);
384 * The last match didn't fit so come back
385 * to this record on the next trip.
387 --myBTScanState
.recordsFound
;
388 --myBTScanState
.recordNum
;
392 if (*(ap
->a_nummatches
) >= ap
->a_maxmatches
)
395 if (timerExpired
== FALSE
) {
397 * Check our elapsed time and bail if we've hit the max.
398 * The idea here is to throttle the amount of time we
399 * spend in the kernel.
401 microuptime(&myCurrentTime
);
402 timersub(&myCurrentTime
, &myBTScanState
.startTime
, &myElapsedTime
);
404 * Note: assumes kMaxMicroSecsInKernel is less than 1,000,000
406 if (myElapsedTime
.tv_sec
> 0
407 || myElapsedTime
.tv_usec
>= searchTime
) {
409 } else if (needThrottle
== TRUE
) {
410 if (throttle_io_will_be_throttled(ut
->uu_lowpri_window
, HFSTOVFS(hfsmp
)))
416 /* Update catalog position */
417 myCatPositionPtr
->writeCount
= myBTScanState
.btcb
->writeCount
;
419 BTScanTerminate(&myBTScanState
, &myCatPositionPtr
->nextNode
,
420 &myCatPositionPtr
->nextRecord
,
421 &myCatPositionPtr
->recordsFound
);
423 if ( err
== E_NONE
) {
424 err
= EAGAIN
; /* signal to the user to call searchfs again */
425 } else if ( err
== errSearchBufferFull
) {
426 if ( *(ap
->a_nummatches
) > 0 )
430 } else if ( err
== btNotFound
) {
431 err
= E_NONE
; /* the entire disk has been searched */
432 } else if ( err
== fsBTTimeOutErr
) {
437 if (attributesBuffer
)
438 FREE(attributesBuffer
, M_TEMP
);
441 vsunlock(user_start
, user_len
, TRUE
);
444 return (MacToVFSError(err
));
449 ResolveHardlink(struct hfsmount
*hfsmp
, HFSPlusCatalogFile
*recp
)
451 u_int32_t type
, creator
;
454 time_t filecreatedate
;
456 if (recp
->recordType
!= kHFSPlusFileRecord
) {
459 type
= SWAP_BE32(recp
->userInfo
.fdType
);
460 creator
= SWAP_BE32(recp
->userInfo
.fdCreator
);
461 filecreatedate
= to_bsd_time(recp
->createDate
);
463 if ((type
== kHardLinkFileType
&& creator
== kHFSPlusCreator
) &&
464 (filecreatedate
== (time_t)hfsmp
->hfs_itime
||
465 filecreatedate
== (time_t)hfsmp
->hfs_metadata_createdate
)) {
467 } else if ((type
== kHFSAliasType
&& creator
== kHFSAliasCreator
) &&
468 (recp
->flags
& kHFSHasLinkChainMask
) &&
469 (filecreatedate
== (time_t)hfsmp
->hfs_itime
||
470 filecreatedate
== (time_t)hfsmp
->hfs_metadata_createdate
)) {
474 if (isfilelink
|| isdirlink
) {
478 /* Export link's cnid (a unique value) instead of inode's cnid */
479 saved_cnid
= recp
->fileID
;
480 lockflags
= hfs_systemfile_lock(hfsmp
, SFL_CATALOG
, HFS_SHARED_LOCK
);
482 (void) cat_resolvelink(hfsmp
, recp
->hl_linkReference
, isdirlink
, recp
);
484 recp
->fileID
= saved_cnid
;
485 hfs_systemfile_unlock(hfsmp
, lockflags
);
491 CompareMasked(const u_int32_t
*thisValue
, const u_int32_t
*compareData
,
492 const u_int32_t
*compareMask
, u_int32_t count
)
497 matched
= true; /* Assume it will all match */
499 for (i
=0; i
<count
; i
++) {
500 if (((*thisValue
++ ^ *compareData
++) & *compareMask
++) != 0) {
511 ComparePartialUnicodeName (register ConstUniCharArrayPtr str
, register ItemCount s_len
,
512 register ConstUniCharArrayPtr find
, register ItemCount f_len
, int caseSensitive
)
514 if (f_len
== 0 || s_len
== 0) {
522 } while (UnicodeBinaryCompare(str
++, f_len
, find
, f_len
) != 0);
528 } while (FastUnicodeCompare(str
++, f_len
, find
, f_len
) != 0);
536 ComparePartialPascalName ( register ConstStr31Param str
, register ConstStr31Param find
)
538 register u_char s_len
= str
[0];
539 register u_char f_len
= find
[0];
540 register u_char
*tsp
;
543 if (f_len
== 0 || s_len
== 0)
546 bcopy(str
, tmpstr
, s_len
+ 1);
549 while (s_len
-- >= f_len
) {
552 if (FastRelString(tsp
++, find
) == 0)
562 * Check to see if caller has access rights to this item
566 CheckAccess(ExtendedVCB
*theVCBPtr
, u_long searchBits
, CatalogKey
*theKeyPtr
, struct vfs_context
*ctx
)
571 HFSCatalogNodeID myNodeID
;
573 struct FndrDirInfo
*finfop
;
574 struct vnode
* vp
= NULL
;
576 myResult
= 0; /* default to "no access" */
578 if (!vfs_context_suser(ctx
)) {
579 myResult
= 1; /* allow access */
580 goto ExitThisRoutine
; /* root always has access */
583 hfsmp
= VCBTOHFS( theVCBPtr
);
584 isHFSPlus
= ( theVCBPtr
->vcbSigWord
== kHFSPlusSigWord
);
586 myNodeID
= theKeyPtr
->hfsPlus
.parentID
;
589 myNodeID
= theKeyPtr
->hfs
.parentID
;
592 while ( myNodeID
>= kRootDirID
) {
595 /* now go get catalog data for this directory */
596 myErr
= hfs_vget(hfsmp
, myNodeID
, &vp
, 0, 0);
598 goto ExitThisRoutine
; /* no access */
602 finfop
= (struct FndrDirInfo
*)&cp
->c_attr
.ca_finderinfo
[0];
604 if ( searchBits
& SRCHFS_SKIPPACKAGES
) {
605 if ( (SWAP_BE16(finfop
->frFlags
) & kHasBundle
)
606 || (cp
->c_desc
.cd_nameptr
!= NULL
607 && is_package_name((const char *)cp
->c_desc
.cd_nameptr
, cp
->c_desc
.cd_namelen
)) ) {
609 goto ExitThisRoutine
;
613 if ( searchBits
& SRCHFS_SKIPINAPPROPRIATE
) {
614 if ( cp
->c_parentcnid
== kRootDirID
&& cp
->c_desc
.cd_nameptr
!= NULL
&&
615 vn_searchfs_inappropriate_name((const char *)cp
->c_desc
.cd_nameptr
, cp
->c_desc
.cd_namelen
) ) {
617 goto ExitThisRoutine
;
621 if ( (searchBits
& SRCHFS_SKIPINVISIBLE
) &&
622 (SWAP_BE16(finfop
->frFlags
) & kIsInvisible
) ) {
624 goto ExitThisRoutine
;
627 myNodeID
= cp
->c_parentcnid
; /* move up the hierarchy */
628 hfs_unlock(VTOC(vp
));
631 if (vp
->v_type
== VDIR
) {
632 myErr
= mac_vnode_check_readdir(ctx
, vp
);
634 myErr
= mac_vnode_check_stat(ctx
, NOCRED
, vp
);
639 goto ExitThisRoutine
;
643 if (vp
->v_type
== VDIR
) {
644 myErr
= vnode_authorize(vp
, NULL
, (KAUTH_VNODE_SEARCH
| KAUTH_VNODE_LIST_DIRECTORY
), ctx
);
646 myErr
= vnode_authorize(vp
, NULL
, (KAUTH_VNODE_SEARCH
), ctx
);
651 goto ExitThisRoutine
; /* no access */
654 myResult
= 1; /* allow access */
658 hfs_unlock(VTOC(vp
));
666 CheckCriteria( ExtendedVCB
*vcb
,
668 struct attrlist
*attrList
,
671 searchinfospec_t
*searchInfo1
,
672 searchinfospec_t
*searchInfo2
,
673 struct vfs_context
*ctx
)
675 Boolean matched
, atleastone
;
677 attrgroup_t searchAttributes
;
678 struct cat_attr c_attr
;
679 struct cat_fork datafork
;
680 struct cat_fork rsrcfork
;
681 struct hfsmount
*hfsmp
= (struct hfsmount
*)vcb
;
682 int force_case_sensitivity
= proc_is_forcing_hfs_case_sensitivity(vfs_context_proc(ctx
));
684 bzero(&c_attr
, sizeof(c_attr
));
685 isHFSPlus
= (vcb
->vcbSigWord
== kHFSPlusSigWord
);
687 switch (rec
->recordType
) {
690 case kHFSFolderRecord
:
691 if ( (searchBits
& SRCHFS_MATCHDIRS
) == 0 ) { /* If we are NOT searching folders */
698 if ( (searchBits
& SRCHFS_MATCHFILES
) == 0 ) { /* If we are NOT searching files */
705 case kHFSPlusFolderRecord
:
706 if ( (searchBits
& SRCHFS_MATCHDIRS
) == 0 ) { /* If we are NOT searching folders */
712 case kHFSPlusFileRecord
:
713 /* Check if hardlink links should be skipped. */
714 if (searchBits
& SRCHFS_SKIPLINKS
) {
715 cnid_t parid
= key
->hfsPlus
.parentID
;
716 HFSPlusCatalogFile
*filep
= (HFSPlusCatalogFile
*)rec
;
718 if ((SWAP_BE32(filep
->userInfo
.fdType
) == kHardLinkFileType
) &&
719 (SWAP_BE32(filep
->userInfo
.fdCreator
) == kHFSPlusCreator
)) {
720 return (false); /* skip over file link records */
721 } else if ((parid
== vcb
->hfs_private_desc
[FILE_HARDLINKS
].cd_cnid
) &&
722 (filep
->bsdInfo
.special
.linkCount
== 0)) {
723 return (false); /* skip over unlinked files */
724 } else if ((SWAP_BE32(filep
->userInfo
.fdType
) == kHFSAliasType
) &&
725 (SWAP_BE32(filep
->userInfo
.fdCreator
) == kHFSAliasCreator
) &&
726 (filep
->flags
& kHFSHasLinkChainMask
)) {
727 return (false); /* skip over dir link records */
729 } else if (key
->hfsPlus
.parentID
== vcb
->hfs_private_desc
[FILE_HARDLINKS
].cd_cnid
) {
730 return (false); /* skip over private files */
731 } else if (key
->hfsPlus
.parentID
== vcb
->hfs_private_desc
[DIR_HARDLINKS
].cd_cnid
) {
732 return (false); /* skip over private files */
735 if ( (searchBits
& SRCHFS_MATCHFILES
) == 0 ) { /* If we are NOT searching files */
741 default: /* Never match a thread record or any other type. */
742 return( false ); /* Not a file or folder record, so can't search it */
745 matched
= true; /* Assume we got a match */
746 atleastone
= false; /* Dont insert unless we match at least one criteria */
748 /* First, attempt to match the name -- either partial or complete */
749 if ( attrList
->commonattr
& ATTR_CMN_NAME
) {
751 int case_sensitive
= 0;
753 if (hfsmp
->hfs_flags
& HFS_CASE_SENSITIVE
) {
755 } else if (force_case_sensitivity
) {
759 /* Check for partial/full HFS Plus name match */
761 if ( searchBits
& SRCHFS_MATCHPARTIALNAMES
) {
762 matched
= ComparePartialUnicodeName(key
->hfsPlus
.nodeName
.unicode
,
763 key
->hfsPlus
.nodeName
.length
,
764 (UniChar
*)searchInfo1
->name
,
765 searchInfo1
->nameLength
, case_sensitive
);
768 /* Full name match. Are we HFSX (case sensitive) or HFS+ ? */
769 if (case_sensitive
) {
770 matched
= (UnicodeBinaryCompare(key
->hfsPlus
.nodeName
.unicode
,
771 key
->hfsPlus
.nodeName
.length
,
772 (UniChar
*)searchInfo1
->name
,
773 searchInfo1
->nameLength
) == 0);
776 matched
= (FastUnicodeCompare(key
->hfsPlus
.nodeName
.unicode
,
777 key
->hfsPlus
.nodeName
.length
,
778 (UniChar
*)searchInfo1
->name
,
779 searchInfo1
->nameLength
) == 0);
785 /* Check for partial/full HFS name match */
787 if ( searchBits
& SRCHFS_MATCHPARTIALNAMES
)
788 matched
= ComparePartialPascalName(key
->hfs
.nodeName
, (u_char
*)searchInfo1
->name
);
789 else /* full HFS name match */
790 matched
= (FastRelString(key
->hfs
.nodeName
, (u_char
*)searchInfo1
->name
) == 0);
794 if ( matched
== false || (searchBits
& ~SRCHFS_MATCHPARTIALNAMES
) == 0 )
795 goto TestDone
; /* no match, or nothing more to compare */
800 /* Convert catalog record into cat_attr format. */
801 cat_convertattr(VCBTOHFS(vcb
), rec
, &c_attr
, &datafork
, &rsrcfork
);
803 if (searchBits
& SRCHFS_SKIPINVISIBLE
) {
806 switch (rec
->recordType
) {
808 case kHFSFolderRecord
:
810 struct FndrDirInfo
*finder_info
;
812 finder_info
= (struct FndrDirInfo
*)&c_attr
.ca_finderinfo
[0];
813 flags
= SWAP_BE16(finder_info
->frFlags
);
819 struct FndrFileInfo
*finder_info
;
821 finder_info
= (struct FndrFileInfo
*)&c_attr
.ca_finderinfo
[0];
822 flags
= SWAP_BE16(finder_info
->fdFlags
);
827 case kHFSPlusFolderRecord
:
829 struct FndrDirInfo
*finder_info
;
831 finder_info
= (struct FndrDirInfo
*)&c_attr
.ca_finderinfo
[0];
832 flags
= SWAP_BE16(finder_info
->frFlags
);
836 case kHFSPlusFileRecord
:
838 struct FndrFileInfo
*finder_info
;
840 finder_info
= (struct FndrFileInfo
*)&c_attr
.ca_finderinfo
[0];
841 flags
= SWAP_BE16(finder_info
->fdFlags
);
847 flags
= kIsInvisible
;
852 if (flags
& kIsInvisible
) {
860 /* Now that we have a record worth searching, see if it matches the search attributes */
862 if (rec
->recordType
== kHFSFileRecord
||
863 rec
->recordType
== kHFSPlusFileRecord
) {
865 if (rec
->recordType
== kHFSPlusFileRecord
) {
868 if ((attrList
->fileattr
& ~ATTR_FILE_VALIDMASK
) != 0) { /* attr we do know about */
872 else if ((attrList
->fileattr
& ATTR_FILE_VALIDMASK
) != 0) {
873 searchAttributes
= attrList
->fileattr
;
876 if ( c_attr
.ca_flags
& UF_COMPRESSED
) {
877 /* for compressed files, set the data length to the uncompressed data size */
878 if (( searchAttributes
& ATTR_FILE_DATALENGTH
) ||
879 ( searchAttributes
& ATTR_FILE_DATAALLOCSIZE
) ) {
880 if ( 0 == hfs_uncompressed_size_of_compressed_file(vcb
, NULL
, c_attr
.ca_fileid
, &datafork
.cf_size
, 1) ) { /* 1 == don't take the cnode lock */
881 datafork
.cf_blocks
= rsrcfork
.cf_blocks
;
884 /* treat compressed files as if their resource fork is empty */
885 if (( searchAttributes
& ATTR_FILE_RSRCLENGTH
) ||
886 ( searchAttributes
& ATTR_FILE_RSRCALLOCSIZE
) ) {
887 rsrcfork
.cf_size
= 0;
888 rsrcfork
.cf_blocks
= 0;
891 #endif /* HFS_COMPRESSION */
893 /* File logical length (data fork) */
894 if ( searchAttributes
& ATTR_FILE_DATALENGTH
) {
895 matched
= CompareWideRange(
897 searchInfo1
->f
.dataLogicalLength
,
898 searchInfo2
->f
.dataLogicalLength
);
899 if (matched
== false) goto TestDone
;
903 /* File physical length (data fork) */
904 if ( searchAttributes
& ATTR_FILE_DATAALLOCSIZE
) {
905 matched
= CompareWideRange(
906 (u_int64_t
)datafork
.cf_blocks
* (u_int64_t
)vcb
->blockSize
,
907 searchInfo1
->f
.dataPhysicalLength
,
908 searchInfo2
->f
.dataPhysicalLength
);
909 if (matched
== false) goto TestDone
;
913 /* File logical length (resource fork) */
914 if ( searchAttributes
& ATTR_FILE_RSRCLENGTH
) {
915 matched
= CompareWideRange(
917 searchInfo1
->f
.resourceLogicalLength
,
918 searchInfo2
->f
.resourceLogicalLength
);
919 if (matched
== false) goto TestDone
;
923 /* File physical length (resource fork) */
924 if ( searchAttributes
& ATTR_FILE_RSRCALLOCSIZE
) {
925 matched
= CompareWideRange(
926 (u_int64_t
)rsrcfork
.cf_blocks
* (u_int64_t
)vcb
->blockSize
,
927 searchInfo1
->f
.resourcePhysicalLength
,
928 searchInfo2
->f
.resourcePhysicalLength
);
929 if (matched
== false) goto TestDone
;
934 atleastone
= true; /* to match SRCHFS_MATCHFILES */
938 * Check the directory attributes
941 else if (rec
->recordType
== kHFSFolderRecord
||
942 rec
->recordType
== kHFSPlusFolderRecord
) {
944 else if (rec
->recordType
== kHFSPlusFolderRecord
) {
946 if ((attrList
->dirattr
& ~ATTR_DIR_VALIDMASK
) != 0) { /* attr we do know about */
950 else if ((attrList
->dirattr
& ATTR_DIR_VALIDMASK
) != 0) {
951 searchAttributes
= attrList
->dirattr
;
953 /* Directory valence */
954 if ( searchAttributes
& ATTR_DIR_ENTRYCOUNT
) {
955 matched
= CompareRange(c_attr
.ca_entries
,
956 searchInfo1
->d
.numFiles
,
957 searchInfo2
->d
.numFiles
);
958 if (matched
== false) goto TestDone
;
963 atleastone
= true; /* to match SRCHFS_MATCHDIRS */
968 * Check the common attributes
970 searchAttributes
= attrList
->commonattr
;
971 if ( (searchAttributes
& ATTR_CMN_VALIDMASK
) != 0 ) {
973 if ( searchAttributes
& ATTR_CMN_OBJID
) {
974 matched
= CompareRange(c_attr
.ca_fileid
,
976 searchInfo2
->nodeID
);
977 if (matched
== false) goto TestDone
;
982 if ( searchAttributes
& ATTR_CMN_PAROBJID
) {
983 HFSCatalogNodeID parentID
;
986 parentID
= key
->hfsPlus
.parentID
;
989 parentID
= key
->hfs
.parentID
;
992 matched
= CompareRange(parentID
, searchInfo1
->parentDirID
,
993 searchInfo2
->parentDirID
);
994 if (matched
== false) goto TestDone
;
998 /* Finder Info & Extended Finder Info where extFinderInfo is last 32 bytes */
999 if ( searchAttributes
& ATTR_CMN_FNDRINFO
) {
1000 u_int32_t
*thisValue
;
1001 thisValue
= (u_int32_t
*) &c_attr
.ca_finderinfo
;
1004 * Note: ioFlFndrInfo and ioDrUsrWds have the same offset in search info, so
1005 * no need to test the object type here.
1007 matched
= CompareMasked(thisValue
,
1008 (u_int32_t
*)&searchInfo1
->finderInfo
,
1009 (u_int32_t
*) &searchInfo2
->finderInfo
, 8);
1010 if (matched
== false) goto TestDone
;
1015 if ( searchAttributes
& ATTR_CMN_CRTIME
) {
1016 matched
= CompareRange(c_attr
.ca_itime
,
1017 searchInfo1
->creationDate
.tv_sec
,
1018 searchInfo2
->creationDate
.tv_sec
);
1019 if (matched
== false) goto TestDone
;
1024 if ( searchAttributes
& ATTR_CMN_MODTIME
) {
1025 matched
= CompareRange(c_attr
.ca_mtime
,
1026 searchInfo1
->modificationDate
.tv_sec
,
1027 searchInfo2
->modificationDate
.tv_sec
);
1028 if (matched
== false) goto TestDone
;
1033 if ( searchAttributes
& ATTR_CMN_CHGTIME
) {
1034 matched
= CompareRange(c_attr
.ca_ctime
,
1035 searchInfo1
->changeDate
.tv_sec
,
1036 searchInfo2
->changeDate
.tv_sec
);
1037 if (matched
== false) goto TestDone
;
1042 if ( searchAttributes
& ATTR_CMN_ACCTIME
) {
1043 matched
= CompareRange(c_attr
.ca_atime
,
1044 searchInfo1
->accessDate
.tv_sec
,
1045 searchInfo2
->accessDate
.tv_sec
);
1046 if (matched
== false) goto TestDone
;
1051 if ( searchAttributes
& ATTR_CMN_BKUPTIME
) {
1052 matched
= CompareRange(c_attr
.ca_btime
,
1053 searchInfo1
->lastBackupDate
.tv_sec
,
1054 searchInfo2
->lastBackupDate
.tv_sec
);
1055 if (matched
== false) goto TestDone
;
1060 if ( searchAttributes
& ATTR_CMN_OWNERID
) {
1061 matched
= CompareRange(c_attr
.ca_uid
,
1062 searchInfo1
->uid
, searchInfo2
->uid
);
1063 if (matched
== false) goto TestDone
;
1068 if ( searchAttributes
& ATTR_CMN_GRPID
) {
1069 matched
= CompareRange(c_attr
.ca_gid
,
1070 searchInfo1
->gid
, searchInfo2
->gid
);
1071 if (matched
== false) goto TestDone
;
1076 if ( searchAttributes
& ATTR_CMN_ACCESSMASK
) {
1077 matched
= CompareRange((u_int32_t
)c_attr
.ca_mode
,
1078 (u_int32_t
)searchInfo1
->mask
,
1079 (u_int32_t
)searchInfo2
->mask
);
1080 if (matched
== false) goto TestDone
;
1085 /* If we got here w/o matching any, then set to false */
1091 * Finally, determine whether we need to negate the sense of the match
1092 * (i.e. find all objects that DON'T match).
1094 if ( searchBits
& SRCHFS_NEGATEPARAMS
)
1102 * Adds another record to the packed array for output
1105 InsertMatch(struct hfsmount
*hfsmp
, uio_t a_uio
, CatalogRecord
*rec
,
1106 CatalogKey
*key
, struct attrlist
*returnAttrList
,
1107 void *attributesBuffer
, void *variableBuffer
, uint32_t * nummatches
)
1110 void *rovingAttributesBuffer
;
1111 void *rovingVariableBuffer
;
1112 long packedBufferSize
;
1113 struct attrblock attrblk
;
1114 struct cat_desc c_desc
;
1115 struct cat_attr c_attr
;
1116 struct cat_fork datafork
;
1117 struct cat_fork rsrcfork
;
1119 bzero(&c_desc
, sizeof(c_desc
));
1120 bzero(&c_attr
, sizeof(c_attr
));
1121 rovingAttributesBuffer
= (char*)attributesBuffer
+ sizeof(u_int32_t
); /* Reserve space for length field */
1122 rovingVariableBuffer
= variableBuffer
;
1124 /* Convert catalog record into cat_attr format. */
1125 cat_convertattr(hfsmp
, rec
, &c_attr
, &datafork
, &rsrcfork
);
1127 /* Hide our private meta data directories */
1128 if (c_attr
.ca_fileid
== hfsmp
->hfs_private_desc
[FILE_HARDLINKS
].cd_cnid
||
1129 c_attr
.ca_fileid
== hfsmp
->hfs_private_desc
[DIR_HARDLINKS
].cd_cnid
) {
1134 /* Hide the private journal files */
1136 ((c_attr
.ca_fileid
== hfsmp
->hfs_jnlfileid
) ||
1137 (c_attr
.ca_fileid
== hfsmp
->hfs_jnlinfoblkid
))) {
1142 if (returnAttrList
->commonattr
& ATTR_CMN_NAME
) {
1143 err
= cat_convertkey(hfsmp
, key
, rec
, &c_desc
);
1145 /* This means that we probably had a CNID error */
1149 c_desc
.cd_cnid
= c_attr
.ca_fileid
;
1150 if ((hfsmp
->hfs_flags
& HFS_STANDARD
) == 0)
1151 c_desc
.cd_parentcnid
= key
->hfsPlus
.parentID
;
1154 c_desc
.cd_parentcnid
= key
->hfs
.parentID
;
1159 attrblk
.ab_attrlist
= returnAttrList
;
1160 attrblk
.ab_attrbufpp
= &rovingAttributesBuffer
;
1161 attrblk
.ab_varbufpp
= &rovingVariableBuffer
;
1162 attrblk
.ab_flags
= 0;
1163 attrblk
.ab_blocksize
= 0;
1164 attrblk
.ab_context
= vfs_context_current();
1166 hfs_packattrblk(&attrblk
, hfsmp
, NULL
, &c_desc
, &c_attr
, &datafork
, &rsrcfork
, vfs_context_current());
1168 packedBufferSize
= (char*)rovingVariableBuffer
- (char*)attributesBuffer
;
1170 if ( packedBufferSize
> uio_resid(a_uio
) )
1171 return( errSearchBufferFull
);
1175 *((u_int32_t
*)attributesBuffer
) = packedBufferSize
; /* Store length of fixed + var block */
1177 err
= uiomove( (caddr_t
)attributesBuffer
, packedBufferSize
, a_uio
);
1179 cat_releasedesc(&c_desc
);
1186 UnpackSearchAttributeBlock( struct hfsmount
*hfsmp
, struct attrlist
*alist
,
1187 searchinfospec_t
*searchInfo
, void *attributeBuffer
, int firstblock
)
1190 u_int32_t bufferSize
;
1191 boolean_t is_64_bit
;
1193 DBG_ASSERT(searchInfo
!= NULL
);
1195 is_64_bit
= proc_is64bit(current_proc());
1197 bufferSize
= *((u_int32_t
*)attributeBuffer
);
1198 if (bufferSize
== 0)
1199 return (EINVAL
); /* XXX -DJB is a buffer size of zero ever valid for searchfs? */
1201 attributeBuffer
= (u_int32_t
*)attributeBuffer
+ 1; /* advance past the size */
1204 * UnPack common attributes
1206 a
= alist
->commonattr
;
1208 if ( a
& ATTR_CMN_NAME
) {
1210 /* Only use the attrreference_t for the first searchparams */
1214 s
= (char*) attributeBuffer
+ ((attrreference_t
*) attributeBuffer
)->attr_dataoffset
;
1215 len
= ((attrreference_t
*) attributeBuffer
)->attr_length
;
1217 if (len
> sizeof(searchInfo
->name
))
1221 if ((hfsmp
->hfs_flags
& HFS_STANDARD
) == 0) {
1223 /* Convert name to Unicode to match HFS Plus B-Tree names */
1226 if (utf8_decodestr((u_int8_t
*)s
, len
-1, (UniChar
*)searchInfo
->name
, &ucslen
,
1227 sizeof(searchInfo
->name
), ':', UTF_DECOMPOSED
| UTF_ESCAPE_ILLEGAL
))
1230 searchInfo
->nameLength
= ucslen
/ sizeof(UniChar
);
1232 searchInfo
->nameLength
= 0;
1237 /* Convert name to pascal string to match HFS (Standard) B-Tree names */
1240 if (utf8_to_hfs(HFSTOVCB(hfsmp
), len
-1, (u_char
*)s
, (u_char
*)searchInfo
->name
) != 0)
1243 searchInfo
->nameLength
= searchInfo
->name
[0];
1245 searchInfo
->name
[0] = searchInfo
->nameLength
= 0;
1250 attributeBuffer
= (attrreference_t
*) attributeBuffer
+1;
1252 if ( a
& ATTR_CMN_OBJID
) {
1253 searchInfo
->nodeID
= ((fsobj_id_t
*) attributeBuffer
)->fid_objno
; /* ignore fid_generation */
1254 attributeBuffer
= (fsobj_id_t
*)attributeBuffer
+ 1;
1256 if ( a
& ATTR_CMN_PAROBJID
) {
1257 searchInfo
->parentDirID
= ((fsobj_id_t
*) attributeBuffer
)->fid_objno
; /* ignore fid_generation */
1258 attributeBuffer
= (fsobj_id_t
*)attributeBuffer
+ 1;
1261 if ( a
& ATTR_CMN_CRTIME
) {
1263 struct user64_timespec tmp
;
1264 tmp
= *((struct user64_timespec
*)attributeBuffer
);
1265 searchInfo
->creationDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1266 searchInfo
->creationDate
.tv_nsec
= tmp
.tv_nsec
;
1267 attributeBuffer
= (struct user64_timespec
*)attributeBuffer
+ 1;
1270 struct user32_timespec tmp
;
1271 tmp
= *((struct user32_timespec
*)attributeBuffer
);
1272 searchInfo
->creationDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1273 searchInfo
->creationDate
.tv_nsec
= tmp
.tv_nsec
;
1274 attributeBuffer
= (struct user32_timespec
*)attributeBuffer
+ 1;
1277 if ( a
& ATTR_CMN_MODTIME
) {
1279 struct user64_timespec tmp
;
1280 tmp
= *((struct user64_timespec
*)attributeBuffer
);
1281 searchInfo
->modificationDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1282 searchInfo
->modificationDate
.tv_nsec
= tmp
.tv_nsec
;
1283 attributeBuffer
= (struct user64_timespec
*)attributeBuffer
+ 1;
1286 struct user32_timespec tmp
;
1287 tmp
= *((struct user32_timespec
*)attributeBuffer
);
1288 searchInfo
->modificationDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1289 searchInfo
->modificationDate
.tv_nsec
= tmp
.tv_nsec
;
1290 attributeBuffer
= (struct user32_timespec
*)attributeBuffer
+ 1;
1293 if ( a
& ATTR_CMN_CHGTIME
) {
1295 struct user64_timespec tmp
;
1296 tmp
= *((struct user64_timespec
*)attributeBuffer
);
1297 searchInfo
->changeDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1298 searchInfo
->changeDate
.tv_nsec
= tmp
.tv_nsec
;
1299 attributeBuffer
= (struct user64_timespec
*)attributeBuffer
+ 1;
1302 struct user32_timespec tmp
;
1303 tmp
= *((struct user32_timespec
*)attributeBuffer
);
1304 searchInfo
->changeDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1305 searchInfo
->changeDate
.tv_nsec
= tmp
.tv_nsec
;
1306 attributeBuffer
= (struct user32_timespec
*)attributeBuffer
+ 1;
1309 if ( a
& ATTR_CMN_ACCTIME
) {
1311 struct user64_timespec tmp
;
1312 tmp
= *((struct user64_timespec
*)attributeBuffer
);
1313 searchInfo
->accessDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1314 searchInfo
->accessDate
.tv_nsec
= tmp
.tv_nsec
;
1315 attributeBuffer
= (struct user64_timespec
*)attributeBuffer
+ 1;
1318 struct user32_timespec tmp
;
1319 tmp
= *((struct user32_timespec
*)attributeBuffer
);
1320 searchInfo
->accessDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1321 searchInfo
->accessDate
.tv_nsec
= tmp
.tv_nsec
;
1322 attributeBuffer
= (struct user32_timespec
*)attributeBuffer
+ 1;
1325 if ( a
& ATTR_CMN_BKUPTIME
) {
1327 struct user64_timespec tmp
;
1328 tmp
= *((struct user64_timespec
*)attributeBuffer
);
1329 searchInfo
->lastBackupDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1330 searchInfo
->lastBackupDate
.tv_nsec
= tmp
.tv_nsec
;
1331 attributeBuffer
= (struct user64_timespec
*)attributeBuffer
+ 1;
1334 struct user32_timespec tmp
;
1335 tmp
= *((struct user32_timespec
*)attributeBuffer
);
1336 searchInfo
->lastBackupDate
.tv_sec
= (time_t)tmp
.tv_sec
;
1337 searchInfo
->lastBackupDate
.tv_nsec
= tmp
.tv_nsec
;
1338 attributeBuffer
= (struct user32_timespec
*)attributeBuffer
+ 1;
1341 if ( a
& ATTR_CMN_FNDRINFO
) {
1342 bcopy( attributeBuffer
, searchInfo
->finderInfo
, sizeof(searchInfo
->finderInfo
) );
1343 attributeBuffer
= (u_int8_t
*)attributeBuffer
+ 32;
1345 if ( a
& ATTR_CMN_OWNERID
) {
1346 searchInfo
->uid
= *((uid_t
*)attributeBuffer
);
1347 attributeBuffer
= (uid_t
*)attributeBuffer
+ 1;
1349 if ( a
& ATTR_CMN_GRPID
) {
1350 searchInfo
->gid
= *((gid_t
*)attributeBuffer
);
1351 attributeBuffer
= (gid_t
*)attributeBuffer
+ 1;
1353 if ( a
& ATTR_CMN_ACCESSMASK
) {
1354 searchInfo
->mask
= *((mode_t
*)attributeBuffer
);
1355 attributeBuffer
= (mode_t
*)attributeBuffer
+ 1;
1357 if ( a
& ATTR_CMN_FILEID
) {
1358 searchInfo
->nodeID
= (u_int32_t
)*((u_int64_t
*) attributeBuffer
);
1359 attributeBuffer
= (u_int64_t
*)attributeBuffer
+ 1;
1361 if ( a
& ATTR_CMN_PARENTID
) {
1362 searchInfo
->parentDirID
= (u_int32_t
)*((u_int64_t
*) attributeBuffer
);
1363 attributeBuffer
= (u_int64_t
*)attributeBuffer
+ 1;
1369 if ( a
& ATTR_DIR_ENTRYCOUNT
) {
1370 searchInfo
->d
.numFiles
= *((u_int32_t
*)attributeBuffer
);
1371 attributeBuffer
= (u_int32_t
*)attributeBuffer
+ 1;
1375 a
= alist
->fileattr
;
1377 if ( a
& ATTR_FILE_DATALENGTH
) {
1378 searchInfo
->f
.dataLogicalLength
= *((off_t
*)attributeBuffer
);
1379 attributeBuffer
= (off_t
*)attributeBuffer
+ 1;
1381 if ( a
& ATTR_FILE_DATAALLOCSIZE
) {
1382 searchInfo
->f
.dataPhysicalLength
= *((off_t
*)attributeBuffer
);
1383 attributeBuffer
= (off_t
*)attributeBuffer
+ 1;
1385 if ( a
& ATTR_FILE_RSRCLENGTH
) {
1386 searchInfo
->f
.resourceLogicalLength
= *((off_t
*)attributeBuffer
);
1387 attributeBuffer
= (off_t
*)attributeBuffer
+ 1;
1389 if ( a
& ATTR_FILE_RSRCALLOCSIZE
) {
1390 searchInfo
->f
.resourcePhysicalLength
= *((off_t
*)attributeBuffer
);
1391 attributeBuffer
= (off_t
*)attributeBuffer
+ 1;
1397 #endif /* CONFIG_SEARCHFS */