Properly refusing on Pseudo Overwritable formatted BD-R

This commit is contained in:
Thomas Schmitt 2017-02-13 15:52:36 +01:00
parent 9d912df43b
commit 0ec0ba811d
3 changed files with 46 additions and 12 deletions

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2017 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
@ -999,7 +999,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
char *book_name; char *book_name;
int num_data_from_format= 0; int num_data_from_format= 0;
char *sno = NULL; char *sno = NULL;
int sno_len, i; int sno_len, i, is_bdr_pow= 0;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to print Table Of Content", "on attempt to print Table Of Content",
@ -1043,6 +1043,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
s= isoburn_disc_get_status(drive); s= isoburn_disc_get_status(drive);
if(profile_no == 0x0002 && s == BURN_DISC_EMPTY) if(profile_no == 0x0002 && s == BURN_DISC_EMPTY)
profile_no= 0; profile_no= 0;
is_bdr_pow= burn_drive_get_bd_r_pow(drive);
sprintf(respt, "Media current: "); sprintf(respt, "Media current: ");
drive_role= burn_drive_get_drive_role(drive); drive_role= burn_drive_get_drive_role(drive);
if (profile_no > 0 && ret > 0) { if (profile_no > 0 && ret > 0) {
@ -1050,7 +1051,9 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
sprintf(respt+strlen(respt), "%s", profile_name); sprintf(respt+strlen(respt), "%s", profile_name);
else else
sprintf(respt+strlen(respt), "%4.4Xh", profile_no); sprintf(respt+strlen(respt), "%4.4Xh", profile_no);
if(drive_role==2) if(is_bdr_pow)
sprintf(respt+strlen(respt), ", Pseudo Overwrite formatted");
else if(drive_role==2)
sprintf(respt+strlen(respt), ", overwriteable"); sprintf(respt+strlen(respt), ", overwriteable");
else if(drive_role == 4) else if(drive_role == 4)
sprintf(respt+strlen(respt), ", random read-only"); sprintf(respt+strlen(respt), ", random read-only");
@ -1072,7 +1075,9 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
} }
sprintf(respt, "Media status : "); sprintf(respt, "Media status : ");
if (s == BURN_DISC_FULL) { if(is_bdr_pow) {
sprintf(respt+strlen(respt), "is unsuitable , is POW formatted");
} else if (s == BURN_DISC_FULL) {
if(not_recognizable) if(not_recognizable)
sprintf(respt+strlen(respt), "is not recognizable\n"); sprintf(respt+strlen(respt), "is not recognizable\n");
else else
@ -1170,7 +1175,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
lba= num_blocks; lba= num_blocks;
} }
if(drive_role == 4) if(drive_role == 4 || is_bdr_pow)
num_free_text = "unused"; num_free_text = "unused";
else else
num_free_text = "writable"; num_free_text = "writable";
@ -1190,6 +1195,12 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
{ret= 1; goto ex;} {ret= 1; goto ex;}
if(xorriso->request_to_abort) if(xorriso->request_to_abort)
{ret= 1; goto ex;} {ret= 1; goto ex;}
if(is_bdr_pow) {
sprintf(respt,
"Media summary: unsuitable Pseudo Overwrite formatted BD-R\n");
Xorriso_toc_line(xorriso, flag & 8);
{ret= 1; goto ex;}
}
if(!(flag & 2)) if(!(flag & 2))
Xorriso_show_boot_info(xorriso, 1 | (flag & 8) | ((flag & 1) << 1)); Xorriso_show_boot_info(xorriso, 1 | (flag & 8) | ((flag & 1) << 1));
@ -1530,8 +1541,12 @@ int Xorriso_tell_media_space(struct XorrisO *xorriso,
if(Xorriso_change_is_pending(xorriso, 0)) { if(Xorriso_change_is_pending(xorriso, 0)) {
ret= Xorriso_write_session(xorriso, 1); ret= Xorriso_write_session(xorriso, 1);
if(ret>0) if(ret>0) {
(*free_space)-= ret; (*free_space)-= ret;
} else {
Xorriso_process_msg_queues(xorriso,0);
return(0);
}
} }
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
return(1); return(1);
@ -1938,7 +1953,7 @@ int Xorriso_list_profiles(struct XorrisO *xorriso, int flag)
*/ */
int Xorriso_atip(struct XorrisO *xorriso, int flag) int Xorriso_atip(struct XorrisO *xorriso, int flag)
{ {
int ret, profile_number= 0; int ret, profile_number= 0, is_bdr_pow= 0;
int num_profiles= 0, profiles[64], i, can_write= 0, pf, no_medium= 0; int num_profiles= 0, profiles[64], i, can_write= 0, pf, no_medium= 0;
char is_current[64]; char is_current[64];
char *respt, profile_name[80]; char *respt, profile_name[80];
@ -2006,6 +2021,7 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag)
if(flag&2) if(flag&2)
return(1); return(1);
is_bdr_pow= burn_drive_get_bd_r_pow(drive);
s= burn_disc_get_status(drive); s= burn_disc_get_status(drive);
ret= burn_disc_get_profile(drive,&profile_number,profile_name); ret= burn_disc_get_profile(drive,&profile_number,profile_name);
if(ret<=0) { if(ret<=0) {
@ -2026,7 +2042,8 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
no_medium= 1; no_medium= 1;
} else } else
sprintf(respt, "Current: %s\n",profile_name); sprintf(respt, "Current: %s%s\n",profile_name,
is_bdr_pow ? ", Pseudo Overwrite formatted" : "");
Xorriso_result(xorriso,1); Xorriso_result(xorriso,1);
Xorriso_list_profiles(xorriso, 1 | 2); Xorriso_list_profiles(xorriso, 1 | 2);
if(no_medium) if(no_medium)
@ -2155,7 +2172,7 @@ int Xorriso_get_profile(struct XorrisO *xorriso, int *profile_number,
*/ */
int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag) int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag)
{ {
int ret, dummy; int ret, dummy, is_bdr_pow= 0;
struct burn_drive *drive; struct burn_drive *drive;
struct burn_drive_info *dinfo; struct burn_drive_info *dinfo;
enum burn_disc_status disc_state; enum burn_disc_status disc_state;
@ -2166,6 +2183,15 @@ int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag)
if(ret<=0) if(ret<=0)
return(ret); return(ret);
is_bdr_pow= burn_drive_get_bd_r_pow(drive);
if(is_bdr_pow) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,
"%s medium is unsuitably POW formatted BD-R. Cannot obtain -msinfo.",
(flag&2) ? "Output" : "Input");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
if(flag&1) if(flag&1)
disc_state= isoburn_disc_get_status(drive); disc_state= isoburn_disc_get_status(drive);
else else

View File

@ -2,7 +2,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2017 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
@ -1077,7 +1077,7 @@ int Xorriso_set_all_file_dates(struct XorrisO *xorriso, int flag)
int Xorriso_write_session(struct XorrisO *xorriso, int flag) int Xorriso_write_session(struct XorrisO *xorriso, int flag)
{ {
int ret, i, pacifier_speed= 0, data_lba, is_bootable= 0; int ret, i, pacifier_speed= 0, data_lba, is_bootable= 0;
int freshly_bootable= 0, hide_attr, signal_mode, role; int freshly_bootable= 0, hide_attr, signal_mode, role, is_bdr_pow= 0;
char *xorriso_id= NULL, *img_id, *sfe= NULL, *out_cs; char *xorriso_id= NULL, *img_id, *sfe= NULL, *out_cs;
struct isoburn_imgen_opts *sopts= NULL; struct isoburn_imgen_opts *sopts= NULL;
struct burn_drive_info *dinfo, *source_dinfo; struct burn_drive_info *dinfo, *source_dinfo;
@ -1121,6 +1121,14 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
is_bdr_pow= burn_drive_get_bd_r_pow(drive);
if(is_bdr_pow) {
sprintf(xorriso->info_text,
"May not write to Pseudo Overwrite formatted BD-R medium");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
s= isoburn_disc_get_status(drive); s= isoburn_disc_get_status(drive);
if (xorriso->do_hfsplus && ( if (xorriso->do_hfsplus && (
(xorriso->grow_blindly_msc2 >= 0 && (xorriso->grow_blindly_msc2 >= 0 &&

View File

@ -1 +1 @@
#define Xorriso_timestamP "2016.12.14.093149" #define Xorriso_timestamP "2017.02.13.145207"