+ case kHFSFileRecord:
+ if ( (searchBits & SRCHFS_MATCHFILES) == 0 ) { /* If we are NOT searching files */
+ matched = false;
+ goto TestDone;
+ }
+ break;
+#endif
+
+ case kHFSPlusFolderRecord:
+ if ( (searchBits & SRCHFS_MATCHDIRS) == 0 ) { /* If we are NOT searching folders */
+ matched = false;
+ goto TestDone;
+ }
+ break;
+
+ case kHFSPlusFileRecord:
+ /* Check if hardlink links should be skipped. */
+ if (searchBits & SRCHFS_SKIPLINKS) {
+ cnid_t parid = key->hfsPlus.parentID;
+ HFSPlusCatalogFile *filep = (HFSPlusCatalogFile *)rec;
+
+ if ((SWAP_BE32(filep->userInfo.fdType) == kHardLinkFileType) &&
+ (SWAP_BE32(filep->userInfo.fdCreator) == kHFSPlusCreator)) {
+ return (false); /* skip over file link records */
+ } else if ((parid == vcb->hfs_private_desc[FILE_HARDLINKS].cd_cnid) &&
+ (filep->bsdInfo.special.linkCount == 0)) {
+ return (false); /* skip over unlinked files */
+ } else if ((SWAP_BE32(filep->userInfo.fdType) == kHFSAliasType) &&
+ (SWAP_BE32(filep->userInfo.fdCreator) == kHFSAliasCreator) &&
+ (filep->flags & kHFSHasLinkChainMask)) {
+ return (false); /* skip over dir link records */
+ }
+ } else if (key->hfsPlus.parentID == vcb->hfs_private_desc[FILE_HARDLINKS].cd_cnid) {
+ return (false); /* skip over private files */
+ } else if (key->hfsPlus.parentID == vcb->hfs_private_desc[DIR_HARDLINKS].cd_cnid) {
+ return (false); /* skip over private files */
+ }
+
+ if ( (searchBits & SRCHFS_MATCHFILES) == 0 ) { /* If we are NOT searching files */
+ matched = false;
+ goto TestDone;
+ }
+ break;