From: Michael Vrable Date: Thu, 3 Sep 2009 23:59:50 +0000 (-0700) Subject: Directory serialization (but not deserialization). X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=ad69f66b9a25bf03e446427d6943d6eefe48ec7c;p=bluesky.git Directory serialization (but not deserialization). --- diff --git a/bluesky/serialize.c b/bluesky/serialize.c index 7cb16a5..d0273cc 100644 --- a/bluesky/serialize.c +++ b/bluesky/serialize.c @@ -62,6 +62,31 @@ void bluesky_serialize_inode(GString *out, BlueSkyInode *inode) g_string_append_c(out, '\0'); } break; + + case BLUESKY_DIRECTORY: + { + uint32_t seq; + uint64_t inum; + GSequenceIter *i = g_sequence_get_begin_iter(inode->dirents); + + while (!g_sequence_iter_is_end(i)) { + BlueSkyDirent *d = g_sequence_get(i); + + seq = GUINT32_TO_LE(d->cookie); + inum = GUINT64_TO_LE(d->inum); + g_string_append_len(out, (gchar *)&seq, sizeof(uint32_t)); + g_string_append_len(out, (gchar *)&inum, sizeof(uint64_t)); + g_string_append(out, d->name); + g_string_append_c(out, '\0'); + + i = g_sequence_iter_next(i); + } + + seq = GUINT32_TO_LE(0); + g_string_append_len(out, (gchar *)&seq, sizeof(uint32_t)); + + break; + } default: g_warning("Serialization for inode type %d not implemented!\n", inode->type);