cbmimage
Loading...
Searching...
No Matches
internal.h File Reference

cbmimage internals More...

#include "cbmimage.h"
Include dependency graph for internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cbmimage_i_dir_entry_internal_s
 internal data for directory entry More...
 
struct  cbmimage_i_bam_selector_s
 BAM Selector . More...
 
struct  cbmimage_fileimage_functions_s
 BAM counter selector . More...
 
struct  cbmimage_i_d40_d64_d71_image_settings_s
 Image specific settings for D40, D64 and D71 images . More...
 
struct  cbmimage_i_d81_image_settings_s
 Image specific settings for D81 images . More...
 
struct  cbmimage_i_d80_d82_image_settings_s
 Image specific settings for D80 and D82 images . More...
 
struct  cbmimage_i_d1m_d2m_d4m_image_settings_s
 Image specific settings for CMD D1M, D2M and D4M images . More...
 
struct  cbmimage_i_dnp_image_settings_s
 Image specific settings for CMD DNP images . More...
 
struct  cbmimage_image_settings_s
 Image specific settings for all types of images . More...
 
struct  cbmimage_image_parameter_s
 Parameter of the image . More...
 

Macros

#define CBMIMAGE_I_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector, _reverse_order)
 
#define CBMIMAGE_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector)
 
#define CBMIMAGE_BAM_SELECTOR_INIT_REVERSE(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector)
 
#define CBMIMAGE_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector)
 
#define CBMIMAGE_BAM_COUNTER_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _track, _sector)
 
#define CBMIMAGE_BAM_AND_BAM_COUNTER_CREATE(_basename, _index, _starttrack, _startoffset, _multiplier, _data_count, _track, _sector)
 
#define cbmimage_i_init_bam_counter_selector(_settings, _selector, _selector_count)
 init a BAM Counter selector
 

Typedefs

typedef struct cbmimage_i_dir_entry_internal_s cbmimage_i_dir_entry_internal
 internal data for directory entry
 
typedef struct cbmimage_image_settings_s cbmimage_image_settings
 Image specific settings for all types of images .
 
typedef uint16_t cbmimage_get_sectors_in_track_fct(cbmimage_image_settings *settings, uint16_t track)
 
typedef int cbmimage_ts_to_blockaddress_fct(cbmimage_image_settings *settings, cbmimage_blockaddress *block)
 
typedef int cbmimage_lba_to_blockaddress_fct(cbmimage_image_settings *settings, cbmimage_blockaddress *block)
 
typedef int cbmimage_chdir_fct(cbmimage_image_settings *settings, cbmimage_dir_entry *dir_entry)
 
typedef int cbmimage_set_bam_fct(cbmimage_image_settings *settings)
 
typedef struct cbmimage_i_bam_selector_s cbmimage_i_bam_selector
 BAM Selector .
 
typedef cbmimage_i_bam_selector cbmimage_i_bam_counter_selector
 BAM counter selector .
 
typedef struct cbmimage_fileimage_functions_s cbmimage_fileimage_functions
 BAM counter selector .
 
typedef struct cbmimage_i_d40_d64_d71_image_settings_s cbmimage_i_d40_d64_d71_image_settings
 Image specific settings for D40, D64 and D71 images .
 
typedef struct cbmimage_i_d81_image_settings_s cbmimage_i_d81_image_settings
 Image specific settings for D81 images .
 
typedef struct cbmimage_i_d80_d82_image_settings_s cbmimage_i_d80_d82_image_settings
 Image specific settings for D80 and D82 images .
 
typedef struct cbmimage_i_d1m_d2m_d4m_image_settings_s cbmimage_i_d1m_d2m_d4m_image_settings
 Image specific settings for CMD D1M, D2M and D4M images .
 
typedef struct cbmimage_i_dnp_image_settings_s cbmimage_i_dnp_image_settings
 Image specific settings for CMD DNP images .
 
typedef struct cbmimage_image_parameter_s cbmimage_image_parameter
 Parameter of the image .
 

Functions

void cbmimage_i_d40_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d64_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d64_40track_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d64_40track_speeddos_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d64_40track_dolphin_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d64_40track_prologic_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d64_42track_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d71_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d81_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d80_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d82_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d1m_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d2m_image_open (cbmimage_fileimage *image)
 
