cbmimage
Loading...
Searching...
No Matches
FAT processing functions

Classes

struct  cbmimage_fat_entry_s
 cbmimage One entry of the FAT structure More...
 
struct  cbmimage_fat_s
 cbmimage FAT structure More...
 

Typedefs

typedef struct cbmimage_fat_entry_s cbmimage_fat_entry
 cbmimage One entry of the FAT structure
 
typedef struct cbmimage_fat_s cbmimage_fat
 cbmimage FAT structure
 

Functions

cbmimage_fatcbmimage_fat_create (cbmimage_fileimage *image)
 create a FAT structure
 
void cbmimage_fat_close (cbmimage_fat *fat)
 close a FAT structure
 
int cbmimage_i_fat_set (cbmimage_fat *fat, cbmimage_blockaddress block, uint16_t target_lba)
 
int cbmimage_fat_set (cbmimage_fat *fat, cbmimage_blockaddress block, cbmimage_blockaddress target)
 set a block in the FAT to a target in the FAT
 
int cbmimage_fat_clear (cbmimage_fat *fat, cbmimage_blockaddress block)
 set a block in the FAT to unused
 
int cbmimage_i_fat_get_target_lba (cbmimage_fat *fat, cbmimage_blockaddress block)
 
cbmimage_blockaddress cbmimage_fat_get (cbmimage_fat *fat, cbmimage_blockaddress block)
 get the target of a block in the FAT
 
int cbmimage_fat_is_used (cbmimage_fat *fat, cbmimage_blockaddress block)
 check if a block in the FAT is marked as used
 
void cbmimage_fat_dump (cbmimage_fat *fat, int trackformat)
 dump a FAT structure
 

Detailed Description

Typedef Documentation

◆ cbmimage_fat

typedef struct cbmimage_fat_s cbmimage_fat

cbmimage FAT structure

This structure holds a file allocaton table (FAT) into the image, build from the T/S links at the beginning of each block.

It helps in fast navigation inside of an image.

◆ cbmimage_fat_entry

cbmimage One entry of the FAT structure

This structure holds the entry for one block inside of the file allocaton table (FAT) into the image, build from the T/S links at the beginning of each block.

It helps in fast navigation inside of an image.

Function Documentation

◆ cbmimage_fat_clear()

int cbmimage_fat_clear ( cbmimage_fat * fat,
cbmimage_blockaddress block )

set a block in the FAT to unused

Parameters
[in]fatpointer to a fat structure
[in]blockThe address of the block that is to be marked
Returns
  • 0 if everything is ok
  • != 0 if an error occurred

◆ cbmimage_fat_close()

void cbmimage_fat_close ( cbmimage_fat * fat)

close a FAT structure

Parameters
[in]fatpointer to a fat structure

◆ cbmimage_fat_create()

cbmimage_fat * cbmimage_fat_create ( cbmimage_fileimage * image)

create a FAT structure

Parameters
[in]imagepointer to the image data internal settings
Returns
pointer to an initialized fat structure
Remarks

◆ cbmimage_fat_dump()

void cbmimage_fat_dump ( cbmimage_fat * fat,
int trackformat )

dump a FAT structure

Parameters
[in]fatpointer to a fat structure
[in]trackformat
  • if 0, show the FAT as linear following of LBAs.
  • else, show the FAT in the structure that the disk layout defines (track/sector) The value of trackformat defines how many values at most are output into one line

◆ cbmimage_fat_get()

cbmimage_blockaddress cbmimage_fat_get ( cbmimage_fat * fat,
cbmimage_blockaddress block )

get the target of a block in the FAT

Parameters
[in]fatpointer to a fat structure
[in]blockThe address of the block to be examined
Returns
The target to which the block links to
  • If the block is not used, the return will have lba = 0.
  • If the block is used, but there is no target, the return value will have lba = 0xFFu.

◆ cbmimage_fat_is_used()

int cbmimage_fat_is_used ( cbmimage_fat * fat,
cbmimage_blockaddress block )

check if a block in the FAT is marked as used

Parameters
[in]fatpointer to a fat structure
[in]blockThe address of the block to be examined
Returns
  • 0 if the block is not used
  • != 0 if it is marked as used

◆ cbmimage_fat_set()

int cbmimage_fat_set ( cbmimage_fat * fat,
cbmimage_blockaddress block,
cbmimage_blockaddress target )

set a block in the FAT to a target in the FAT

Parameters
[in]fatpointer to a fat structure
[in]blockThe address of the block that is to be marked
[in]targetThe target to which the block links to
Returns
  • 0 if everything is ok
  • != 0 if an error occurred

◆ cbmimage_i_fat_get_target_lba()

int cbmimage_i_fat_get_target_lba ( cbmimage_fat * fat,
cbmimage_blockaddress block )

get the target of a block in the FAT

Parameters
[in]fatpointer to a fat structure
[in]blockThe address of the block to be examined
Returns
The target LBA of the block as written in the FAT.
Note that the special values (cf. remark) can be returned, too.
Remarks
The following special values can be returned:
  • CBMIMAGE_FAT_UNUSED: FAT marks an empty block
  • CBMIMAGE_FAT_LASTBLOCK: This is the last block of a chain

◆ cbmimage_i_fat_set()

int cbmimage_i_fat_set ( cbmimage_fat * fat,
cbmimage_blockaddress block,
uint16_t target_lba )

set a FAT block to a specific LBA target

Parameters
[in]fatpointer to a fat structure
[in]blockThe address of the block that is to be marked
[in]target_lbaThe LBA to which the block links to.
This can also be one of the some special values (cf. remarks)
Returns
  • 0 if everything is ok
  • != 0 if an error occurred
Remarks
For the LBA, there are some special values:
  • CBMIMAGE_FAT_UNUSED: FAT marks an empty block
  • CBMIMAGE_FAT_LASTBLOCK: This is the last block of a chain