From 22fac5088f31def6e3f16128d5632b88ba240fc9 Mon Sep 17 00:00:00 2001
From: Bah Thierno-Souleymane <thiernosouleymane.bah.etu@univ-lille.fr>
Date: Fri, 26 Mar 2021 01:55:47 +0100
Subject: [PATCH] feat(save_super function added)

---
 tpfs/vol.c | 8 ++++++++
 tpfs/vol.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/tpfs/vol.c b/tpfs/vol.c
index 490cdc2..d61d2fe 100644
--- a/tpfs/vol.c
+++ b/tpfs/vol.c
@@ -188,4 +188,12 @@ int load_super(unsigned int vol)
     memcpy(&super, buffer, sizeof(vsuper_t));
 
     assert(super.magic == MAGIC);
+}
+
+void save_super()
+{
+    unsigned char buffer[sizeof(vsuper_t)];
+
+    memcpy(buffer, &super, sizeof(vsuper_t));
+    write_bloc(super.id, SUPER_BLOC, buffer);
 }
\ No newline at end of file
diff --git a/tpfs/vol.h b/tpfs/vol.h
index a155d88..9dadedc 100644
--- a/tpfs/vol.h
+++ b/tpfs/vol.h
@@ -61,5 +61,6 @@ void remove_vol();
 
 void init_volume(unsigned int vol);
 int load_super(unsigned int vol);
+void save_super();
 
 #endif
-- 
GitLab