Riferimenti per il file load_fat.c

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "Include/fat.h"
#include "Include/load_fat.h"

Vai al codice sorgente di questo file.

Funzioni

int mount_fat (FILE *fs, struct fat_ctrl *f_ctrl)

Descrizione dettagliata

Autore:
Tranchida Giulio, No Matricola 241732
Si dichiara che il contenuto di questo file e', in ogni sua parte, opera originale dell'autore.

This program is free software; you can redistribuite it and/or modify it under the terms of the GNU/General Pubblic License as published the Free software Foundation; either version 2 of the License, or (at your opinion) any later version.

Definizione nel file load_fat.c.


Documentazione delle funzioni

int mount_fat ( FILE *  fs,
struct fat_ctrl f_ctrl 
)

Questa funzione si occupa di leggere le informazioni di controllo del filesystem FAT.

Parametri:
fs il FILE pointer che consente di acceddre al file in cui il filesystem e' memorizzato.
f_ctrl il puntatore alla struttura dove memorizzare le informazioni di controllo
Restituisce:
  • ERFCD se si verifica un errore durante la lettura delle strutture dati utilizzati da SFAT.
  • 0 in caso di successo

Definizione alla linea 21 del file load_fat.c.

00021                                                 {
00022         
00023         if ( !(fs) || !(f_ctrl) ) return EBDP;
00024         /* Lettura informazioni del boot sector */
00025         if (!(fread(&(f_ctrl->b_sector), sizeof(struct boot_sector), 1, fs))){;
00026         sfaterror(ERFCD);
00027         return ERFCD;
00028         }
00029 
00030         /* Alloco memoria per la FAT */
00031         if (!(f_ctrl->fat_ptr = calloc((f_ctrl->b_sector).num_block, sizeof(unsigned int)))){
00032         sfaterror(STDLIBERR);
00033         return STDLIBERR;
00034         } 
00035         
00036         /* Lettura dei dati della FAT */
00037         if (!(fread(f_ctrl->fat_ptr,((f_ctrl->b_sector).num_block * sizeof(unsigned int)), 1, fs))){
00038         sfaterror(ERFCD);
00039         return ERFCD;
00040         }
00041         
00042         f_ctrl->blk_base = sizeof(struct boot_sector) + (sizeof(unsigned int) * (f_ctrl->b_sector).num_block); 
00043         
00044         return 0;
00045 }

Generato il Fri Jan 28 22:16:31 2011 per SFAT: Simplified File Allocation Table Project da  doxygen 1.6.3