void cbmimage_i_d4m_image_open (cbmimage_fileimage *image)
 
uint8_t * cbmimage_i_get_address_of_block (cbmimage_fileimage *image, cbmimage_blockaddress block)
 
void cbmimage_i_init_bam_selector (cbmimage_image_settings *settings, cbmimage_i_bam_selector *selector, size_t selector_count)
 
void cbmimage_i_create_last_block (cbmimage_fileimage *image)
 
void cbmimage_i_print (const char *text)
 
void cbmimage_i_fmt_print (const char *fmt,...)
 
cbmimage_dir_entrycbmimage_i_dir_get_clone (cbmimage_dir_entry *dir_entry)
 clone a directory entry
 
int cbmimage_i_bam_check_really_unused (cbmimage_image_settings *settings, cbmimage_blockaddress block)
 
int cbmimage_i_dir_get_partition_data (cbmimage_dir_entry *dir_entry, cbmimage_blockaddress *block_first, cbmimage_blockaddress *block_last, size_t *block_count)
 
int cbmimage_i_blockaccessor_release (cbmimage_blockaccessor *accessor)
 
int cbmimage_i_dir_set_subpartition_global (cbmimage_image_settings *settings, cbmimage_blockaddress block_subdir_first, size_t block_count)
 
int cbmimage_i_dir_set_subpartition_relative (cbmimage_image_settings *settings, cbmimage_blockaddress block_subdir_first, cbmimage_blockaddress block_subdir_last)
 
int cbmimage_i_dnp_chdir_partition_init (cbmimage_image_settings *settings)
 
int cbmimage_i_d64_chdir_partition_init (cbmimage_image_settings *settings)
 
int cbmimage_i_d71_chdir_partition_init (cbmimage_image_settings *settings)
 
int cbmimage_i_d81_chdir_partition_init (cbmimage_image_settings *settings)
 
int cbmimage_i_validate_1581_partition (cbmimage_fileimage *image, cbmimage_blockaddress block_start, int count)
 

Detailed Description

cbmimage internals


Author
Spiro Trikaliotis

Macro Definition Documentation

◆ CBMIMAGE_BAM_AND_BAM_COUNTER_CREATE

#define CBMIMAGE_BAM_AND_BAM_COUNTER_CREATE ( _basename,
_index,
_starttrack,
_startoffset,
_multiplier,
_data_count,
_track,
_sector )
Value:
_basename.bam[_index] = CBMIMAGE_BAM_SELECTOR_INIT( _starttrack, _startoffset + 1, _multiplier, _data_count, _track, _sector), \
_basename.bam_counter[_index] = CBMIMAGE_BAM_COUNTER_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _track, _sector)
#define CBMIMAGE_BAM_COUNTER_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _track, _sector)
Definition internal.h:411
#define CBMIMAGE_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector)
Definition internal.h:310

initialize two cbmimage_i_bam_selector, one for the BAM and one for the BAM counter entry

This macro assumes a special outline of the data.
Essentially, in _basename, there must be both a .bam[] and a .bam_counter[] array, and they must be indexed in the same way. That is, .bam[x] and .bam_counter[x] must correspond to each other.

In this case, this macro creates both the BAM selector and the BAM_COUNTER selector

Parameters
[in]_basenameThe name of the variable which holds a .bam[] and a .bam_counter[] array
[in]_indexThe index into the .bam[] and .bam_counter[] arrays which will be set
[in]_starttrackthe number of the first track which is described in this BAM selector
[in]_startoffsetthe offset inside of the block where this BAM entry is located. Note the remark below on the assumed outline.
[in]_multipliermultiplier for the BAM entries; that is, how many byte are the different tracks aways from each other?
[in]_data_countthe number of byte that form one BAM entry. This is restricted to a maximum of BAM_MASK_COUNT. In case of a cbmimage_i_bam_counter_selector, this must be 0.
[in]_trackthe track where this BAM is located
[in]_sectorthe sector where this BAM is located
Remarks
This macro can only used if the BAM has the regular outline.
That is, at _startoffset, there is the number of free blocks on this track, and at _startoffset + 1, the bitmap starts.
If the BAM does not look that way, use CBMIMAGE_BAM__SELECTOR_INIT() and CBMIMAGE_BAM_COUNTER_SELECTOR_INIT() instead!

