Inodes are clean immediately after being read from storage.
[bluesky.git] / bluesky / serialize.c
index 7f7f041..e3abc14 100644 (file)
@@ -11,7 +11,7 @@
 #include <glib.h>
 #include <string.h>
 
-#include "bluesky.h"
+#include "bluesky-private.h"
 
 /* Serialization of in-memory filesystem data structures to bytestrings which
  * can be written to persistent storage.  All data is stored in little-endian
@@ -124,6 +124,13 @@ void bluesky_serialize_inode(GString *out, BlueSkyInode *inode)
 
         break;
     }
+
+    case BLUESKY_SYMLINK:
+    {
+        g_string_append(out, inode->symlink_contents);
+        g_string_append_c(out, '\0');
+    }
+
     default:
         g_warning("Serialization for inode type %d not implemented!\n",
                   inode->type);
@@ -145,6 +152,7 @@ BlueSkyInode *bluesky_deserialize_inode(BlueSkyFS *fs, const gchar *buf)
     inode->gid = GUINT32_FROM_LE(raw->gid);
     inode->nlink = GUINT32_FROM_LE(raw->nlink);
     inode->change_count = GUINT64_FROM_LE(raw->change_count);
+    inode->change_commit = inode->change_count;
     inode->atime = GINT64_FROM_LE(raw->atime);
     inode->ctime = GINT64_FROM_LE(raw->ctime);
     inode->mtime = GINT64_FROM_LE(raw->mtime);
@@ -200,6 +208,12 @@ BlueSkyInode *bluesky_deserialize_inode(BlueSkyFS *fs, const gchar *buf)
         }
         break;
     }
+
+    case BLUESKY_SYMLINK:
+    {
+        inode->symlink_contents = g_strdup(buf);
+    }
+
     default:
         g_warning("Deserialization for inode type %d not implemented!\n",
                   inode->type);