Home | History | Annotate | Download | only in libfat
      1 /* ----------------------------------------------------------------------- *
      2  *
      3  *   Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
      4  *
      5  *   This program is free software; you can redistribute it and/or modify
      6  *   it under the terms of the GNU General Public License as published by
      7  *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
      8  *   Boston MA 02111-1307, USA; either version 2 of the License, or
      9  *   (at your option) any later version; incorporated herein by reference.
     10  *
     11  * ----------------------------------------------------------------------- */
     12 
     13 /*
     14  * libfatint.h
     15  *
     16  * Internals for the libfat filesystem
     17  */
     18 
     19 #ifndef LIBFATINT_H
     20 #define LIBFATINT_H
     21 
     22 #include "libfat.h"
     23 #include "fat.h"
     24 
     25 struct libfat_sector {
     26     libfat_sector_t n;		/* Sector number */
     27     struct libfat_sector *next;	/* Next in list */
     28     char data[LIBFAT_SECTOR_SIZE];
     29 };
     30 
     31 enum fat_type {
     32     FAT12,
     33     FAT16,
     34     FAT28
     35 };
     36 
     37 struct libfat_filesystem {
     38     int (*read) (intptr_t, void *, size_t, libfat_sector_t);
     39     intptr_t readptr;
     40 
     41     enum fat_type fat_type;
     42     unsigned int clustsize;
     43     int clustshift;
     44     int32_t endcluster;		/* Highest legal cluster number + 1 */
     45     int32_t rootcluster;	/* Root directory cluster */
     46 
     47     libfat_sector_t fat;	/* Start of FAT */
     48     libfat_sector_t rootdir;	/* Start of root directory */
     49     libfat_sector_t data;	/* Start of data area */
     50     libfat_sector_t end;	/* End of filesystem */
     51 
     52     struct libfat_sector *sectors;
     53 };
     54 
     55 #endif /* LIBFATINT_H */
     56