New API calls isoburn_ropt_set_data_cache(), isoburn_ropt_get_data_cache()
This commit is contained in:
@@ -776,6 +776,8 @@ int isoburn_ropt_new(struct isoburn_read_opts **new_o, int flag)
|
||||
"Cannot allocate memory for read options", 0, "FATAL", 0);
|
||||
return(-1);
|
||||
}
|
||||
o->cache_tiles= Libisoburn_default_cache_tileS;
|
||||
o->cache_tile_blocks= Libisoburn_default_tile_blockS;
|
||||
o->norock= 0;
|
||||
o->nojoliet= 0;
|
||||
o->noiso1999= 1;
|
||||
@@ -812,6 +814,59 @@ int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag)
|
||||
}
|
||||
|
||||
|
||||
int isoburn_ropt_set_data_cache(struct isoburn_read_opts *o,
|
||||
int cache_tiles, int tile_blocks, int flag)
|
||||
{
|
||||
int i;
|
||||
char msg[80];
|
||||
|
||||
if(cache_tiles < 1) {
|
||||
isoburn_msgs_submit(NULL, 0x00060000,
|
||||
"Requested number of data cache tiles is too small (< 1)",
|
||||
0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
if(((double) cache_tiles) * ((double) tile_blocks)
|
||||
> (double) Libisoburn_cache_max_sizE) {
|
||||
sprintf(msg, "Requested size of data cache exceeds limit of %.f blocks",
|
||||
(double) Libisoburn_cache_max_sizE);
|
||||
isoburn_msgs_submit(NULL, 0x00060000, msg, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
for(i = 1; i <= Libisoburn_cache_max_sizE; i = i << 1)
|
||||
if(i == tile_blocks)
|
||||
break;
|
||||
if(i > Libisoburn_cache_max_sizE) {
|
||||
isoburn_msgs_submit(NULL, 0x00060000,
|
||||
"Requested number of blocks per data cache tiles is not a power of 2",
|
||||
0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
if(o != NULL) {
|
||||
o->cache_tiles= cache_tiles;
|
||||
o->cache_tile_blocks= tile_blocks;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_ropt_get_data_cache(struct isoburn_read_opts *o,
|
||||
int *cache_tiles, int *tile_blocks,
|
||||
int *set_flag, int flag)
|
||||
{
|
||||
if((flag & 1) || o == NULL) {
|
||||
*cache_tiles= Libisoburn_default_cache_tileS;
|
||||
*tile_blocks= Libisoburn_default_tile_blockS;
|
||||
*set_flag= 0;
|
||||
return(1);
|
||||
}
|
||||
*cache_tiles= o->cache_tiles;
|
||||
*tile_blocks= o->cache_tile_blocks;
|
||||
*set_flag= 0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext)
|
||||
{
|
||||
o->norock= !!(ext&1);
|
||||
|
Reference in New Issue
Block a user