struct iso_read_image_features is now allocated by libisofs.

This commit is contained in:
Vreixo Formoso 2008-01-26 15:39:58 +01:00
parent 29058378fd
commit 0ad92fc56d
3 changed files with 25 additions and 17 deletions

View File

@ -32,7 +32,7 @@ int main(int argc, char **argv)
unsigned char buf[32 * 2048];
IsoWriteOpts *opts;
int ret = 0;
struct iso_read_image_features features;
struct iso_read_image_features *features;
uint32_t ms_block;
IsoReadOpts *ropts;
@ -124,10 +124,12 @@ int main(int argc, char **argv)
}
/* round up to 32kb aligment = 16 block */
ms_block = ((features.size + 15) / 16 ) * 16;
ms_block = ((features->size + 15) / 16 ) * 16;
iso_write_opts_set_ms_block(opts, ms_block);
iso_write_opts_set_appendable(opts, 1);
iso_write_opts_set_overwrite_buf(opts, buf);
free(features);
result = iso_image_create_burn_source(image, opts, &burn_src);
if (result < 0) {

View File

@ -2202,7 +2202,7 @@ boot_fs_cleanup: ;
int iso_image_import(IsoImage *image, IsoDataSource *src,
struct iso_read_opts *opts,
struct iso_read_image_features *features)
struct iso_read_image_features **features)
{
int ret;
IsoImageFilesystem *fs;
@ -2346,11 +2346,16 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
iso_image_set_biblio_file_id(image, data->biblio_file_id);
if (features != NULL) {
features->hasJoliet = data->joliet;
features->hasRR = data->rr_version != 0;
features->hasIso1999 = data->iso1999;
features->hasElTorito = data->eltorito;
features->size = data->nblocks;
*features = malloc(sizeof(struct iso_read_image_features));
if (*features == NULL) {
ret = ISO_OUT_OF_MEM;
goto import_cleanup;
}
(*features)->hasJoliet = data->joliet;
(*features)->hasRR = data->rr_version != 0;
(*features)->hasIso1999 = data->iso1999;
(*features)->hasElTorito = data->eltorito;
(*features)->size = data->nblocks;
}
ret = ISO_SUCCESS;

View File

@ -171,6 +171,12 @@ struct iso_data_source {
*/
struct iso_read_image_features
{
/**
* Will be filled with the size (in 2048 byte block) of the image, as
* reported in the PVM.
*/
uint32_t size;
/** It will be set to 1 if RR extensions are present, to 0 if not. */
unsigned int hasRR :1;
@ -185,12 +191,6 @@ struct iso_read_image_features
/** It will be set to 1 if El-Torito boot record is present, to 0 if not.*/
unsigned int hasElTorito :1;
/**
* Will be filled with the size (in 2048 byte block) of the image, as
* reported in the PVM.
*/
uint32_t size;
};
typedef struct iso_file_source IsoFileSource;
@ -946,14 +946,15 @@ int iso_read_opts_set_input_charset(IsoReadOpts *opts, const char *charset);
* @param opts
* Options for image import
* @param features
* Will be filled with the features of the old image. You can pass NULL
* if you're not interested on them.
* If not NULL, a new struct iso_read_image_features will be allocated
* and filled with the features of the old image. It should be freed when
* no more needed. You can pass NULL if you're not interested on them.
* @return
* 1 on success, < 0 on error
*/
int iso_image_import(IsoImage *image, IsoDataSource *src,
IsoReadOpts *opts,
struct iso_read_image_features *features);
struct iso_read_image_features **features);
/**
* Increments the reference counting of the given image.