char key[64];
sprintf(key, "inode-%016llx", inum);
BlueSkyRCStr *data = bluesky_store_get(fs->store, key);
+ if (data == NULL)
+ return;
BlueSkyInode *inode = bluesky_deserialize_inode(fs, data->data);
if (inode != NULL) {
/* Magic signature for serialized inodes. */
-#define INODE_MAGIC 0xa6832100943d71e5ULL
+#define INODE_MAGIC 0xa6832100943d71e6ULL
struct serialized_inode {
uint64_t signature; /* INODE_MAGIC */
switch (inode->type) {
case BLUESKY_REGULAR:
+ {
+ uint64_t size = GUINT64_TO_LE(inode->size);
+ 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);
if (b->ref != NULL)
g_string_append_c(out, '\0');
}
break;
+ }
case BLUESKY_DIRECTORY:
{
/* TODO: Bounds checking */
switch (inode->type) {
case BLUESKY_REGULAR:
+ inode->size = GINT64_FROM_LE(*(uint64_t *)buf);
+ buf += sizeof(uint64_t);
g_array_set_size(inode->blocks,
(inode->size + BLUESKY_BLOCK_SIZE - 1)
/ BLUESKY_BLOCK_SIZE);