fatfs.h File Reference


Detailed Description

Contains the structures and function APIs for FATFS file system support.

Go to the source code of this file.

Data Structures

struct  fatfs_sb
struct  fatfs_fsinfo
struct  fatfs_dentry
struct  fatfs_dentry_lfn
struct  FATFS_INFO

Defines

#define FATFS_ROOTINO   2
#define FATFS_FIRSTINO   2
#define FATFS_NDADDR   2
#define FATFS_NIADDR   0
#define FATFS_DEV_BSIZE   512
#define FATFS_SBOFF   0
#define FATFS_FS_MAGIC   0xaa55
#define FATFS_MAXNAMLEN   256
#define FATFS_MAXNAMLEN_UTF8   1024
#define FAT_CACHE_N   4
#define FAT_CACHE_B   4096
#define FAT_CACHE_S   8
#define FATFS_12_MASK   0x00000fff
#define FATFS_16_MASK   0x0000ffff
#define FATFS_32_MASK   0x0fffffff
#define FATFS_UNALLOC   0
#define FATFS_BAD   0x0ffffff7
#define FATFS_EOFS   0x0ffffff8
#define FATFS_EOFE   0x0fffffff
#define FATFS_ISEOF(val, mask)   ((val >= (FATFS_EOFS & mask)) && (val <= (FATFS_EOFE)))
#define FATFS_ISBAD(val, mask)   ((val) == (FATFS_BAD & mask))
#define FATFS_CLUST_2_SECT(fatfs, c)   (DADDR_T)(fatfs->firstclustsect + ((((c) & fatfs->mask) - 2) * fatfs->csize))
#define FATFS_SECT_2_CLUST(fatfs, s)   (DADDR_T)(2 + ((s) - fatfs->firstclustsect) / fatfs->csize)
#define FATFS_INODE_2_SECT(fatfs, i)   (DADDR_T)((i - 3)/(fatfs->dentry_cnt_se) + fatfs->firstdatasect)
#define FATFS_INODE_2_OFF(fatfs, i)   (unsigned int)(((i - 3) % fatfs->dentry_cnt_se) * sizeof(fatfs_dentry))
#define FATFS_SECT_2_INODE(fatfs, s)   (INUM_T)((s - fatfs->firstdatasect) * fatfs->dentry_cnt_se + 3)
#define FATFS_DENTRY_CLUST(fsi, de)   (DADDR_T)((tsk_getu16(fsi->endian, de->startclust)) | (tsk_getu16(fsi->endian, de->highclust)<<16))
#define FATFS_SLOT_EMPTY   0x00
#define FATFS_SLOT_E5   0x05
#define FATFS_SLOT_DELETED   0xe5
#define FATFS_IS_83_NAME(c)
#define FATFS_ATTR_NORMAL   0x00
#define FATFS_ATTR_READONLY   0x01
#define FATFS_ATTR_HIDDEN   0x02
#define FATFS_ATTR_SYSTEM   0x04
#define FATFS_ATTR_VOLUME   0x08
#define FATFS_ATTR_DIRECTORY   0x10
#define FATFS_ATTR_ARCHIVE   0x20
#define FATFS_ATTR_LFN   0x0f
#define FATFS_ATTR_ALL   0x3f
#define FATFS_CASE_LOWER_BASE   0x08
#define FATFS_CASE_LOWER_EXT   0x10
#define FATFS_CASE_LOWER_ALL   0x18
#define FATFS_SEC_MASK   0x1f
#define FATFS_SEC_SHIFT   0
#define FATFS_SEC_MIN   0
#define FATFS_SEC_MAX   30
#define FATFS_MIN_MASK   0x7e0
#define FATFS_MIN_SHIFT   5
#define FATFS_MIN_MIN   0
#define FATFS_MIN_MAX   59
#define FATFS_HOUR_MASK   0xf800
#define FATFS_HOUR_SHIFT   11
#define FATFS_HOUR_MIN   0
#define FATFS_HOUR_MAX   23
#define FATFS_ISTIME(x)
#define FATFS_DAY_MASK   0x1f
#define FATFS_DAY_SHIFT   0
#define FATFS_DAY_MIN   1
#define FATFS_DAY_MAX   31
#define FATFS_MON_MASK   0x1e0
#define FATFS_MON_SHIFT   5
#define FATFS_MON_MIN   1
#define FATFS_MON_MAX   12
#define FATFS_YEAR_MASK   0xfe00
#define FATFS_YEAR_SHIFT   9
#define FATFS_YEAR_MIN   0
#define FATFS_YEAR_MAX   127
#define FATFS_ISDATE(x)
#define FATFS_LFN_SEQ_FIRST   0x40
#define FATFS_LFN_SEQ_MASK   0x3f

