Some initial work on logging gathering data into cloud log segments.
[bluesky.git] / bluesky / debug.c
index b409c74..cfb6a81 100644 (file)
@@ -35,6 +35,17 @@ static void inode_dump(gpointer key, gpointer value, gpointer user_data)
             inode->change_count, inode->change_commit);
 }
 
+static void cloudlog_dump(gpointer key, gpointer value, gpointer user_data)
+{
+    BlueSkyCloudLog *log = (BlueSkyCloudLog *)value;
+
+    for (int i = 0; i < sizeof(BlueSkyCloudID); i++) {
+        g_print("%02x", (uint8_t)(log->id.bytes[i]));
+    }
+    g_print(": ty=%d inode=%"PRIu64" locs=%x\n",
+            log->type, log->inum, log->location_flags);
+}
+
 /* Dump a summary of filesystem state as it is cached in memory. */
 void bluesky_debug_dump(BlueSkyFS *fs)
 {
@@ -58,6 +69,10 @@ void bluesky_debug_dump(BlueSkyFS *fs)
     g_print("\n");
 
     g_hash_table_foreach(fs->inodes, inode_dump, fs);
+
+    g_print("\nLog Objects:\n");
+    g_hash_table_foreach(fs->locations, cloudlog_dump, fs);
+    g_print("\n");
 }
 
 /* Statistics counters: for operation counts, bytes transferred, etc. */