From ad69f66b9a25bf03e446427d6943d6eefe48ec7c Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Thu, 3 Sep 2009 16:59:50 -0700 Subject: [PATCH] Directory serialization (but not deserialization). --- bluesky/serialize.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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); -- 2.20.1