# fatfs.c File Reference

## Detailed Description

FAT file system code to handle basic file system processing for opening file system, processing sectors, and directory entries.

`#include "fs_tools_i.h"`
`#include "fatfs.h"`

## Functions

int8_t | is_clustalloc (FATFS_INFO *fatfs, DADDR_T clust)
int8_t | is_sectalloc (FATFS_INFO *fatfs, DADDR_T sect)
uint8_t | fatfs_block_walk (TSK_FS_INFO *fs, DADDR_T start_blk, DADDR_T end_blk, TSK_FS_BLOCK_FLAG_ENUM flags, TSK_FS_BLOCK_WALK_CB action, void *ptr)
uint8_t | 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.
uint8_t | fatfs_make_root (FATFS_INFO *fatfs, TSK_FS_INODE *fs_inode)
| Create an FS_INODE structure for the root directory.
uint8_t | fatfs_isdentry (FATFS_INFO *fatfs, fatfs_dentry *de)
uint8_t | fatfs_inode_walk (TSK_FS_INFO *fs, INUM_T start_inum, INUM_T end_inum, TSK_FS_INODE_FLAG_ENUM flags, TSK_FS_INODE_WALK_CB action, void *ptr)
uint8_t | fatfs_jopen (TSK_FS_INFO *fs, INUM_T inum)
uint8_t | fatfs_jentry_walk (TSK_FS_INFO *fs, int flags, TSK_FS_JENTRY_WALK_CB action, void *ptr)
uint8_t | fatfs_jblk_walk (TSK_FS_INFO *fs, DADDR_T start, DADDR_T end, int flags, TSK_FS_JBLK_WALK_CB action, void *ptr)
TSK_FS_INFO * | fatfs_open (TSK_IMG_INFO *img_info, SSIZE_T offset, TSK_FS_INFO_TYPE_ENUM ftype, uint8_t test)

## Function Documentation

uint8_t 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