X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fserialize.c;h=a9e4182f0912e206e6494161fdf7ab942ac5064e;hb=f2586554fd55cd3cc1be65ac33d1122d00372133;hp=2b741b035a41f5b620ea4807782d562149fcb008;hpb=9d8f7bdd798dc5625b9b2880461e383e266e64ca;p=bluesky.git diff --git a/bluesky/serialize.c b/bluesky/serialize.c index 2b741b0..a9e4182 100644 --- a/bluesky/serialize.c +++ b/bluesky/serialize.c @@ -93,9 +93,11 @@ void bluesky_serialize_inode(GString *out, BlueSkyInode *inode) g_string_append_len(out, (gchar *)&size, sizeof(uint64_t)); for (int i = 0; i < inode->blocks->len; i++) { BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock, i); + BlueSkyCloudID id; + memset(&id, 0, sizeof(id)); if (b->ref != NULL) - g_string_append(out, b->ref); - g_string_append_c(out, '\0'); + id = b->ref->id; + g_string_append_len(out, (const char *)&id, sizeof(id)); } break; } @@ -142,7 +144,10 @@ void bluesky_serialize_inode(GString *out, BlueSkyInode *inode) * indicating whether the deserialization was successful. */ gboolean bluesky_deserialize_inode(BlueSkyInode *inode, const gchar *buf) { - g_print("Deserializing inode %lld...\n", (long long)inode->inum); + if (bluesky_verbose) { + g_log("bluesky/serialize", G_LOG_LEVEL_DEBUG, + "Deserializing inode %lld...", (long long)inode->inum); + } struct serialized_inode *raw = (struct serialized_inode *)buf; @@ -175,12 +180,15 @@ gboolean bluesky_deserialize_inode(BlueSkyInode *inode, const gchar *buf) g_array_set_size(inode->blocks, (inode->size + BLUESKY_BLOCK_SIZE - 1) / BLUESKY_BLOCK_SIZE); + // TODO +#if 0 for (int i = 0; i < inode->blocks->len; i++) { BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock, i); b->type = BLUESKY_BLOCK_REF; b->ref = g_strdup(buf); buf += strlen(b->ref) + 1; } +#endif break; case BLUESKY_DIRECTORY: @@ -205,9 +213,6 @@ gboolean bluesky_deserialize_inode(BlueSkyInode *inode, const gchar *buf) g_hash_table_insert(inode->dirhash_folded, dirent->name_folded, dirent); - g_print(" dirent[%08x]: %s -> %"PRIu64"\n", - dirent->cookie, dirent->name, dirent->inum); - buf = strchr(d->name, '\0') + 1; d = (struct serialized_dirent *)buf; }