Skip to content
Snippets Groups Projects
Commit 61e7641c authored by Thierno souleymane Bah's avatar Thierno souleymane Bah
Browse files

feat(new_bloc function added)

parent 22fac508
No related branches found
No related tags found
No related merge requests found
......@@ -197,3 +197,24 @@ 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
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment