Ended the special out-of-loop handling of eltorito_writer_compute_data_blocks()

This commit is contained in:
Thomas Schmitt 2012-06-19 16:49:03 +02:00
parent 2d3bbe51ed
commit 27277914c6
3 changed files with 21 additions and 28 deletions

View File

@ -2184,10 +2184,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
for (i = 0; i < (int) target->nwriters; ++i) { for (i = 0; i < (int) target->nwriters; ++i) {
IsoImageWriter *writer = target->writers[i]; IsoImageWriter *writer = target->writers[i];
/* Delaying boot image patching until new LBA is known */
if (i == el_torito_writer_index)
continue;
/* Exposing address of data start to IsoWriteOpts and memorizing /* Exposing address of data start to IsoWriteOpts and memorizing
this address for all files which have no block address: this address for all files which have no block address:
symbolic links, device files, empty data files. symbolic links, device files, empty data files.
@ -2206,14 +2202,9 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
} }
} }
/* Now perform delayed image patching and System Area preparations */ ret = iso_patch_eltoritos(target);
if (el_torito_writer_index >= 0) { if (ret < 0)
IsoImageWriter *writer = target->writers[el_torito_writer_index]; goto target_cleanup;
ret = writer->compute_data_blocks(writer);
if (ret < 0) {
goto target_cleanup;
}
}
if (((target->system_area_options & 0xfc) >> 2) == 2) { if (((target->system_area_options & 0xfc) >> 2) == 2) {
ret = iso_read_mipsel_elf(target, 0); ret = iso_read_mipsel_elf(target, 0);
if (ret < 0) if (ret < 0)

View File

@ -1102,7 +1102,8 @@ int make_boot_info_table(uint8_t *buf, uint32_t pvd_lba,
* 1 on success, 0 error (but continue), < 0 error * 1 on success, 0 error (but continue), < 0 error
*/ */
static static
int patch_boot_image(uint8_t *buf, Ecma119Image *t, size_t imgsize, int idx) int patch_boot_info_table(uint8_t *buf, Ecma119Image *t,
size_t imgsize, int idx)
{ {
int ret; int ret;
@ -1116,27 +1117,15 @@ int patch_boot_image(uint8_t *buf, Ecma119Image *t, size_t imgsize, int idx)
return ret; return ret;
} }
static /* Patch the boot images if indicated */
int eltorito_writer_compute_data_blocks(IsoImageWriter *writer) int iso_patch_eltoritos(Ecma119Image *t)
{ {
/*
* We have nothing to write, but if we need to patch an isolinux image,
* this is a good place to do so.
*/
Ecma119Image *t;
int ret, idx; int ret, idx;
size_t size; size_t size;
uint8_t *buf; uint8_t *buf;
IsoStream *new = NULL; IsoStream *new = NULL;
IsoStream *original = NULL; IsoStream *original = NULL;
if (writer == NULL) {
return ISO_NULL_POINTER;
}
t = writer->target;
/* Patch the boot image info tables if indicated */
for (idx = 0; idx < t->catalog->num_bootimages; idx++) { for (idx = 0; idx < t->catalog->num_bootimages; idx++) {
if (!(t->catalog->bootimages[idx]->isolinux_options & 0x01)) if (!(t->catalog->bootimages[idx]->isolinux_options & 0x01))
continue; continue;
@ -1162,7 +1151,7 @@ int eltorito_writer_compute_data_blocks(IsoImageWriter *writer)
} }
/* ok, patch the read buffer */ /* ok, patch the read buffer */
ret = patch_boot_image(buf, t, size, idx); ret = patch_boot_info_table(buf, t, size, idx);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
@ -1179,6 +1168,16 @@ int eltorito_writer_compute_data_blocks(IsoImageWriter *writer)
return ISO_SUCCESS; return ISO_SUCCESS;
} }
static
int eltorito_writer_compute_data_blocks(IsoImageWriter *writer)
{
/*
* We have nothing to write.
*/
return ISO_SUCCESS;
}
/** /**
* Write the Boot Record Volume Descriptor (ECMA-119, 8.2) * Write the Boot Record Volume Descriptor (ECMA-119, 8.2)
*/ */

View File

@ -151,5 +151,8 @@ int eltorito_writer_create(Ecma119Image *target);
int make_boot_info_table(uint8_t *buf, uint32_t pvd_lba, int make_boot_info_table(uint8_t *buf, uint32_t pvd_lba,
uint32_t boot_lba, uint32_t imgsize); uint32_t boot_lba, uint32_t imgsize);
/* Patch the boot images if indicated.
*/
int iso_patch_eltoritos(Ecma119Image *t);
#endif /* LIBISO_ELTORITO_H */ #endif /* LIBISO_ELTORITO_H */