MCPcopy Create free account
hub / github.com/RsyncProject/rsync / rsync_xal_store

Function rsync_xal_store

xattrs.c:453–492  ·  view source on GitHub ↗

Store *xalp on the end of rsync_xal_l */

Source from the content-addressed store, hash-verified

451
452/* Store *xalp on the end of rsync_xal_l */
453static int rsync_xal_store(item_list *xalp)
454{
455 struct ht_int64_node *node;
456 int ndx = rsync_xal_l.count; /* pre-incremented count */
457 rsync_xa_list *new_list = EXPAND_ITEM_LIST(&rsync_xal_l, rsync_xa_list, RSYNC_XAL_LIST_INITIAL);
458 rsync_xa_list_ref *new_ref;
459 /* Since the following call starts a new list, we know it will hold the
460 * entire initial-count, not just enough space for one new item. */
461 *new_list = empty_xa_list;
462 (void)EXPAND_ITEM_LIST(&new_list->xa_items, rsync_xa, xalp->count);
463 memcpy(new_list->xa_items.items, xalp->items, xalp->count * sizeof (rsync_xa));
464 new_list->xa_items.count = xalp->count;
465 xalp->count = 0;
466
467 new_list->ndx = ndx;
468 new_list->key = xattr_lookup_hash(&new_list->xa_items);
469
470 if (rsync_xal_h == NULL)
471 rsync_xal_h = hashtable_create(512, HT_KEY64);
472
473 new_ref = new0(rsync_xa_list_ref);
474 new_ref->ndx = ndx;
475
476 node = hashtable_find(rsync_xal_h, new_list->key, new_ref);
477 if (node->data != (void*)new_ref) {
478 rsync_xa_list_ref *ref = node->data;
479
480 while (ref != NULL) {
481 if (ref->next != NULL) {
482 ref = ref->next;
483 continue;
484 }
485
486 ref->next = new_ref;
487 break;
488 }
489 }
490
491 return ndx;
492}
493
494/* Send the make_xattr()-generated xattr list for this flist entry. */
495int send_xattr(int f, stat_x *sxp)

Callers 3

send_xattrFunction · 0.85
receive_xattrFunction · 0.85
cache_tmp_xattrFunction · 0.85

Calls 3

xattr_lookup_hashFunction · 0.85
hashtable_createFunction · 0.85
hashtable_findFunction · 0.85

Tested by

no test coverage detected