"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/drive_mgt.c" between
xorriso-1.4.6.tar.gz and xorriso-1.4.8.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

drive_mgt.c  (xorriso-1.4.6):drive_mgt.c  (xorriso-1.4.8)
/* 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.
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 986 skipping to change at line 986
struct isoburn_toc_disc *disc= NULL; struct isoburn_toc_disc *disc= NULL;
struct isoburn_toc_session **sessions; struct isoburn_toc_session **sessions;
struct isoburn_toc_track **tracks; struct isoburn_toc_track **tracks;
int image_blocks= 0; int image_blocks= 0;
char volume_id[33]; char volume_id[33];
struct burn_toc_entry next_toc_entry; struct burn_toc_entry next_toc_entry;
int disk_category, part_version, num_layers, num_blocks; int disk_category, part_version, num_layers, num_blocks;
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",
flag & (2 | 16)); flag & (2 | 16));
if(ret<=0) if(ret<=0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
respt= xorriso->result_line; respt= xorriso->result_line;
if(strcmp(xorriso->indev, xorriso->outdev)==0) if(strcmp(xorriso->indev, xorriso->outdev)==0)
skipping to change at line 1030 skipping to change at line 1030
} }
if(sno != NULL) if(sno != NULL)
free(sno); free(sno);
sno= NULL; sno= NULL;
} }
ret= burn_disc_get_profile(drive, &profile_no, profile_name); ret= burn_disc_get_profile(drive, &profile_no, profile_name);
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) {
if (profile_name[0]) if (profile_name[0])
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");
else if(drive_role == 5) else if(drive_role == 5)
sprintf(respt+strlen(respt), ", random write-only"); sprintf(respt+strlen(respt), ", random write-only");
else if(drive_role==0 || drive_role==3) else if(drive_role==0 || drive_role==3)
sprintf(respt+strlen(respt), ", sequential"); sprintf(respt+strlen(respt), ", sequential");
strcat(respt, "\n"); strcat(respt, "\n");
} else { } else {
sprintf(respt+strlen(respt), "is not recognizable\n"); sprintf(respt+strlen(respt), "is not recognizable\n");
skipping to change at line 1059 skipping to change at line 1062
} }
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
if((flag & 64) || !(flag & 1)) { if((flag & 64) || !(flag & 1)) {
Xorriso_media_product(xorriso, flag & (2 | 8 | 16)); Xorriso_media_product(xorriso, flag & (2 | 8 | 16));
if(xorriso->request_to_abort) if(xorriso->request_to_abort)
{ret= 1; goto ex;} {ret= 1; goto ex;}
} }
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
sprintf(respt+strlen(respt), "is written , is closed"); sprintf(respt+strlen(respt), "is written , is closed");
} else if (s == BURN_DISC_APPENDABLE) { } else if (s == BURN_DISC_APPENDABLE) {
sprintf(respt+strlen(respt), "is written , is appendable"); sprintf(respt+strlen(respt), "is written , is appendable");
} else if (s == BURN_DISC_BLANK) { } else if (s == BURN_DISC_BLANK) {
sprintf(respt+strlen(respt), "is blank"); sprintf(respt+strlen(respt), "is blank");
} else if (s == BURN_DISC_EMPTY) } else if (s == BURN_DISC_EMPTY)
sprintf(respt+strlen(respt), "is not present"); sprintf(respt+strlen(respt), "is not present");
skipping to change at line 1157 skipping to change at line 1162
} }
} }
} else if(profile_no == 0x14) { } else if(profile_no == 0x14) {
ret= burn_disc_get_phys_format_info(drive, &disk_category, ret= burn_disc_get_phys_format_info(drive, &disk_category,
&book_name, &part_version, &book_name, &part_version,
&num_layers, &num_blocks, 0); &num_layers, &num_blocks, 0);
if(ret == 1 && num_blocks > lba) if(ret == 1 && num_blocks > lba)
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";
sprintf(respt, "Media blocks : %d readable , %d %s , %d overall\n", sprintf(respt, "Media blocks : %d readable , %d %s , %d overall\n",
num_data, (int) num_free, num_free_text, lba); num_data, (int) num_free, num_free_text, lba);
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
} }
if(s == BURN_DISC_BLANK) { if(s == BURN_DISC_BLANK) {
sprintf(respt, "Media summary: 0 sessions, 0 data blocks, 0 data"); sprintf(respt, "Media summary: 0 sessions, 0 data blocks, 0 data");
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\n", mem_text); sprintf(respt+strlen(respt), ", %s free\n", mem_text);
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
} }
if(s != BURN_DISC_FULL && s != BURN_DISC_APPENDABLE) if(s != BURN_DISC_FULL && s != BURN_DISC_APPENDABLE)
{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));
disc= isoburn_toc_drive_get_disc(drive); disc= isoburn_toc_drive_get_disc(drive);
if(flag & 4) if(flag & 4)
sprintf(respt, "TOC layout : %3s , %9s , %10s\n", sprintf(respt, "TOC layout : %3s , %9s , %10s\n",
"Idx", "sbsector", "Size"); "Idx", "sbsector", "Size");
else else
sprintf(respt, "TOC layout : %3s , %9s , %10s , %s\n", sprintf(respt, "TOC layout : %3s , %9s , %10s , %s\n",
skipping to change at line 1515 skipping to change at line 1526
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
if(ret<=0) if(ret<=0)
return(-1); return(-1);
(*free_space)= (*media_space)= (*free_space)= (*media_space)=
isoburn_disc_available_space(drive, burn_options) / (off_t) 2048; isoburn_disc_available_space(drive, burn_options) / (off_t) 2048;
burn_write_opts_free(burn_options); burn_write_opts_free(burn_options);
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);
} }
/* @return <=0 error, 1 success /* @return <=0 error, 1 success
*/ */
int Xorriso_list_formats(struct XorrisO *xorriso, int flag) int Xorriso_list_formats(struct XorrisO *xorriso, int flag)
{ {
int ret, i, status, num_formats, profile_no, type, alloc_blocks, free_blocks; int ret, i, status, num_formats, profile_no, type, alloc_blocks, free_blocks;
skipping to change at line 1916 skipping to change at line 1931
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
} }
return(1); return(1);
} }
/* @param flag bit0= -inq /* @param flag bit0= -inq
bit1= -checkdrive bit1= -checkdrive
*/ */
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];
double x_speed_max, x_speed_min= -1.0; double x_speed_max, x_speed_min= -1.0;
struct burn_drive_info *dinfo; struct burn_drive_info *dinfo;
struct burn_drive *drive; struct burn_drive *drive;
enum burn_disc_status s; enum burn_disc_status s;
char *manuf= NULL, *media_code1= NULL, *media_code2= NULL; char *manuf= NULL, *media_code1= NULL, *media_code2= NULL;
char *book_type= NULL, *product_id= NULL; char *book_type= NULL, *product_id= NULL;
skipping to change at line 1984 skipping to change at line 1999
sprintf(respt, "Driver flags : BURNFREE\n"); sprintf(respt, "Driver flags : BURNFREE\n");
sprintf(respt+strlen(respt), "Supported modes: SAO TAO\n"); sprintf(respt+strlen(respt), "Supported modes: SAO TAO\n");
Xorriso_result(xorriso,1); Xorriso_result(xorriso,1);
} else if(flag & 2) { } else if(flag & 2) {
sprintf(xorriso->info_text, "Not a CD/DVD/BD recorder"); sprintf(xorriso->info_text, "Not a CD/DVD/BD recorder");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
} }
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) {
profile_number= 0; profile_number= 0;
strcpy(profile_name, "-unidentified-"); strcpy(profile_name, "-unidentified-");
} }
if(s != BURN_DISC_UNSUITABLE) { if(s != BURN_DISC_UNSUITABLE) {
ret= burn_disc_read_atip(drive); ret= burn_disc_read_atip(drive);
if(ret>0) { if(ret>0) {
ret= burn_drive_get_min_write_speed(drive); ret= burn_drive_get_min_write_speed(drive);
x_speed_min= ((double) ret)/176.4; x_speed_min= ((double) ret)/176.4;
} }
} }
if(s==BURN_DISC_EMPTY) { if(s==BURN_DISC_EMPTY) {
sprintf(respt, "Current: none\n"); sprintf(respt, "Current: none\n");
Xorriso_result(xorriso,1); Xorriso_result(xorriso,1);
sprintf(xorriso->info_text, "No recognizable medium found in drive"); sprintf(xorriso->info_text, "No recognizable medium found in drive");
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)
return(1); return(1);
if(strstr(profile_name,"BD")==profile_name) { if(strstr(profile_name,"BD")==profile_name) {
printf("Mounted Media: %2.2Xh, %s\n", profile_number, profile_name); printf("Mounted Media: %2.2Xh, %s\n", profile_number, profile_name);
} else if(strstr(profile_name,"DVD")==profile_name) { } else if(strstr(profile_name,"DVD")==profile_name) {
sprintf(respt, "book type: %s (emulated booktype)\n", profile_name); sprintf(respt, "book type: %s (emulated booktype)\n", profile_name);
Xorriso_result(xorriso,1); Xorriso_result(xorriso,1);
if(profile_number == 0x13) { if(profile_number == 0x13) {
skipping to change at line 2131 skipping to change at line 2148
return(3); return(3);
return(0); return(0);
} }
/* @param flag bit0= grow_overwriteable_iso /* @param flag bit0= grow_overwriteable_iso
bit1= obtain info from outdev bit1= obtain info from outdev
bit2= no need to obtain msc2 (NWA) bit2= no need to obtain msc2 (NWA)
*/ */
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;
*msc1= *msc2= -1; *msc1= *msc2= -1;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to obtain msinfo", flag&2); "on attempt to obtain msinfo", flag&2);
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
disc_state= burn_disc_get_status(drive); disc_state= burn_disc_get_status(drive);
if(disc_state != BURN_DISC_APPENDABLE && if(disc_state != BURN_DISC_APPENDABLE &&
!(disc_state == BURN_DISC_FULL && (flag & 4))) { !(disc_state == BURN_DISC_FULL && (flag & 4))) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(!(flag & 4)) { if(!(flag & 4)) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"%s medium is not appendable. Cannot obtain -msinfo.", "%s medium is not appendable. Cannot obtain -msinfo.",
 End of changes. 14 change blocks. 
9 lines changed or deleted 35 lines changed or added

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