diff --git a/tpfs/vol.c b/tpfs/vol.c index fcc58c313631cb16d473677f33ae3422766f05d9..490cdc28ca1d7281739c9ddf3457e76f8767dedb 100644 --- a/tpfs/vol.c +++ b/tpfs/vol.c @@ -179,3 +179,13 @@ void init_volume(unsigned int vol) write_bloc(vol, i, &blockchain); } } + +int load_super(unsigned int vol) +{ + unsigned char buffer[sizeof(vsuper_t)]; + + read_bloc(vol, SUPER_BLOC, buffer); + memcpy(&super, buffer, sizeof(vsuper_t)); + + assert(super.magic == MAGIC); +} \ No newline at end of file diff --git a/tpfs/vol.h b/tpfs/vol.h index ab076af1019de73b9b2be62489c269b09ead349a..a155d880cf5f561eaad9cc3876e4062c5ebc9b7f 100644 --- a/tpfs/vol.h +++ b/tpfs/vol.h @@ -40,6 +40,8 @@ typedef struct vsuper_s unsigned int first_free; } vsuper_t; +vsuper_t super; + typedef struct vblockchain_s { unsigned int next; @@ -58,5 +60,6 @@ void display_vols(); void remove_vol(); void init_volume(unsigned int vol); +int load_super(unsigned int vol); #endif