◆ CBMIMAGE_BAM_COUNTER_SELECTOR_INIT

#define CBMIMAGE_BAM_COUNTER_SELECTOR_INIT ( _starttrack,
_startoffset,
_multiplier,
_track,
_sector )
Value:
CBMIMAGE_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, 0, _track, _sector)

initializer for a cbmimage_i_bam_selector, used as a BAM counter entry

This macro can be used like
cbmimage_i_bam_selector selector = CBMIMAGE_BAM_COUNTER_SELECTOR_INIT(starttrack, startoffset, multiplier, track, sector)
in order to initialize the selector

Parameters
[in]_starttrackthe number of the first track which is described in this BAM selector
[in]_startoffsetthe offset inside of the block where this BAM entry is located
[in]_multipliermultiplier for the BAM entries; that is, how many byte are the different tracks aways from each other?
[in]_trackthe track where this BAM is located
[in]_sectorthe sector where this BAM is located
Remarks
This macro is only used if the BAM does not have the regular outline.
Regularly, the BAM looks as follows: [number of free blocks on this track] [bitmap for this track]

If the BAM looks that way, use CBMIMAGE_BAM_AND_BAM_COUNTER_CREATE() instead!

◆ CBMIMAGE_BAM_SELECTOR_INIT [1/2]

#define CBMIMAGE_BAM_SELECTOR_INIT ( _starttrack,
_startoffset,
_multiplier,
_data_count,
_track,
_sector )
Value:
CBMIMAGE_I_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector, 0)
#define CBMIMAGE_I_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector, _reverse_order)
Definition internal.h:275

initializer for a cbmimage_i_bam_selector, used as a BAM entry

This macro can be used like
cbmimage_i_bam_selector selector = CBMIMAGE_BAM_SELECTOR_INIT(starttrack, startoffset, multiplier, data_count, track, sector)
in order to initialize the selector

Parameters
[in]_starttrackthe number of the first track which is described in this BAM selector
[in]_startoffsetthe offset inside of the block where this BAM entry is located
[in]_multipliermultiplier for the BAM entries; that is, how many byte are the different tracks aways from each other?
[in]_data_countthe number of byte that form one BAM entry. This is restricted to a maximum of BAM_MASK_COUNT. In case of a cbmimage_i_bam_counter_selector, this must be 0.
[in]_trackthe track where this BAM is located
[in]_sectorthe sector where this BAM is located
Remarks
This macro is only used if the BAM does not have the regular outline.
Regularly, the BAM looks as follows: [number of free blocks on this track] [bitmap for this track]

If the BAM looks that way, use CBMIMAGE_BAM_AND_BAM_COUNTER_CREATE() instead!

◆ CBMIMAGE_BAM_SELECTOR_INIT [2/2]

#define CBMIMAGE_BAM_SELECTOR_INIT ( _starttrack,
_startoffset,
_multiplier,
_data_count,
_track,
_sector )
Value:
CBMIMAGE_I_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector, 0)

initializer for a cbmimage_i_bam_selector, used as a BAM entry

This macro can be used like
cbmimage_i_bam_selector selector = CBMIMAGE_BAM_SELECTOR_INIT(starttrack, startoffset, multiplier, data_count, track, sector)
in order to initialize the selector

Parameters
[in]_starttrackthe number of the first track which is described in this BAM selector
[in]_startoffsetthe offset inside of the block where this BAM entry is located
[in]_multipliermultiplier for the BAM entries; that is, how many byte are the different tracks aways from each other?
[in]_data_countthe number of byte that form one BAM entry. This is restricted to a maximum of BAM_MASK_COUNT. In case of a cbmimage_i_bam_counter_selector, this must be 0.
[in]_trackthe track where this BAM is located
[in]_sectorthe sector where this BAM is located
Remarks
This macro is only used if the BAM does not have the regular outline.
Regularly, the BAM looks as follows: [number of free blocks on this track] [bitmap for this track]

If the BAM looks that way, use CBMIMAGE_BAM_AND_BAM_COUNTER_CREATE() instead!

◆ CBMIMAGE_BAM_SELECTOR_INIT_REVERSE

