From 38a305974867ba1c4c2a16610909d9fdb94c0df2 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 5 Oct 2009 17:20:38 +0000 Subject: [PATCH] New option -pvd_info --- xorriso/xorriso.1 | 13 ++++-- xorriso/xorriso.c | 13 +++++- xorriso/xorriso.h | 3 ++ xorriso/xorriso_timestamp.h | 2 +- xorriso/xorrisoburn.c | 79 ++++++++++++++++++++++++++++++++++--- xorriso/xorrisoburn.h | 2 + 6 files changed, 101 insertions(+), 11 deletions(-) diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index 2e444423..6df1ab3c 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH XORRISO 1 "Sep 29, 2009" +.TH XORRISO 1 "Oct 05, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -1898,12 +1898,12 @@ or -rollback. If you insist in -volid "ISOIMAGE", set it again after those commands. .TP \fB\-publisher\fR text -Set the publisher string to be written with the next -commit. Permissible -are up to 128 characters. +Set the publisher id string to be written with the next -commit. Permissible +are up to 128 characters. This setting gets overridden by image loading. .TP \fB\-application_id\fR text Set the application id string to be written with the next -commit. Permissible -are up to 128 characters. +are up to 128 characters. This setting gets overridden by image loading. .TP \fB\-out_charset\fR character_set_name Set the character set to which file names get converted when writing an @@ -2380,6 +2380,11 @@ prepared and only in last moment is revoked by this option. Print available space on output media and the free space after subtracting already foreseeable consumption by next -commit. .TP +\fB\-pvd_info\fR +Print various id strings which can be found in loaded ISO images. Some of +them may be changed by options -volid, -publisher, -application_id. For these +ids -pvd_info reports what would be written with the next -commit. +.TP .B Navigation in ISO image and disk filesystem: .TP \fB\-cd\fR iso_rr_path diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index 4f197a12..c8d0ae81 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -15907,6 +15907,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) "", " -tell_media_space", " Print foreseeable available space on output media", +" -pvd_info Print various id strings of the loaded ISO image." "", "Options with variable length path list [...] need the list delimiter text", "as end mark if they are followed by another option. By default this delimiter", @@ -17770,6 +17771,13 @@ int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag) } +/* Option -pvd_info */ +int Xorriso_option_pvd_info(struct XorrisO *xorriso, int flag) +{ + return(Xorriso_pvd_info(xorriso, 0)); +} + + /* Option -pwd alias -pwdi */ int Xorriso_option_pwdi(struct XorrisO *xorriso, int flag) { @@ -19114,7 +19122,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, static char arg0_commands[][40]= { "ban_stdio_write","close_filter_list","commit","devices","end", "for_backup", "help", - "list_formats","no_rc","print_size","pwd","pwdi","pwdx", + "list_formats","no_rc","print_size","pvd_info","pwd","pwdi","pwdx", "rollback","rollback_end","tell_media_space","toc","version", "" }; @@ -19772,6 +19780,9 @@ next_command:; (*idx)++; Xorriso_option_publisher(xorriso, arg1, 0); + } else if(strcmp(cmd,"pvd_info")==0) { + Xorriso_option_pvd_info(xorriso, 0); + } else if(strcmp(cmd,"pwd")==0 || strcmp(cmd,"pwdi")==0) { Xorriso_option_pwdi(xorriso, 0); diff --git a/xorriso/xorriso.h b/xorriso/xorriso.h index 24ca3da7..6bac10d4 100644 --- a/xorriso/xorriso.h +++ b/xorriso/xorriso.h @@ -835,6 +835,9 @@ int Xorriso_option_prog_help(struct XorrisO *xorriso, char *name, int flag); /* Option -publisher */ int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag); +/* Option -pvd_info */ +int Xorriso_option_pvd_info(struct XorrisO *xorriso, int flag); + /* Option -pwd alias -pwdi */ int Xorriso_option_pwdi(struct XorrisO *xorriso, int flag); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 1bc5ae56..c3b30738 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.10.05.165632" +#define Xorriso_timestamP "2009.10.05.172143" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index b2f373c3..23a35966 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -136,6 +136,14 @@ unsigned long Xorriso_get_di_counteR= 0; /* ------------------------------------------------------------------------ */ +static const char *un0(const char *text) +{ + if(text == NULL) + return(""); + return(text); +} + + int Xorriso_destroy_node_array(struct XorrisO *xorriso, int flag) { int i; @@ -1220,6 +1228,10 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) xorriso->in_sector_map= NULL; Xorriso_set_image_severities(xorriso, 0); Xorriso_update_volid(xorriso, 0); + Sfile_str(xorriso->application_id, + (char *) un0(iso_image_get_application_id(volset)), 0); + Sfile_str(xorriso->publisher, + (char *) un0(iso_image_get_publisher_id(volset)), 0); if(xorriso->out_drive_handle != NULL && xorriso->out_drive_handle != xorriso->in_drive_handle) { @@ -5250,6 +5262,7 @@ int Xorriso_media_product(struct XorrisO *xorriso, int flag) bit4=do no report failure if no drive aquired bit5=only report "Drive current" and "Drive type" bit6=report "Media product" with bit0 + bit7=only report "Drive current" */ int Xorriso_toc(struct XorrisO *xorriso, int flag) { @@ -5291,6 +5304,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag) (is_inout_drive ? "-dev" : (flag&2 ? "-outdev" : "-indev")), devadr); Xorriso_toc_line(xorriso, flag & 8); + if(flag & 128) + return(1); sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n", dinfo[0].vendor, dinfo[0].product, dinfo[0].revision); if((flag & 32) | !(flag & 1)) @@ -9391,6 +9406,7 @@ int Xorriso_is_split(struct XorrisO *xorriso, char *path, void *node, /* @param flag bit0= grow_overwriteable_iso bit1= obtain info from outdev + bit2= no need to obtain msc2 (NWA) */ int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag) { @@ -9399,6 +9415,7 @@ int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag) struct burn_drive_info *dinfo; enum burn_disc_status disc_state; + *msc1= *msc2= -1; ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, "on attempt to obtain msinfo", flag&2); if(ret<=0) @@ -9408,12 +9425,15 @@ int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag) disc_state= isoburn_disc_get_status(drive); else 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))) { Xorriso_process_msg_queues(xorriso,0); - sprintf(xorriso->info_text, - "%s media is not appendable. Cannot obtain -msinfo.", - (flag&2) ? "Output" : "Input"); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + if(!(flag & 4)) { + sprintf(xorriso->info_text, + "%s media is not appendable. Cannot obtain -msinfo.", + (flag&2) ? "Output" : "Input"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } return(0); } ret= isoburn_disc_get_msc1(drive, msc1); @@ -9423,6 +9443,8 @@ int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); return(0); } + if(flag & 4) + return(1); ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &dummy, msc2); if(ret<0) { Xorriso_process_msg_queues(xorriso,0); @@ -12840,3 +12862,50 @@ ex:; } +int Xorriso_pvd_info(struct XorrisO *xorriso, int flag) +{ + int ret, msc1= -1, msc2; + IsoImage *image; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + char *msg; + + msg= xorriso->result_line; + ret= Xorriso_get_volume(xorriso, &image, 0); + if(ret<=0) + return(ret); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, "", 16); + if(ret > 0) { + ret= Xorriso_msinfo(xorriso, &msc1, &msc2, 1 | 4); + if(ret<0) + return(ret); + Xorriso_toc(xorriso, 128); + if(msc1 >= 0) { + sprintf(msg, "PVD address : %ds\n", msc1 + 16); + Xorriso_result(xorriso,0); + } + } + sprintf(msg, "System Id : %s\n", un0(iso_image_get_system_id(image))); + Xorriso_result(xorriso,0); + sprintf(msg, "Volume Id : %s\n", xorriso->volid); + Xorriso_result(xorriso,0); + sprintf(msg, "Volume Set Id: %s\n", un0(iso_image_get_volset_id(image))); + Xorriso_result(xorriso,0); + sprintf(msg, "Publisher Id : %s\n", xorriso->publisher); + Xorriso_result(xorriso,0); + sprintf(msg, "Preparer Id : %s\n", + un0(iso_image_get_data_preparer_id(image))); + Xorriso_result(xorriso,0); + sprintf(msg, "App Id : %s\n", xorriso->application_id); + Xorriso_result(xorriso,0); + sprintf(msg, "Copyright Id : %s\n", + un0(iso_image_get_copyright_file_id(image))); + Xorriso_result(xorriso,0); + sprintf(msg, "Abstract Id : %s\n", + un0(iso_image_get_abstract_file_id(image))); + Xorriso_result(xorriso,0); + sprintf(msg, "Biblio Id : %s\n", un0(iso_image_get_biblio_file_id(image))); + Xorriso_result(xorriso,0); + return(1); +} + diff --git a/xorriso/xorrisoburn.h b/xorriso/xorrisoburn.h index 50b28bc5..6c8cb89a 100644 --- a/xorriso/xorrisoburn.h +++ b/xorriso/xorrisoburn.h @@ -483,6 +483,8 @@ int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag); int Xorriso_is_plain_image_file(struct XorrisO *xorriso, void *in_node, char *path, int flag); +int Xorriso_pvd_info(struct XorrisO *xorriso, int flag); + /* A pseudo file type for El-Torito bootsectors as in man 2 stat : For now take the highest possible value.