Lines Matching refs:key

63 	HFSPlusCatalogKey 	key;
108 static int getkey(struct hfsmount *hfsmp, cnid_t cnid, CatalogKey * key);
111 HFSPlusCatalogKey *key, int retry);
113 static void buildthreadkey(HFSCatalogNodeID parentID, int std_hfs, CatalogKey *key);
119 static int builddesc(const HFSPlusCatalogKey *key, cnid_t cnid, u_int32_t hint, u_int32_t encoding,
233 * Convert a raw catalog key and record into an in-core catalog descriptor.
241 CatalogKey *key,
251 promotekey(hfsmp, (HFSCatalogKey *)key, pluskey, &encoding);
254 pluskey = (HFSPlusCatalogKey *)key;
336 // make MacRoman key from utf-8
364 result = buildkey(hfsmp, descp, (HFSPlusCatalogKey *)&iterator[0].key, 0);
384 thread_data.itemSize = buildthread(&iterator[0].key, &thread_rec, 1, 0);
385 buildthreadkey(file_rec.fileID, 1, (CatalogKey *)&iterator[1].key);
426 buildthreadkey(cnid, std_hfs, (CatalogKey *)&iterator->key);
436 /* Turn thread record into a cnode key (in place). */
499 buildthreadkey(cnid, std_hfs, (CatalogKey *)&iterator->key);
509 /* Turn thread record into a cnode key (in place) */
553 * the key in the thread matches the key in the record.
634 * cat_lookupbykey - lookup a catalog node using a cnode key
658 bcopy(keyp, &iterator->key, sizeof(CatalogKey));
854 promotekey(hfsmp, (HFSCatalogKey *)&iterator->key, pluskey, &encoding);
857 pluskey = (HFSPlusCatalogKey *)&iterator->key;
922 /* Get space for iterator, key and data */
926 result = buildkey(hfsmp, descp, &bto->key, 0);
931 encoding = hfs_pickencoding(bto->key.nodeName.unicode,
932 bto->key.nodeName.length);
940 datalen = buildthread((void*)&bto->key, &bto->data, std_hfs,
958 buildthreadkey(nextCNID, std_hfs, (CatalogKey *) &bto->iterator.key);
1009 bcopy(&bto->key, &bto->iterator.key, sizeof(bto->key));
1018 buildthreadkey(nextCNID, std_hfs, (CatalogKey *)&bto->iterator.key);
1038 promotekey(hfsmp, (HFSCatalogKey *)&bto->iterator.key, pluskey, &encoding);
1041 pluskey = (HFSPlusCatalogKey *)&bto->iterator.key;
1107 if ((result = buildkey(hfsmp, from_cdp, (HFSPlusCatalogKey *)&from_iterator->key, 0)))
1112 if ((result = buildkey(hfsmp, to_cdp, (HFSPlusCatalogKey *)&to_iterator->key, 0)))
1115 to_key = (HFSPlusCatalogKey *)&to_iterator->key;
1148 buildthreadkey(pathcnid, std_hfs, (CatalogKey *)&dir_iterator->key);
1182 result = buildkey(hfsmp, &temp_desc, (HFSPlusCatalogKey *)&from_iterator->key, 0);
1232 if (std_hfs && hfskeycompare(to_key, iter->key) == 0)
1234 if (!std_hfs && hfspluskeycompare(to_key, iter->key) == 0)
1316 buildthreadkey(from_cdp->cd_cnid, std_hfs, (CatalogKey *)&from_iterator->key);
1328 datasize = buildthread(&to_iterator->key, recp, std_hfs, false);
1330 datasize = buildthread(&to_iterator->key, recp, std_hfs, directory);
1333 buildthreadkey(from_cdp->cd_cnid, std_hfs, (CatalogKey *)&from_iterator->key);
1342 promotekey(hfsmp, (HFSCatalogKey *)&to_iterator->key, pluskey, &encoding);
1353 pluskey = (HFSPlusCatalogKey *)&to_iterator->key;
1410 * Derive a key from either the file ID (for a virtual inode)
1414 result = getkey(hfsmp, attrp->ca_fileid, (CatalogKey *)&iterator->key);
1417 result = buildkey(hfsmp, descp, (HFSPlusCatalogKey *)&iterator->key, 0);
1438 result = buildkey(hfsmp, &temp_desc, (HFSPlusCatalogKey *)&iterator->key, 0);
1455 buildthreadkey(cnid, std_hfs, (CatalogKey *)&iterator->key);
1510 result = getkey(hfsmp, attrp->ca_fileid, (CatalogKey *)&iterator->key);
1512 result = buildkey(hfsmp, descp, (HFSPlusCatalogKey *)&iterator->key, 0);
1903 keyp = (HFSPlusCatalogKey *)&ip->key;
1988 result = getkey(hfsmp, linkfileid, (CatalogKey *)&iterator->key);
2018 if ((result = buildkey(hfsmp, descp, (HFSPlusCatalogKey *)&iterator->key, 0))) {
2063 if ((result = getkey(hfsmp, linkfileid, (CatalogKey *)&iterator->key))) {
2075 parent = ((HFSPlusCatalogKey *)&iterator->key)->parentID;
2142 /* Get space for iterator, key and data */
2147 result = buildkey(hfsmp, descp, &bto->key, 0);
2154 encoding = hfs_pickencoding(bto->key.nodeName.unicode, bto->key.nodeName.length);
2157 datalen = buildthread((void*)&bto->key, &bto->data, 0, 0);
2163 buildthreadkey(nextCNID, 0, (CatalogKey *) &bto->iterator.key);
2230 bcopy(&bto->key, &bto->iterator.key, sizeof(bto->key));
2246 buildthreadkey(nextCNID, 0, (CatalogKey *)&bto->iterator.key);
2446 if ((result = buildkey(hfsmp, descp, (HFSPlusCatalogKey *)&iterator->key, 0))) {
2497 getentriesattr_callback(const CatalogKey *key, const CatalogRecord *rec,
2508 parentcnid = state->stdhfs ? key->hfs.parentID : key->hfsPlus.parentID;
2554 promotekey(hfsmp, (const HFSCatalogKey *)key, pluskey, &encoding);
2568 builddesc((const HFSPlusCatalogKey *)key, getcnid(rec), 0, getencoding(rec),
2601 CatalogKey * key;
2625 key = (CatalogKey *)&iterator->key;
2631 * Attempt to build a key from cached filename
2634 if (buildkey(hfsmp, &dirhint->dh_desc, (HFSPlusCatalogKey *)key, 0) == 0) {
2647 buildthreadkey(dirhint->dh_desc.cd_parentcnid, (hfsmp->hfs_flags & HFS_STANDARD), key);
2680 /* Fill list with entries starting at iterator->key. */
3200 CatalogKey * key;
3242 key = (CatalogKey *)&iterator->key;
3250 * Attempt to build a key from cached filename
3253 if (buildkey(hfsmp, &dirhint->dh_desc, (HFSPlusCatalogKey *)key, 0) == 0) {
3264 buildthreadkey(dirhint->dh_desc.cd_parentcnid, (hfsmp->hfs_flags & HFS_STANDARD), key);
3278 buildthreadkey(dirhint->dh_desc.cd_parentcnid, (hfsmp->hfs_flags & HFS_STANDARD), key);
3338 * Process as many entries as possible starting at iterator->key.
3486 * The name portion of the key is compared using a 16-bit binary comparison.
3543 * Result: +n search key > trial key
3544 * 0 search key = trial key
3545 * -n search key < trial key
3570 * Result: +n search key > trial key
3571 * 0 search key = trial key
3572 * -n search key < trial key
3604 * buildkey - build a Catalog b-tree key from a cnode descriptor
3608 HFSPlusCatalogKey *key, int retry)
3617 key->parentID = descp->cd_parentcnid;
3618 key->nodeName.length = 0;
3626 key->nodeName.unicode, &unicodeBytes,
3627 sizeof(key->nodeName.unicode), ':', utf8_flags);
3628 key->nodeName.length = unicodeBytes / sizeof(UniChar);
3629 key->keyLength = kHFSPlusCatalogKeyMinimumLength + unicodeBytes;
3637 * For HFS volumes convert to an HFS compatible key
3646 hfskey.parentID = key->parentID;
3648 if (key->nodeName.length > 0) {
3651 key->nodeName.length * 2,
3652 key->nodeName.unicode,
3661 bcopy(&hfskey, key, sizeof(hfskey));
3701 (void) buildkey(hfsmp, &idesc, (HFSPlusCatalogKey *)&iterator->key, 0);
3745 * getkey - get a key from id by doing a thread lookup
3748 getkey(struct hfsmount *hfsmp, cnid_t cnid, CatalogKey * key)
3762 buildthreadkey(cnid, std_hfs, (CatalogKey *)&iterator->key);
3772 /* Turn thread record into a cnode key (in place) */
3778 bcopy(keyp, key, keyp->hfs.keyLength + 1);
3786 bcopy(keyp, key, keyp->hfsPlus.keyLength + 2);
3802 * getkeyplusattr - From id, fetch the key and the bsd attrs for a file/dir (could pass
3804 * cat_desc here). Both key and attrp must point to real structures.
3806 * The key's parent id is the only part of the key expected to be used by the caller.
3807 * The name portion of the key may not always be valid (ie in the case of a hard link).
3810 cat_getkeyplusattr(struct hfsmount *hfsmp, cnid_t cnid, CatalogKey * key, struct cat_attr *attrp)
3814 result = getkey(hfsmp, cnid, key);
3817 result = cat_lookupbykey(hfsmp, key, 0, 0, 0, NULL, attrp, NULL, NULL);
3821 * Fix up the parent id in the key if necessary.
3825 (key->hfsPlus.parentID == hfsmp->hfs_private_desc[FILE_HARDLINKS].cd_cnid) &&
3838 key->hfsPlus.parentID = linkdesc.cd_parentcnid;
3929 * builddesc - build a cnode descriptor from an HFS+ key
3932 builddesc(const HFSPlusCatalogKey *key, cnid_t cnid, u_int32_t hint, u_int32_t encoding,
3942 bufsize = (3 * key->nodeName.length) + 1;
3949 result = utf8_encodestr(key->nodeName.unicode,
3950 key->nodeName.length * sizeof(UniChar),
3955 bufsize = 1 + utf8_encodelen(key->nodeName.unicode,
3956 key->nodeName.length * sizeof(UniChar),
3961 result = utf8_encodestr(key->nodeName.unicode,
3962 key->nodeName.length * sizeof(UniChar),
3966 descp->cd_parentcnid = key->parentID;
4095 * promotekey - promote hfs key to hfs plus key
4210 * Build a catalog node thread record from a catalog key
4219 HFSCatalogKey *key = (HFSCatalogKey *)keyp;
4228 rec->parentID = key->parentID;
4229 bcopy(key->nodeName, rec->nodeName, key->nodeName[0]+1);
4232 HFSPlusCatalogKey *key = (HFSPlusCatalogKey *)keyp;
4241 rec->parentID = key->parentID;
4242 bcopy(&key->nodeName, &rec->nodeName,
4243 sizeof(UniChar) * (key->nodeName.length + 1));
4254 * Build a catalog node thread key.
4257 buildthreadkey(HFSCatalogNodeID parentID, int std_hfs, CatalogKey *key)
4260 key->hfs.keyLength = kHFSCatalogKeyMinimumLength;
4261 key->hfs.reserved = 0;
4262 key->hfs.parentID = parentID;
4263 key->hfs.nodeName[0] = 0;
4265 key->hfsPlus.keyLength = kHFSPlusCatalogKeyMinimumLength;
4266 key->hfsPlus.parentID = parentID;
4267 key->hfsPlus.nodeName.length = 0;
4385 buildthreadkey(dirlink_id, 1, (CatalogKey *)&iterator->key);