#define CBMIMAGE_BAM_SELECTOR_INIT_REVERSE ( _starttrack,
_startoffset,
_multiplier,
_data_count,
_track,
_sector )
Value:
CBMIMAGE_I_BAM_SELECTOR_INIT(_starttrack, _startoffset, _multiplier, _data_count, _track, _sector, 1)

initializer for a cbmimage_i_bam_selector, used as a BAM entry, for reverse order BAMs

This macro can be used like
cbmimage_i_bam_selector selector = CBMIMAGE_BAM_SELECTOR_INIT_REVERSE(starttrack, startoffset, multiplier, data_count, track, sector)
in order to initialize the selector

Parameters
[in]_starttrackthe number of the first track which is described in this BAM selector
[in]_startoffsetthe offset inside of the block where this BAM entry is located
[in]_multipliermultiplier for the BAM entries; that is, how many byte are the different tracks aways from each other?
[in]_data_countthe number of byte that form one BAM entry. This is restricted to a maximum of BAM_MASK_COUNT. In case of a cbmimage_i_bam_counter_selector, this must be 0.
[in]_trackthe track where this BAM is located
[in]_sectorthe sector where this BAM is located
Remarks
This macro is only used if the BAM does not have the regular outline.
Regularly, the BAM looks as follows: [number of free blocks on this track] [bitmap for this track]

If the BAM looks that way, use CBMIMAGE_BAM_AND_BAM_COUNTER_CREATE() instead!

◆ CBMIMAGE_I_BAM_SELECTOR_INIT

#define CBMIMAGE_I_BAM_SELECTOR_INIT ( _starttrack,
_startoffset,
_multiplier,
_data_count,
_track,
_sector,
_reverse_order )
Value:
{ .starttrack = _starttrack, .startoffset = _startoffset, .multiplier = _multiplier, .data_count = _data_count, .reverse_order = _reverse_order, .block = CBMIMAGE_BLOCK_INIT_FROM_TS(_track, _sector) }
#define CBMIMAGE_BLOCK_INIT_FROM_TS(_track, _sector)
initializer for a cbmimage_blockaddress
Definition cbmimage.h:146

initializer for a cbmimage_i_bam_selector, used as a BAM entry

This macro can be used like
cbmimage_i_bam_selector selector = CBMIMAGE_BAM_SELECTOR_INIT(starttrack, startoffset, multiplier, data_count, track, sector)
in order to initialize the selector

Parameters
[in]_starttrackthe number of the first track which is described in this BAM selector
[in]_startoffsetthe offset inside of the block where this BAM entry is located
[in]_multipliermultiplier for the BAM entries; that is, how many byte are the different tracks aways from each other?
[in]_data_countthe number of byte that form one BAM entry. This is restricted to a maximum of BAM_MASK_COUNT. In case of a cbmimage_i_bam_counter_selector, this must be 0.
[in]_trackthe track where this BAM is located
[in]_sectorthe sector where this BAM is located
[in]_reverse_orderset to != 0 if the BAM uses the reverse (a.k.a. CMD or DNP) ordering.
Remarks
This macro is only used if the BAM does not have the regular outline.
Regularly, the BAM looks as follows: [number of free blocks on this track] [bitmap for this track]

If the BAM looks that way, use CBMIMAGE_BAM_AND_BAM_COUNTER_CREATE() instead!

◆ cbmimage_i_init_bam_counter_selector

#define cbmimage_i_init_bam_counter_selector ( _settings,
_selector,
_selector_count )
Value:
cbmimage_i_init_bam_selector(_settings, _selector, _selector_count)
void cbmimage_i_init_bam_selector(cbmimage_image_settings *settings, cbmimage_i_bam_selector *selector, size_t selector_count)
Definition bam.c:107

init a BAM Counter selector

As a BAM counter selector (cbmimage_i_bam_counter_selector, cbmimage_i_bam_counter_selector_s) is the same type as a BAM selector (cbmimage_i_bam_selector, cbmimage_i_bam_selector_s) but used differently, just use the same function to initialize it. Thus, a macro does the job

Parameters
[in]_settingspointer to the fileimage settings
[in,out]_selectorpointer to an array of selectors to initialize
[in]_selector_countthe number of selectors in the array _selector
Remarks
if there is only one selector, use a _selector_count of 1.