Counting padding as part of the image with -as mkisofs

This commit is contained in:
Thomas Schmitt 2011-03-02 09:30:10 +00:00
parent 508adfd2f4
commit 65ca294357
5 changed files with 41 additions and 18 deletions

View File

@ -208,6 +208,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->speed= 0;
m->fs= 4*512; /* 4 MiB */
m->padding= 300*1024;
m->do_padding_by_libisofs= 0;
m->alignment= 0;
m->do_stream_recording= 0;
m->dvd_obs= 0;

View File

@ -1850,6 +1850,9 @@ problem_handler_boot:;
was_failure= 1;
}
if(xorriso->no_emul_toc & 1)
xorriso->do_padding_by_libisofs= 1;
if(do_print_size) {
ret= Xorriso_option_print_size(xorriso, 1);
goto ex;

View File

@ -98,7 +98,7 @@ int Xorriso_make_write_options(
/* @param flag bit0= do not write but only prepare and return size in sectors
bit1= do not use isoburn wrappers
bit1= do not use isoburn wrappers, do not assume libisofs
*/
int Xorriso_sanitize_image_size(struct XorrisO *xorriso,
struct burn_drive *drive, struct burn_disc *disc,
@ -148,7 +148,6 @@ no_track:;
sessions survive and confuse -rom_toc_scan.
*/
xorriso->alignment= 32;
s= isoburn_disc_get_status(drive);
if(s == BURN_DISC_BLANK) {
/* Count blocks before nwa as part of the image */;
@ -159,6 +158,19 @@ no_track:;
}
}
}
if(!(flag & 2)) {
#ifdef Xorriso_with_libjtE
/* JTE : no multi-session, no_emul_toc, padding in libisofs */
if(xorriso->libjte_handle != NULL)
padding= 0;
#endif /* ! Xorriso_with_libjtE */
if(xorriso->do_padding_by_libisofs)
padding= 0;
}
if(xorriso->alignment > 0) {
if(img_sectors > 0) {
ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &lba, &nwa);
@ -167,14 +179,8 @@ no_track:;
lba= (nwa + img_sectors + padding) % xorriso->alignment;
if(lba > 0)
padding+= xorriso->alignment - lba;
} else if(padding < xorriso->alignment)
padding= xorriso->alignment;
}
#ifdef Xorriso_with_libjtE
if(xorriso->libjte_handle != NULL)
padding= 0; /* JTE : no multi-session, no_emul_toc, padding in libisofs */
#endif /* ! Xorriso_with_libjtE */
}
burn_track_define_data(tracks[0], 0, padding * 2048, 0, BURN_MODE1);
Xorriso_process_msg_queues(xorriso,0);
@ -548,7 +554,7 @@ ex:;
int Xorriso_write_session(struct XorrisO *xorriso, int flag)
{
int ret, relax= 0, i, pacifier_speed= 0, data_lba, ext, is_bootable= 0;
int freshly_bootable= 0, hide_attr;
int freshly_bootable= 0, hide_attr, pad_by_libisofs= 0;
char xorriso_id[256], *img_id, sfe[5*SfileadrL], *out_cs, *part_image;
struct isoburn_imgen_opts *sopts= NULL;
struct burn_drive_info *dinfo, *source_dinfo;
@ -565,6 +571,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
int profile_number;
char profile_name[80];
IsoBoot *bootcat_node;
uint32_t padding;
ret= Xorriso_finish_hl_update(xorriso, 0);
if(ret <= 0)
@ -809,12 +816,22 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
if(ret <= 0)
goto ex;
isoburn_igopt_attach_jte(sopts, xorriso->libjte_handle);
/* Padding to be done by libisofs, not by libburn */
isoburn_igopt_set_tail_blocks(sopts, (uint32_t) (xorriso->padding / 2048));
pad_by_libisofs= 1;
}
#endif /* Xorriso_with_libjtE */
if(xorriso->do_padding_by_libisofs || pad_by_libisofs) {
/* Padding to be done by libisofs, not by libburn.
*/
padding= xorriso->padding / 2048;
if(xorriso->padding > padding * 2048)
padding++;
/*
fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n",
(int) padding);
*/
isoburn_igopt_set_tail_blocks(sopts, padding / 2048);
}
/* Make final abort check before starting expensive activities */
ret= Xorriso_eval_problem_status(xorriso, 1, 0);
@ -2159,7 +2176,6 @@ int Xorriso_set_isolinux_options(struct XorrisO *xorriso,
if(make_isohybrid_mbr) {
sprintf(xorriso->info_text, "Will write isohybrid MBR.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
xorriso->alignment= 512;
}
ret= el_torito_set_isolinux_options(bootimg,
patch_table | (make_isohybrid_mbr << 1),0);

View File

@ -295,10 +295,13 @@ struct XorrisO { /* the global context of xorriso */
int speed; /* in libburn units : 1000 bytes/second , 0 = Max, -1 = Min */
int fs; /* fifo size in 2048 byte chunks : at most 1 GB */
int padding; /* number of bytes to add after ISO 9660 image */
int do_padding_by_libisofs; /* 0= by libburn , 1= by libisofs */
int alignment; /* if > 0 : image size alignment in 2048 byt blocks */
/* <<< not sure whether to keep this after libisofs will have
learned to pad up MBR images to full MB */
int alignment; /* if > 0 : output size alignment in 2048 byte blocks.
This is always done by libburn, i.e. attached
outside the image. Eventual inner alignment of
the image end happens first.
*/
int do_stream_recording; /* 0=no, 1=yes, 2=for data, not for dir
>=16 means yes with number as start LBA */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.03.01.152159"
#define Xorriso_timestamP "2011.03.02.093009"