+static void reload_item(BlueSkyCloudLog *log_item,
+ const char *data,
+ size_t len1, size_t len2, size_t len3)
+{
+ BlueSkyFS *fs = log_item->fs;
+ /*const char *data1 = data;*/
+ const BlueSkyCloudID *data2
+ = (const BlueSkyCloudID *)(data + len1);
+ /*const BlueSkyCloudPointer *data3
+ = (const BlueSkyCloudPointer *)(data + len1 + len2);*/
+
+ bluesky_string_unref(log_item->data);
+ log_item->data = NULL;
+ log_item->location_flags = CLOUDLOG_JOURNAL;
+
+ BlueSkyCloudID id0;
+ memset(&id0, 0, sizeof(id0));
+
+ int link_count = len2 / sizeof(BlueSkyCloudID);
+ GArray *new_links = g_array_new(FALSE, TRUE, sizeof(BlueSkyCloudLog *));
+ for (int i = 0; i < link_count; i++) {
+ BlueSkyCloudID id = data2[i];
+ BlueSkyCloudLog *ref = NULL;
+ if (memcmp(&id, &id0, sizeof(BlueSkyCloudID)) != 0) {
+ g_mutex_lock(fs->lock);
+ ref = g_hash_table_lookup(fs->locations, &id);
+ if (ref != NULL) {
+ bluesky_cloudlog_ref(ref);
+ }
+ g_mutex_unlock(fs->lock);
+ }
+ g_array_append_val(new_links, ref);
+ }
+
+ for (int i = 0; i < log_item->links->len; i++) {
+ BlueSkyCloudLog *c = g_array_index(log_item->links,
+ BlueSkyCloudLog *, i);
+ bluesky_cloudlog_unref(c);
+ }
+ g_array_unref(log_item->links);
+ log_item->links = new_links;
+}
+