Functions

int8_t is_sectalloc (FATFS_INFO *, DADDR_T)
uint8_t fatfs_dent_walk (TSK_FS_INFO *, INUM_T, TSK_FS_DENT_FLAG_ENUM, TSK_FS_DENT_TYPE_WALK_CB, void *)
 Process the contents of a directory and pass each file name to a callback function.
uint8_t fatfs_isdentry (FATFS_INFO *, fatfs_dentry *)
uint8_t fatfs_make_root (FATFS_INFO *, TSK_FS_INODE *)
 Create an FS_INODE structure for the root directory.
TSK_RETVAL_ENUM fatfs_dinode_copy (FATFS_INFO *, TSK_FS_INODE *, fatfs_dentry *, DADDR_T, INUM_T)
 Copy the contents of a raw directry entry into a TSK_FS_INFO structure.


Define Documentation

#define FATFS_IS_83_NAME (  ) 

Value:

((((c) < 0x20) || \
          ((c) == 0x22) || \
          (((c) >= 0x2a) && ((c) <= 0x2c)) || \
          ((c) == 0x2e) || \
          ((c) == 0x2f) || \
          (((c) >= 0x3a) && ((c) <= 0x3f)) || \
          (((c) >= 0x5b) && ((c) <= 0x5d)) || \
          ((c) == 0x7c)) == 0)

#define FATFS_ISDATE (  ) 

Value:

(((((x & FATFS_DAY_MASK) >> FATFS_DAY_SHIFT) > FATFS_DAY_MAX) || \
           (((x & FATFS_DAY_MASK) >> FATFS_DAY_SHIFT) < FATFS_DAY_MIN) || \
           (((x & FATFS_MON_MASK) >> FATFS_MON_SHIFT) > FATFS_MON_MAX) || \
           (((x & FATFS_MON_MASK) >> FATFS_MON_SHIFT) < FATFS_MON_MIN) || \
           (((x & FATFS_YEAR_MASK) >> FATFS_YEAR_SHIFT) > FATFS_YEAR_MAX) ) == 0)

#define FATFS_ISTIME (  ) 

Value:

(((((x & FATFS_SEC_MASK) >> FATFS_SEC_SHIFT) > FATFS_SEC_MAX) || \
          (((x & FATFS_MIN_MASK) >> FATFS_MIN_SHIFT) > FATFS_MIN_MAX) || \
          (((x & FATFS_HOUR_MASK) >> FATFS_HOUR_SHIFT) > FATFS_HOUR_MAX) ) == 0)


Function Documentation

uint8_t fatfs_dent_walk ( TSK_FS_INFO fs,
INUM_T  inode,
TSK_FS_DENT_FLAG_ENUM  flags,
TSK_FS_DENT_TYPE_WALK_CB  action,
void *  ptr 
)

Process the contents of a directory and pass each file name to a callback function.

Parameters:
fs File system to analyze
inode Metadata address of directory to analyze
flags Flags used during analysis
action Callback function that is called for each file name
ptr Pointer to data that is passed to callback
Returns:
1 on error and 0 on success

TSK_RETVAL_ENUM fatfs_dinode_copy ( FATFS_INFO *  fatfs,
TSK_FS_INODE fs_inode,
fatfs_dentry *  in,
DADDR_T  sect,
INUM_T  inum 
)

Copy the contents of a raw directry entry into a TSK_FS_INFO structure.

Parameters:
fatfs File system that directory entry is from
fs_inode Generic inode structure to copy data into
in Directory entry to copy data from
sect Sector address where directory entry is from -- used to determine allocation status.
inum Address of the inode.
Returns:
1 on error and 0 on success. Errors should only occur for Unicode conversion problems and when this occurs the name will be NULL terminated (but with unknown contents).

uint8_t fatfs_make_root ( FATFS_INFO *  fatfs,
TSK_FS_INODE fs_inode 
)

Create an FS_INODE structure for the root directory.

FAT does not have a directory entry for the root directory, but this function collects the needed data to make one.

Parameters:
fatfs File system to analyze
fs_inode Inode structure to copy root directory information into.
Returns:
1 on error and 0 on success


Generated on Wed Nov 28 16:11:16 2007 for The Sleuth Kit (Incomplete) by  doxygen 1.5.1