cbmimage
Loading...
Searching...
No Matches
Chain following functions

Classes

struct  cbmimage_chain_s
 type to describe a chain that is followed More...
 

Typedefs

typedef struct cbmimage_chain_s cbmimage_chain
 type to describe a chain that is followed
 

Functions

static int cbmimage_i_chain_readblock (cbmimage_chain *chain, cbmimage_blockaddress block)
 
cbmimage_chaincbmimage_chain_start (cbmimage_fileimage *image, cbmimage_blockaddress block_start)
 start the chain processing for a file chain
 
void cbmimage_chain_close (cbmimage_chain *chain)
 close the chain structure
 
int cbmimage_chain_advance (cbmimage_chain *chain)
 advance to the next block of this chain
 
int cbmimage_chain_last_result (cbmimage_chain *chain)
 check if this chain has been processed competely
 
int cbmimage_chain_is_done (cbmimage_chain *chain)
 check if this chain has been processed competely
 
int cbmimage_chain_is_loop (cbmimage_chain *chain)
 check if this chain has fallen into a loop
 
cbmimage_blockaddress cbmimage_chain_get_current (cbmimage_chain *chain)
 get the address of the current block in this chain
 
cbmimage_blockaddress cbmimage_chain_get_next (cbmimage_chain *chain)
 get the address of the next block in this chain
 
uint8_t * cbmimage_chain_get_data (cbmimage_chain *chain)
 get a pointer to the data of the current block in this chain
 

Detailed Description

Function Documentation

◆ cbmimage_chain_advance()

int cbmimage_chain_advance ( cbmimage_chain * chain)

advance to the next block of this chain

Parameters
[in]chainchain structure which contains all relevant info
Returns
  • 0 if the block is available and full (that is, it contains another link, so all byte are relevant)
  • > 0: this is the last block, the return gives the number of valid byte in this block. For example, if the link of this last block is (0,x), it will return the value x.
  • -1 if an error occurred
Remarks
If this is already the last block, then the return value is the same as with the last call to cbmimage_chain_advance() or cbmimage_chain_start(), and nothing is done at all.

◆ cbmimage_chain_close()

void cbmimage_chain_close ( cbmimage_chain * chain)

close the chain structure

Parameters
[in]chainchain structure which contains all relevant info
Remarks

◆ cbmimage_chain_get_current()

cbmimage_blockaddress cbmimage_chain_get_current ( cbmimage_chain * chain)

get the address of the current block in this chain

Parameters
[in]chainchain structure which contains all relevant info
Returns
the block address of the current block in this chain.

◆ cbmimage_chain_get_data()

uint8_t * cbmimage_chain_get_data ( cbmimage_chain * chain)

get a pointer to the data of the current block in this chain

Parameters
[in]chainchain structure which contains all relevant info
Returns
pointer to the data of this block

◆ cbmimage_chain_get_next()

cbmimage_blockaddress cbmimage_chain_get_next ( cbmimage_chain * chain)

get the address of the next block in this chain

Parameters
[in]chainchain structure which contains all relevant info
Returns
the block address of the current block in this chain. If there is no next block, then the block has lba = 0.

◆ cbmimage_chain_is_done()

int cbmimage_chain_is_done ( cbmimage_chain * chain)

check if this chain has been processed competely

Parameters
[in]chainchain structure which contains all relevant info
Returns
  • 1 if all blocks of the the chain have already been read
  • 0 otherwise

◆ cbmimage_chain_is_loop()

int cbmimage_chain_is_loop ( cbmimage_chain * chain)

check if this chain has fallen into a loop

Parameters
[in]chainchain structure which contains all relevant info
Returns
  • 1 if the chain has fallen into a loop
  • 0 otherwise

◆ cbmimage_chain_last_result()

int cbmimage_chain_last_result ( cbmimage_chain * chain)

check if this chain has been processed competely

Parameters
[in]chainchain structure which contains all relevant info
Returns
1 if all blocks have been read already.

◆ cbmimage_chain_start()

cbmimage_chain * cbmimage_chain_start ( cbmimage_fileimage * image,
cbmimage_blockaddress block_start )

start the chain processing for a file chain

Parameters
[in]imagepointer to the image data
[in]block_startthe starting block, that is, where this chain processing should start
Returns
chain chain structure which contains all relevant info
Remarks

◆ cbmimage_i_chain_readblock()

static int cbmimage_i_chain_readblock ( cbmimage_chain * chain,
cbmimage_blockaddress block )
static

read the current block of this chain

Parameters
[in]chainchain structure which contains all relevant info
[in]blockthe block that is to be read
Returns
  • 0 if the block is available and full (that is, it contains another link, so all byte are relevant)
  • > 0: this is the last block, the return gives the number of valid byte in this block. For example, if the link of this last block is (0,x), it will return the value x.
  • -1 if an error occurred