Skip to content

Instantly share code, notes, and snippets.

@madx
Created May 10, 2010 01:49
Show Gist options
  • Save madx/395572 to your computer and use it in GitHub Desktop.
Save madx/395572 to your computer and use it in GitHub Desktop.
void print_fat() {
TBLOCK b,ib;
int adr;
int i, k;
read_block(ADR_BLOCK_DEF, &b.data);
adr = b.super.adr_dir;
read_block(adr, &b.data);
if (!fat.in_memory)
panic("La FAT n'est pas initialisée.");
for (i = 0; i < fat.disk_size; i++) {
if (fat.tab[i] == FAT_FREE) continue;
switch(fat.tab[i]) {
case FAT_RESERVED:
break;
case FAT_INODE:
for (k = 0; k < BLOCK_DIR_SIZE; k++) {
if (b.dir[k].inode == i) {
read_block(b.dir[k].inode, &ib.data);
printf ("fat[%d] <inode /%s [%d, %d]>\n", i, b.dir[k].name, ib.inode.first, ib.inode.last);
}
}
break;
case FAT_EOF:
printf ("fat[%d] <EOF>\n", i); break;
default:
printf ("fat[%d] => fat[%d]\n", i, fat.tab[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment