"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/drive_mgt.c" between
libisoburn-1.5.0.tar.gz and libisoburn-1.5.2.tar.gz

About: libisoburn is a frontend for the libraries libburn and libisofs which enables creation and expansion of ISO-9660 filesystems on all media and file types supported by libburn. It implements the API and command interpreter of program xorriso, and installs this program as small dynamically linked binary. xorriso is suitable for incremental data backup and for production of bootable ISO 9660 images. A statically linked version is available as GNU xorriso.

drive_mgt.c  (libisoburn-1.5.0):drive_mgt.c  (libisoburn-1.5.2)
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2017 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2019 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
This file contains functions which operate on drives and media. This file contains functions which operate on drives and media.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
skipping to change at line 274 skipping to change at line 274
} }
} }
if(flag & 128) { if(flag & 128) {
if(flag & 1) if(flag & 1)
Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive, "", 16); Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive, "", 16);
if(flag & 2) if(flag & 2)
Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive, "", 2 | 16); Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive, "", 2 | 16);
if(in_dinfo != NULL && (out_dinfo == NULL || out_dinfo == in_dinfo)) { if(in_dinfo != NULL && (out_dinfo == NULL || out_dinfo == in_dinfo)) {
dinfo= in_dinfo; dinfo= in_dinfo;
if(flag & 2) if(flag & 2) {
xorriso->outdev_is_exclusive= xorriso->indev_is_exclusive; xorriso->outdev_is_exclusive= xorriso->indev_is_exclusive;
xorriso->outdev_access= xorriso->indev_access;
}
} else if(out_dinfo != NULL && in_dinfo == NULL) { } else if(out_dinfo != NULL && in_dinfo == NULL) {
dinfo= out_dinfo; dinfo= out_dinfo;
if(flag & 1) if(flag & 1) {
xorriso->indev_is_exclusive= xorriso->outdev_is_exclusive; xorriso->indev_is_exclusive= xorriso->outdev_is_exclusive;
xorriso->indev_access= xorriso->outdev_access;
}
} else if(out_dinfo != NULL || in_dinfo != NULL) { } else if(out_dinfo != NULL || in_dinfo != NULL) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Two different drives shall be re-assed in one call"); "Two different drives shall be re-assed in one call");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
{ret= 0; goto ex;} {ret= 0; goto ex;}
} else { } else {
sprintf(xorriso->info_text, "No drive acquired on re-assessment"); sprintf(xorriso->info_text, "No drive acquired on re-assessment");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
} else if((flag&3)==1 && xorriso->out_drive_handle!=NULL) { } else if((flag&3)==1 && xorriso->out_drive_handle!=NULL) {
ret= Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive, ret= Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive,
"on attempt to compare new indev with outdev", 2); "on attempt to compare new indev with outdev", 2);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
ret= burn_drive_equals_adr(out_drive, libburn_adr, 1); ret= burn_drive_equals_adr(out_drive, libburn_adr, 1);
if(ret==1) { if(ret==1) {
dinfo= out_dinfo; dinfo= out_dinfo;
xorriso->indev_is_exclusive= xorriso->outdev_is_exclusive; xorriso->indev_is_exclusive= xorriso->outdev_is_exclusive;
xorriso->indev_access= xorriso->outdev_access;
} }
} else if((flag&3)==2 && xorriso->in_drive_handle!=NULL) { } else if((flag&3)==2 && xorriso->in_drive_handle!=NULL) {
ret= Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive, ret= Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive,
"on attempt to compare new outdev with indev", 0); "on attempt to compare new outdev with indev", 0);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
ret= burn_drive_equals_adr(in_drive, libburn_adr, 1); ret= burn_drive_equals_adr(in_drive, libburn_adr, 1);
if(ret==1) { if(ret==1) {
dinfo= in_dinfo; dinfo= in_dinfo;
xorriso->outdev_is_exclusive= xorriso->indev_is_exclusive; xorriso->outdev_is_exclusive= xorriso->indev_is_exclusive;
xorriso->outdev_access= xorriso->indev_access;
} }
} }
if(dinfo == NULL || (flag & 128)) { if(dinfo == NULL || (flag & 128)) {
aquire_flag= 1 | ((flag&(8|4))>>1) | ((xorriso->toc_emulation_flag & 3)<<3); aquire_flag= 1 | ((flag&(8|4))>>1) | ((xorriso->toc_emulation_flag & 3)<<3);
if(xorriso->toc_emulation_flag & 4) if(xorriso->toc_emulation_flag & 4)
aquire_flag|= 128; aquire_flag|= 128;
if(xorriso->toc_emulation_flag & 8) if(xorriso->toc_emulation_flag & 8)
aquire_flag|= 512; aquire_flag|= 512;
if(!(xorriso->do_aaip & 1)) if(!(xorriso->do_aaip & 1))
skipping to change at line 355 skipping to change at line 361
state= isoburn_disc_get_status(dinfo[0].drive); state= isoburn_disc_get_status(dinfo[0].drive);
ret= isoburn_get_img_partition_offset(dinfo[0].drive, &offst); ret= isoburn_get_img_partition_offset(dinfo[0].drive, &offst);
if((state == BURN_DISC_APPENDABLE || state == BURN_DISC_FULL) && ret == 1) { if((state == BURN_DISC_APPENDABLE || state == BURN_DISC_FULL) && ret == 1) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"ISO image bears MBR with -boot_image any partition_offset=%lu", "ISO image bears MBR with -boot_image any partition_offset=%lu",
(unsigned long) offst); (unsigned long) offst);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
} }
if(flag&1) if(flag&1)
if(xorriso->image_start_mode&(1<<31)) /* used up setting */ if(xorriso->image_start_mode&(1u<<31)) /* used up setting */
xorriso->image_start_mode= 0; /* no need to perform auto setting */ xorriso->image_start_mode= 0; /* no need to perform auto setting */
if(flag & 1) if(flag & 1) {
xorriso->indev_is_exclusive= xorriso->drives_exclusive; xorriso->indev_is_exclusive= xorriso->drives_exclusive;
if(flag & 2) xorriso->indev_access= xorriso->drives_access;
}
if(flag & 2) {
xorriso->outdev_is_exclusive= xorriso->drives_exclusive; xorriso->outdev_is_exclusive= xorriso->drives_exclusive;
xorriso->outdev_access= xorriso->drives_access;
}
} }
drive= dinfo[0].drive; drive= dinfo[0].drive;
volset= isoburn_get_attached_image(drive); volset= isoburn_get_attached_image(drive);
if(volset != NULL) { if(volset != NULL) {
ret= iso_image_set_truncate_mode(volset, 1, xorriso->file_name_limit); ret= iso_image_set_truncate_mode(volset, 1, xorriso->file_name_limit);
iso_image_unref(volset); iso_image_unref(volset);
volset= NULL; volset= NULL;
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(ret < 0) if(ret < 0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
state= isoburn_disc_get_status(drive); state= isoburn_disc_get_status(drive);
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(flag&1) { if(flag&1) {
if(xorriso->image_start_mode&(1<<31)) /* used up setting */ if(xorriso->image_start_mode&(1u<<31)) /* used up setting */
xorriso->image_start_mode&= ~0xffff; /* perform auto setting */ xorriso->image_start_mode&= ~0xffff; /* perform auto setting */
if((xorriso->image_start_mode&(1<<30))) { /* if enabled at all */ if((xorriso->image_start_mode&(1<<30))) { /* if enabled at all */
adr_pt= xorriso->image_start_value; adr_pt= xorriso->image_start_value;
adr_mode= xorriso->image_start_mode & 0xffff; adr_mode= xorriso->image_start_mode & 0xffff;
if(adr_mode == 4 && strlen(adr_pt) <= 80) { if(adr_mode == 4 && strlen(adr_pt) <= 80) {
/* Convert volid search expression into lba */ /* Convert volid search expression into lba */
params_flag= 0; params_flag= 0;
ret= Xorriso__bourne_to_reg(xorriso->image_start_value, adr_data, 0); ret= Xorriso__bourne_to_reg(xorriso->image_start_value, adr_data, 0);
if(ret == 1) if(ret == 1)
params_flag|= 4; params_flag|= 4;
skipping to change at line 405 skipping to change at line 415
ret= 0; goto ex; ret= 0; goto ex;
} }
sprintf(volid, "%d", lba); sprintf(volid, "%d", lba);
adr_pt= volid; adr_pt= volid;
adr_mode= 3; adr_mode= 3;
} }
ret= isoburn_set_msc1(drive, adr_mode, adr_pt, ret= isoburn_set_msc1(drive, adr_mode, adr_pt,
!!(xorriso->image_start_mode & (1<<16))); !!(xorriso->image_start_mode & (1<<16)));
if(ret<=0) if(ret<=0)
goto ex; goto ex;
if(xorriso->image_start_mode&(1<<31)) if(xorriso->image_start_mode&(1u<<31))
xorriso->image_start_mode= 0; /* disable msc1 setting completely */ xorriso->image_start_mode= 0; /* disable msc1 setting completely */
else else
xorriso->image_start_mode|= (1<<31); /* mark as used up */ xorriso->image_start_mode|= (1u<<31); /* mark as used up */
} }
} }
if(flag&1) { if(flag&1) {
volset= isoburn_get_attached_image(drive); volset= isoburn_get_attached_image(drive);
if(volset != NULL) { /* The image object is already created */ if(volset != NULL) { /* The image object is already created */
iso_image_unref(volset); iso_image_unref(volset);
volset= NULL; volset= NULL;
} }
} }
skipping to change at line 720 skipping to change at line 730
} }
flag|= 3; /* give up in/out drive to eject it */ flag|= 3; /* give up in/out drive to eject it */
} }
if((flag&1) && xorriso->in_drive_handle != NULL) { if((flag&1) && xorriso->in_drive_handle != NULL) {
Xorriso_get_drive_handles(xorriso, &dinfo, &drive, Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to give up drive", 0); "on attempt to give up drive", 0);
if(!in_is_out_too) { if(!in_is_out_too) {
do_eject= !!(flag&4); do_eject= !!(flag&4);
if((flag & 4) && !xorriso->indev_is_exclusive) { if((flag & 4) && xorriso->indev_access == 0) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Will not eject medium in non-exclusively acquired input drive."); "Will not eject medium in readonly acquired input drive.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
do_eject= 0; do_eject= 0;
} }
if(drive!=NULL) if(drive!=NULL)
isoburn_drive_release(drive, do_eject); isoburn_drive_release(drive, do_eject);
if(dinfo!=NULL) if(dinfo!=NULL)
burn_drive_info_free(dinfo); burn_drive_info_free(dinfo);
} }
xorriso->in_drive_handle= NULL; xorriso->in_drive_handle= NULL;
xorriso->indev[0]= 0; xorriso->indev[0]= 0;
skipping to change at line 752 skipping to change at line 762
xorriso->isofs_st_in= 0; xorriso->isofs_st_in= 0;
xorriso->volset_change_pending= 0; xorriso->volset_change_pending= 0;
xorriso->no_volset_present= 0; xorriso->no_volset_present= 0;
xorriso->loaded_boot_bin_lba= 0; xorriso->loaded_boot_bin_lba= 0;
xorriso->loaded_boot_cat_path[0]= 0; xorriso->loaded_boot_cat_path[0]= 0;
xorriso->boot_count= 0; xorriso->boot_count= 0;
in_is_out_too= 0; in_is_out_too= 0;
} }
if((flag&2) && xorriso->out_drive_handle!=NULL) { if((flag&2) && xorriso->out_drive_handle!=NULL) {
do_eject= !!(flag&4); do_eject= !!(flag&4);
if((flag & 4) && !xorriso->outdev_is_exclusive) { if((flag & 4) && xorriso->outdev_access == 0) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Will not eject medium in non-exclusively acquired drive."); "Will not eject medium in readonly acquired drive.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
do_eject= 0; do_eject= 0;
} }
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to give up drive", 2); "on attempt to give up drive", 2);
if(ret >= 0 && !in_is_out_too) { if(ret >= 0 && !in_is_out_too) {
if(drive!=NULL) if(drive!=NULL)
isoburn_drive_release(drive, do_eject); isoburn_drive_release(drive, do_eject);
if(dinfo!=NULL) if(dinfo!=NULL)
burn_drive_info_free(dinfo); burn_drive_info_free(dinfo);
skipping to change at line 787 skipping to change at line 797
Xorriso_toc(xorriso, 1 | 2 | 8); Xorriso_toc(xorriso, 1 | 2 | 8);
} }
} }
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
return(1); return(1);
} }
int Xorriso_may_burn(struct XorrisO *xorriso, int flag) int Xorriso_may_burn(struct XorrisO *xorriso, int flag)
{ {
if(xorriso->outdev_is_exclusive) if(xorriso->outdev_access == 1)
return(1); return(1);
sprintf(xorriso->info_text, "The output drive was not acquired exclusively."); sprintf(xorriso->info_text, "The output drive was acquired readonly.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
sprintf(xorriso->info_text, "A possible remedy is: -osirrox 'o_excl_on'"); sprintf(xorriso->info_text, "Possible remedy: -drive_access \"exclusive:unrestr
if(xorriso->outdev[0]) { icted\".");
strcat(xorriso->info_text," -outdev "); strcat(xorriso->info_text," Then give up and re-acquire the drive.");
Text_shellsafe(xorriso->outdev, xorriso->info_text, 1);
}
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
if(!xorriso->outdev_is_exclusive) {
sprintf(xorriso->info_text, "If you insist in -drive_access \"shared:unrestri
cted\", first read man xorriso about the risks.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
}
return(0); return(0);
} }
/* @param flag bit1=report about output drive rather than input drive /* @param flag bit1=report about output drive rather than input drive
bit2=do not try to read ISO heads bit2=do not try to read ISO heads
*/ */
int Xorriso_toc_to_string(struct XorrisO *xorriso, char **toc_text, int flag) int Xorriso_toc_to_string(struct XorrisO *xorriso, char **toc_text, int flag)
{ {
int ret, stack_handle, toc_ret, l; int ret, stack_handle, toc_ret, l;
struct Xorriso_lsT *results= NULL, *infos= NULL, *lpt; struct Xorriso_lsT *results= NULL, *infos= NULL, *lpt;
skipping to change at line 966 skipping to change at line 977
bit3=report to info channel (else to result channel) bit3=report to info channel (else to result channel)
bit4=do no report failure if no drive acquired bit4=do no report failure if no drive acquired
bit5=only report "Drive current" and "Drive type" bit5=only report "Drive current" and "Drive type"
bit6=report "Media product" with bit0 bit6=report "Media product" with bit0
bit7=only report "Drive current" bit7=only report "Drive current"
*/ */
int Xorriso_toc(struct XorrisO *xorriso, int flag) int Xorriso_toc(struct XorrisO *xorriso, int flag)
{ {
int num_sessions= 0, num_tracks= 0, lba= 0, nwa= -1, ret; int num_sessions= 0, num_tracks= 0, lba= 0, nwa= -1, ret;
int track_count= 0, session_no, track_no, profile_no= -1, track_size; int track_count= 0, session_no, track_no, profile_no= -1, track_size;
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0; int session_size, first_track_start= 0;
int num_session_data, num_session_other;
int num_data= 0, other_data= 0, is_data= 0;
int is_inout_drive= 0, drive_role, status, num_formats, emul_lba; int is_inout_drive= 0, drive_role, status, num_formats, emul_lba;
int not_recognizable= 0, start_lba, end_lba; int not_recognizable= 0, start_lba, end_lba;
int sessions_seen, open_sessions= 0, have_real_open_session= 0; int sessions_seen, open_sessions= 0, have_real_open_session= 0;
char profile_name[80],*respt,*devadr, *typetext= ""; char profile_name[80],*respt,*devadr, *typetext= "";
struct burn_toc_entry toc_entry; struct burn_toc_entry toc_entry;
struct burn_drive_info *dinfo; struct burn_drive_info *dinfo;
struct burn_multi_caps *caps= NULL; struct burn_multi_caps *caps= NULL;
struct burn_drive *drive; struct burn_drive *drive;
enum burn_disc_status s; enum burn_disc_status s;
char mem_text[80], *num_free_text; char mem_text[80], *num_free_text;
skipping to change at line 1011 skipping to change at line 1024
if(flag&2) if(flag&2)
devadr= xorriso->outdev; devadr= xorriso->outdev;
else else
devadr= xorriso->indev; devadr= xorriso->indev;
sprintf(respt, "Drive current: %s '%s'\n", sprintf(respt, "Drive current: %s '%s'\n",
(is_inout_drive ? "-dev" : (flag&2 ? "-outdev" : "-indev")), (is_inout_drive ? "-dev" : (flag&2 ? "-outdev" : "-indev")),
devadr); devadr);
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
if(flag & 128) if(flag & 128)
{ret= 1; goto ex;} {ret= 1; goto ex;}
/* Report -drive_access if non-default or if long form */
respt[0]= 0;
if(flag & 2) {
if(xorriso->outdev_is_exclusive == 0 || xorriso->outdev_access == 0 ||
!(flag & 33)) {
sprintf(respt, "Drive access : %s:%s\n",
xorriso->outdev_is_exclusive ? "exclusive" : "shared",
xorriso->outdev_access == 0 ? "readonly" : "unrestricted");
}
} else {
if(xorriso->indev_is_exclusive == 0 || xorriso->indev_access == 0 ||
!(flag & 33)) {
sprintf(respt, "Drive access : %s:%s\n",
xorriso->indev_is_exclusive ? "exclusive" : "shared",
xorriso->indev_access == 0 ? "readonly" : "unrestricted");
}
}
if(respt[0])
Xorriso_toc_line(xorriso, flag & 8);
sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n", sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n",
dinfo[0].vendor, dinfo[0].product, dinfo[0].revision); dinfo[0].vendor, dinfo[0].product, dinfo[0].revision);
if((flag & 32) || !(flag & 1)) if((flag & 32) || !(flag & 1))
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
if(flag & 32) if(flag & 32)
{ret= 1; goto ex;} {ret= 1; goto ex;}
if(!(flag & 1)) { if(!(flag & 1)) {
burn_drive_get_serial_no(drive, &sno, &sno_len); burn_drive_get_serial_no(drive, &sno, &sno_len);
if(sno_len > 0) { if(sno_len > 0) {
skipping to change at line 1254 skipping to change at line 1286
} else { } else {
num_data_from_format= 1; num_data_from_format= 1;
} }
nwa= lba + size / 2048; nwa= lba + size / 2048;
num_data= nwa - lba; num_data= nwa - lba;
sprintf(respt, "%13s: %3d , %9d , %9ds , \n", sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
typetext, 1, lba, num_data); typetext, 1, lba, num_data);
} }
if(!(flag&1)) if(!(flag&1))
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
last_track_start= lba;
/*
num_payload= num_data= last_track_size= nwa;
*/
num_sessions= 1; num_sessions= 1;
} else { } else {
num_data= 0; num_data= other_data= 0;
sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions); sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions);
open_sessions= isoburn_toc_disc_get_incmpl_sess(disc); open_sessions= isoburn_toc_disc_get_incmpl_sess(disc);
for (session_no= 0; for (session_no= 0;
session_no < num_sessions + open_sessions && session_no < num_sessions + open_sessions &&
!(xorriso->request_to_abort); !(xorriso->request_to_abort);
session_no++) { session_no++) {
num_session_data= num_session_other= 0;
tracks= isoburn_toc_session_get_tracks(sessions[session_no], &num_tracks); tracks= isoburn_toc_session_get_tracks(sessions[session_no], &num_tracks);
if (tracks == NULL || num_tracks <= 0) if (tracks == NULL || num_tracks <= 0)
continue; continue;
if(session_no == num_sessions + open_sessions - 1 && open_sessions > 0) if(session_no == num_sessions + open_sessions - 1 && open_sessions > 0)
have_real_open_session= 1; have_real_open_session= 1;
for(track_no= 0; track_no<num_tracks && !(xorriso->request_to_abort); for(track_no= 0; track_no<num_tracks && !(xorriso->request_to_abort);
track_no++) { track_no++) {
track_count++; track_count++;
is_data= 0; is_data= 0;
isoburn_toc_track_get_entry(tracks[track_no], &toc_entry); isoburn_toc_track_get_entry(tracks[track_no], &toc_entry);
if((toc_entry.control & 7) >= 4) /* data track */
is_data= 1;
if (toc_entry.extensions_valid & 1) { if (toc_entry.extensions_valid & 1) {
/* DVD extension valid */ /* DVD extension valid */
lba= toc_entry.start_lba; lba= toc_entry.start_lba;
track_size= toc_entry.track_blocks; track_size= toc_entry.track_blocks;
} else { } else {
lba= burn_msf_to_lba(toc_entry.pmin, toc_entry.psec, lba= burn_msf_to_lba(toc_entry.pmin, toc_entry.psec,
toc_entry.pframe); toc_entry.pframe);
if(track_no==num_tracks-1) { if(track_no==num_tracks-1) {
isoburn_toc_session_get_leadout_entry(sessions[session_no], isoburn_toc_session_get_leadout_entry(sessions[session_no],
&next_toc_entry); &next_toc_entry);
} else { } else {
isoburn_toc_track_get_entry(tracks[track_no+1], &next_toc_entry); isoburn_toc_track_get_entry(tracks[track_no+1], &next_toc_entry);
} }
track_size= burn_msf_to_lba(next_toc_entry.pmin, next_toc_entry.psec, track_size= burn_msf_to_lba(next_toc_entry.pmin, next_toc_entry.psec,
next_toc_entry.pframe) - lba; next_toc_entry.pframe) - lba;
} }
if(flag&(1|4)) if((flag & (1 | 4)) || !is_data) {
ret= 0; ret= 0;
else { } else {
ret= isoburn_toc_track_get_emul(tracks[track_no], &emul_lba, ret= isoburn_toc_track_get_emul(tracks[track_no], &emul_lba,
&image_blocks, volume_id, 0); &image_blocks, volume_id, 0);
if(ret <= 0) if(ret <= 0)
ret= isoburn_read_iso_head(drive, lba, &image_blocks, volume_id, 1); ret= isoburn_read_iso_head(drive, lba, &image_blocks, volume_id, 1);
if(image_blocks > track_size) { if(image_blocks > track_size) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Session %d bears ISO image size %ds larger than track size %ds", "Session %d bears ISO image size %ds larger than track size %ds",
session_no + 1, image_blocks, track_size); session_no + 1, image_blocks, track_size);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING",
0); 0);
skipping to change at line 1335 skipping to change at line 1366
typetext, session_no+1, lba, track_size); typetext, session_no+1, lba, track_size);
} else { } else {
typetext= "Other track "; typetext= "Other track ";
if(flag & 4) if(flag & 4)
typetext= "Track "; typetext= "Track ";
sprintf(respt, "%13s: %3d , %9d , %9ds , \n", sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
typetext, track_count, lba, track_size); typetext, track_count, lba, track_size);
} }
if(!(flag&1)) if(!(flag&1))
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
/* if(is_data)
if(track_no>0) num_session_data+= track_size;
num_payload+= lba - last_track_start; else
*/ num_session_other+= track_size;
last_track_start= lba; if(track_no == 0)
if((toc_entry.control&7)>=4) /* data track */ first_track_start= lba;
is_data= 1;
} }
isoburn_toc_session_get_leadout_entry(sessions[session_no], &toc_entry); isoburn_toc_session_get_leadout_entry(sessions[session_no], &toc_entry);
if (toc_entry.extensions_valid & 1) { if (toc_entry.extensions_valid & 1) {
lba= toc_entry.start_lba; lba= toc_entry.start_lba;
} else { } else {
lba= burn_msf_to_lba(toc_entry.pmin, toc_entry.psec, toc_entry.pframe); lba= burn_msf_to_lba(toc_entry.pmin, toc_entry.psec, toc_entry.pframe);
} }
last_track_size= lba - last_track_start; session_size= lba - first_track_start;
/* if(num_session_data > 0 && num_session_other > 0) {
num_payload+= last_track_size; num_data+= num_session_data;
*/ other_data+= num_session_other;
if(is_data) } else if(is_data) {
num_data+= last_track_size; num_data+= session_size;
} else {
other_data+= session_size;
}
} }
} }
if(xorriso->request_to_abort) if(xorriso->request_to_abort)
{ret= 1; goto ex;} {ret= 1; goto ex;}
/*
num_wasted= lba - num_payload;
num_nondata= lba - num_data;
*/
Sfile_scale(((double) num_data) * 2048.0, mem_text,5,1e4,1); Sfile_scale(((double) num_data) * 2048.0, mem_text,5,1e4,1);
sessions_seen= num_sessions + open_sessions; sessions_seen= num_sessions + open_sessions;
if(open_sessions > 0 && !have_real_open_session) if(open_sessions > 0 && !have_real_open_session)
sessions_seen--; sessions_seen--;
sprintf(respt, "Media summary: %d session%s, %d data blocks, %s data", sprintf(respt, "Media summary: %d session%s, %d data blocks, %s data",
sessions_seen, (sessions_seen == 1 ? "" : "s"), num_data, mem_text); sessions_seen, (sessions_seen == 1 ? "" : "s"), num_data, mem_text);
if(num_data_from_format) if(num_data_from_format)
num_free= 0; num_free= 0;
else else
num_free= isoburn_disc_available_space(drive, NULL); num_free= isoburn_disc_available_space(drive, NULL);
Sfile_scale((double) num_free, mem_text,5,1e4,1); Sfile_scale((double) num_free, mem_text,5,1e4,1);
sprintf(respt+strlen(respt), ", %s free", mem_text); sprintf(respt+strlen(respt), ", %s free", mem_text);
sprintf(respt+strlen(respt), "\n"); sprintf(respt+strlen(respt), "\n");
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
if(other_data > 0) {
sprintf(respt, "Non-data blks: %d\n", other_data);
Xorriso_toc_line(xorriso, flag & 8);
}
if (s==BURN_DISC_APPENDABLE && nwa!=0) { if (s==BURN_DISC_APPENDABLE && nwa!=0) {
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa); ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
if(ret>0) { if(ret>0) {
sprintf(respt, "Media nwa : %ds\n", nwa); sprintf(respt, "Media nwa : %ds\n", nwa);
if(!(flag&1)) if(!(flag&1))
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
} }
} }
if(profile_no == 0x41 && sessions_seen >= 300) { if(profile_no == 0x41 && sessions_seen >= 300) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Sequential BD-R medium now contains %d sessions. It is likely to soo n fail writing.", "Sequential BD-R medium now contains %d sessions. It is likely to soo n fail writing.",
sessions_seen); sessions_seen);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
} }
if(have_real_open_session) { if(have_real_open_session) {
sprintf(xorriso->info_text, "Incomplete session encountered !"); sprintf(xorriso->info_text, "Incomplete session encountered !");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
} }
if (disc!=NULL)
isoburn_toc_disc_free(disc);
Xorriso_process_msg_queues(xorriso,0);
ret= 1; ret= 1;
ex:; ex:;
Xorriso_process_msg_queues(xorriso,0);
if (disc!=NULL)
isoburn_toc_disc_free(disc);
return(ret); return(ret);
} }
/* @param flag bit0= try to find 'meaningful' links for enumerated devices /* @param flag bit0= try to find 'meaningful' links for enumerated devices
*/ */
int Xorriso_show_devices(struct XorrisO *xorriso, int flag) int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
{ {
char *adr= NULL, *link_adr= NULL, *adrpt; char *adr= NULL, *link_adr= NULL, *adrpt;
int i, j, max_dev_len= 1, pad, ret; int i, j, max_dev_len= 1, pad, ret;
struct burn_drive_info *drive_list= NULL; struct burn_drive_info *drive_list= NULL;
skipping to change at line 2511 skipping to change at line 2545
state->md5_spot_value= Xorriso_read_quality_md5_matcH; state->md5_spot_value= Xorriso_read_quality_md5_matcH;
} }
state->md5_spot_lba= lba; state->md5_spot_lba= lba;
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Found %s MD5 %s tag: start=%d size=%d", "Found %s MD5 %s tag: start=%d size=%d",
comparison, tag_type_name, state->md5_start, comparison, tag_type_name, state->md5_start,
lba - state->md5_start); lba - state->md5_start);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, sev_text, 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, sev_text, 0);
} }
if(valid && (tag_type == 1 || (tag_type == 4 && pos == lba && lba < 32))){ if(valid && (tag_type == 1 || (tag_type == 4 && pos == lba && lba < 32))){
if(state->md5_spot_value != Xorriso_read_quality_untesteD && if(state->md5_spot_value != Xorriso_read_quality_untesteD) {
Xorriso_read_quality_md5_mismatcH <= xorriso->check_media_bad_limit){
ret= Xorriso__add_spot(state, state->md5_start, ret= Xorriso__add_spot(state, state->md5_start,
state->md5_spot_lba - state->md5_start, state->md5_spot_value, 0); state->md5_spot_lba - state->md5_start, state->md5_spot_value, 0);
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
} }
state->md5_spot_value= Xorriso_read_quality_untesteD; state->md5_spot_value= Xorriso_read_quality_untesteD;
state->md5_start = lba + 1; state->md5_start = lba + 1;
if(state->md5_start % 32) if(state->md5_start % 32)
state->md5_start= state->md5_start + (32 - (state->md5_start % 32)); state->md5_start= state->md5_start + (32 - (state->md5_start % 32));
state->next_tag= 0; state->next_tag= 0;
 End of changes. 37 change blocks. 
50 lines changed or deleted 85 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)