Exemple #1
0
/** Affiche la liste des blocs libres **/
void display_free_blocs() {
    int i = 0;
    struct free_bloc_s fb;
    read_bloc_n(current_vol, superbloc.first_free_bloc, (uchar *)&fb, sizeof(struct free_bloc_s));
    printf("List of free blocs : ");
    printf(" %d ", superbloc.first_free_bloc);
    while(i < superbloc.nb_free) {
         printf(" %d ", fb.next_free_bloc);
         read_bloc_n(current_vol, fb.next_free_bloc, (uchar *)&fb, sizeof(struct free_bloc_s));
         i++;
    }
    printf("\n\n");
}
Exemple #2
0
int load_super(uint vol) {
    current_vol = vol;
    read_bloc_n(current_vol, 0, (uchar *) &superbloc, sizeof(struct superbloc_s));
    if(superbloc.magic == MAGIC_SUPERBLOC)
        return 1;
    else return 0;
}
Exemple #3
0
int load_super(unsigned vol){
	//vol=0;	//test avec constante
	unsigned char buffer[HDA_SECTORSIZE];
	memset(buffer, 0, HDA_SECTORSIZE);
	//printf("Dans load_super, Avant read_bloc\n");	
	read_bloc_n(vol, SUPER, buffer, sizeof(struct superBloc_s));
	//printf("Dans load_super, Avant memcpy\n");	
	//memcpy(&current_super, buffer, sizeof(struct superBloc_s));
	//printf("Dans load_super, Après memcpy\n");
	//current_vol=vol;	
		
	//if(current_super.super_magic==SUPER_MAGIC){
	//	printf("Dans load_super, dans le if de MAGIC\n");
	//	current_vol=vol;
	//	return 0;
	//}
	return current_super.super_magic==SUPER_MAGIC;
}
void load_super(unsigned int vol){
	read_bloc_n(vol,SUPER,&super,sizeof(struct super_s));
	assert(super.super_magic==SUPER_MAGIC);
	current_volume = vol;
}