- /*
- * XXX SER - Here we would store the name in cache as non-existant if not trying to create it, but,
- * the name cache IS case-sensitive, thus maybe showing a negative hit, when the name
- * is only different by case. So hfs does not support negative caching. Something to look at.
- * (See radar 2293594 for a failed example)
- if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE)
- cache_enter(parent_vp, *vpp, cnp);
- */
-
- retval = ENOENT;
- }
- else {
- /*
- * We have found an entry
- *
- * Here we have to decide what type of vnode to create.
- * There are 3 type of objects that are given:
- * 1. '.': return the same dp
- * 2. '..' return the parent of dp, always a VDIR
- * 3. catinfo rec: return depending on type:
- * A. VDIR, nodeType is kCatalogFolderNode
- * B. VLINK nodeType is kCatalogFileNode, the mode is IFLNK (esp. if it is a link to a directory e.g. bar/link/foo)
- * C. VREG, nodeType is kCatalogFileNode, forkType at this point is unknown
- * To determine the forkType, we can use this algorithm (\0 in the strings mean the NULL character):
- * a. forkType is kDataType iff ISLASTCN is set (as in the case of the default fork e.g. data/foo).
- * b. forkType is kDataType iff ISLASTCN is not set and the namePtr is followed by "/?AppleHFSFork/data\0"
- * c. forkType is kRsrcType iff ISLASTCN is not set and the namePtr is followed by "/?AppleHFSFork/rsrc\0"
- * If the latter two are correct, then we 'consume' the remaining of the name buffer
- * and set the cnp as appropriate.
- * Anything else returns an retval
- */
+ bzero(&cndesc, sizeof(cndesc));
+ cndesc.cd_nameptr = (const u_int8_t *)cnp->cn_nameptr;
+ cndesc.cd_namelen = cnp->cn_namelen;
+ cndesc.cd_parentcnid = dcp->c_fileid;
+ cndesc.cd_hint = dcp->c_childhint;
+
+ lockflags = hfs_systemfile_lock(hfsmp, SFL_CATALOG, HFS_SHARED_LOCK);
+
+ retval = cat_lookup(hfsmp, &cndesc, 0, force_casesensitive_lookup, &desc, &attr, &fork, NULL);
+
+ hfs_systemfile_unlock(hfsmp, lockflags);