diff --git a/tpfs/vol.c b/tpfs/vol.c
index d61d2fe16c21cf2285d6b2d4e30de349f88c109c..f8c8f1d4cb69014977c7d729c1e2b51076da8c20 100644
--- a/tpfs/vol.c
+++ b/tpfs/vol.c
@@ -196,4 +196,25 @@ void save_super()
memcpy(buffer, &super, sizeof(vsuper_t));
write_bloc(super.id, SUPER_BLOC, buffer);
+}
+
+unsigned int new_bloc()
+{
+ unsigned int new_bloc;
+ unsigned char buffer[sizeof(vblockchain_t)];
+ vblockchain_t blockchain;
+
+ if (!super.first_free)
+ {
+ fprintf(stderr, "Il n'y a pas de bloc libre");
+ return 0;
+ }
+
+ read_bloc(super.id, super.first_free, buffer);
+ memcpy(&blockchain, buffer, sizeof(vblockchain_t));
+
+ new_bloc = super.first_free;
+ super.first_free = blockchain.next;
+
+ return new_bloc;
}
\ No newline at end of file
diff --git a/tpfs/vol.h b/tpfs/vol.h
index 9dadedcb2f5cf710d752aff692df08a4ea2ef533..a090f2c369ca4a8e4ddf47d697027aae02f65f5c 100644
--- a/tpfs/vol.h
+++ b/tpfs/vol.h
@@ -62,5 +62,6 @@ void remove_vol();
void init_volume(unsigned int vol);
int load_super(unsigned int vol);
void save_super();
+unsigned int new_bloc();
#endif