-
-
Save madx/395515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void sgf_remove(int inode) { | |
TBLOCK b; | |
int adr, i; | |
read_block (inode, &b.data); | |
/* Effacement en chaîne si le fichier est sur plusieurs blocs */ | |
if (b.inode.first != FAT_EOF) { | |
int cur, next; | |
cur = get_fat(b.inode.first); | |
while (cur != b.inode.last) { | |
next = get_fat (cur); | |
set_fat (cur, FAT_FREE); | |
cur = next; | |
} | |
set_fat(cur, FAT_FREE); | |
} | |
/* Dans tous les cas on supprime le premier bloc */ | |
set_fat (b.inode.first, FAT_FREE); | |
/* Libération de l'inode */ | |
set_fat (inode, FAT_FREE); | |
/* Suppression du couple dans le répertoire */ | |
read_block (ADR_BLOCK_DEF, &b.data); | |
adr = b.super.adr_dir; | |
read_block (adr, &b.data); | |
for(i = 0; i < BLOCK_DIR_SIZE; i++) { | |
if(b.dir[i].inode == inode) { | |
b.dir[i].inode = 0; | |
break; | |
} | |
} | |
write_block (adr, &b.data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment