From 9444c7f1cb0fa631b413edc5cade424017b98492 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 7 Oct 2009 18:04:53 +0000 Subject: [PATCH] New options -system_id , -volset_id --- xorriso/xorriso.1 | 12 ++++ xorriso/xorriso.c | 121 +++++++++++++++++++++++++++++------- xorriso/xorriso.h | 6 ++ xorriso/xorriso_private.h | 2 + xorriso/xorriso_timestamp.h | 2 +- xorriso/xorrisoburn.c | 22 ++++--- 6 files changed, 135 insertions(+), 30 deletions(-) diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index 741d418c..ac4be302 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -1902,6 +1902,11 @@ Consider this when setting -volid "ISOIMAGE" before executing -dev, -indev, or -rollback. If you insist in -volid "ISOIMAGE", set it again after those commands. .TP +\fB\-volset_id\fR text +Set the volume set id string to be written with the next -commit. +Permissible are up to 128 characters. This setting gets overridden by +image loading. +.TP \fB\-publisher\fR text Set the publisher id string to be written with the next -commit. This may identify the person or organisation who specified what shall be recorded. @@ -1914,6 +1919,13 @@ identify the specification of how the data are recorded. Permissible are up to 128 characters. This setting gets overridden by image loading. .TP +\fB\-system_id\fR text +Set the system id string to be written with the next -commit. This may +identify the system which can recognize and act upon the content of the +System Area in image blocks 0 to 15. +Permissible are up to 32 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 image. See paragraph "Character sets" for more explanations. diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index c2b85b6f..4ec37c9c 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -4768,6 +4768,8 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->assert_volid_sev[0]= 0; m->publisher[0]= 0; m->application_id[0]= 0; + m->system_id[0]= 0; + m->volset_id[0]= 0; m->session_logfile[0]= 0; m->session_lba= -1; m->session_blocks= 0; @@ -6983,6 +6985,16 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->system_id[0]==0); + sprintf(line,"-system_id %s\n", Text_shellsafe(xorriso->system_id,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->volset_id[0]==0); + sprintf(line,"-volset_id %s\n", Text_shellsafe(xorriso->volset_id,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->do_joliet==0); sprintf(line,"-joliet %s\n", (xorriso->do_joliet == 1 ? "on" : "off")); if(!(is_default && no_defaults)) @@ -10863,8 +10875,8 @@ int Xorriso_genisofs_ignore(struct XorrisO *xorriso, char *whom, "" }; static char ignored_arg1_options[][41]= { - "-A", "-biblio", "-check-session", "-p", "-root", - "-old-root", "-sysid", "-table-name", + "-biblio", "-check-session", "-p", "-root", + "-old-root", "-table-name", "-volset-seqno", "-volset-size", "" }; int k, idx_offset= 0; @@ -10923,6 +10935,10 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag) " --scdbackup_tag PATH NAME With --md5 record a scdbackup checksum tag", " --for_backup Use all options which improve backup fidelity", " -V ID, -volid ID Set Volume ID", +" -volset ID Set Volume set ID", +" -publisher PUB Set Volume publisher", +" -A ID, -appid ID Set Application ID", +" -sysid ID Set System ID", " -b FILE, -eltorito-boot FILE", " Set El Torito boot image name", " -c FILE, -eltorito-catalog FILE", @@ -11262,6 +11278,13 @@ not_enough_args:; ret= Xorriso_option_volid(xorriso, argv[i], 0); if(ret<=0) goto problem_handler_2; + } else if(strcmp(argv[i], "-volset")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Xorriso_option_volid(xorriso, argv[i], 0); + if(ret<=0) + goto problem_handler_2; } else if(strcmp(argv[i], "-P")==0 || strcmp(argv[i], "-publisher")==0) { if(i+1>=argc) goto not_enough_args; @@ -11269,6 +11292,20 @@ not_enough_args:; ret= Xorriso_option_publisher(xorriso, argv[i], 0); if(ret<=0) goto problem_handler_2; + } else if(strcmp(argv[i], "-A")==0 || strcmp(argv[i], "-appid")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Xorriso_option_application_id(xorriso, argv[i], 0); + if(ret<=0) + goto problem_handler_2; + } else if(strcmp(argv[i], "-sysid")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Xorriso_option_system_id(xorriso, argv[i], 0); + if(ret<=0) + goto problem_handler_2; } else if(strcmp(argv[i], "-m")==0 || strcmp(argv[i], "-exclude")==0 || strcmp(argv[i], "-x")==0 || strcmp(argv[i], "-old-exclude")==0) { if(i+1>=argc) @@ -12887,6 +12924,20 @@ int Xorriso_may_burn(struct XorrisO *xorriso, int flag) } +int Xorriso_check_name_len(struct XorrisO *xorriso, char *name, int size, + char *cmd, int flag) +{ + if(strlen(name) >= size) { + sprintf(xorriso->info_text, + "Name too long with option %s (%d > %d)", cmd, + (int) strlen(name), size - 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + return(1); +} + + /* ---------------------------- Options API ------------------------ */ @@ -13102,15 +13153,11 @@ ex:; int Xorriso_option_application_id(struct XorrisO *xorriso, char *name, int flag) { - if(strlen(name)>=sizeof(xorriso->application_id)) { - sprintf(xorriso->info_text, - "Name too long with option -application_id (%d > %d)", - (int) strlen(name), (int) sizeof(xorriso->application_id)-1); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); - return(0); - } - if(Sfile_str(xorriso->application_id,name,0)<=0) - return(-1); + if(Xorriso_check_name_len(xorriso, name, + (int) sizeof(xorriso->application_id), + "-application_id", 0) <= 0) + return(0); + strcpy(xorriso->application_id,name); return(1); } @@ -15872,10 +15919,14 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " Format BD-RE, BD-R, DVD-RAM, DVD-RW, DVD+RW.", " -volid volume_id", " Specifies the volume ID text. (32 chars out of [A-Z0-9_])", +" -volset_id name", +" Specifies the volume set id. (128 chars)", " -publisher name", " Specifies the publisher name. (128 chars)", " -application_id name", " Specifies the application id. (128 chars)", +" -system_id name", +" Specifies the system id for the System Area. (32 chars)", " -joliet \"on\"|\"off\"", " Generate Joliet info additional to Rock Ridge info.", " -compliance rule[:rule...]", @@ -17761,15 +17812,10 @@ int Xorriso_option_prompt(struct XorrisO *xorriso, char *text, int flag) /* Option -publisher */ int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag) { - if(strlen(name)>=sizeof(xorriso->publisher)) { - sprintf(xorriso->info_text, - "Name too long with option -publisher (%d > %d)", - (int) strlen(name), (int) sizeof(xorriso->publisher)-1); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); - return(0); - } - if(Sfile_str(xorriso->publisher,name,0)<=0) - return(-1); + if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->publisher), + "-publisher", 0) <= 0) + return(0); + strcpy(xorriso->publisher,name); return(1); } @@ -18644,6 +18690,17 @@ int Xorriso_option_stream_recording(struct XorrisO *xorriso, char *mode, } +/* Option -system_id */ +int Xorriso_option_system_id(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->system_id), + "-system_id", 0) <= 0) + return(0); + strcpy(xorriso->system_id, name); + return(1); +} + + /* Option -tell_media_space */ int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag) { @@ -18981,6 +19038,17 @@ int Xorriso_option_volid(struct XorrisO *xorriso, char *volid, int flag) } +/* Option -volset_id */ +int Xorriso_option_volset_id(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->volset_id), + "-volset_id", 0) <= 0) + return(0); + strcpy(xorriso->volset_id, name); + return(1); +} + + /* Option -xattr "on"|"off" */ int Xorriso_option_xattr(struct XorrisO *xorriso, char *mode, int flag) { @@ -19147,8 +19215,9 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, "prog","prog_help","publisher","quoted_not_list","quoted_path_list", "reassure","report_about","rom_toc_scan", "session_log","speed","split_size","status","status_history_max", - "stream_recording","temp_mem_limit", - "uid","unregister_filter","use_readline","volid","xattr","zisofs", + "stream_recording","system_id","temp_mem_limit", + "uid","unregister_filter","use_readline","volid","volset_id", + "xattr","zisofs", "" }; static char arg2_commands[][40]= { @@ -19915,6 +19984,10 @@ next_command:; (*idx)++; ret= Xorriso_option_stream_recording(xorriso, arg1, 0); + } else if(strcmp(cmd,"system_id")==0) { + (*idx)++; + ret= Xorriso_option_system_id(xorriso, arg1, 0); + } else if(strcmp(cmd,"tell_media_space")==0) { Xorriso_option_tell_media_space(xorriso, 0); @@ -19955,6 +20028,10 @@ next_command:; } else if(strcmp(cmd,"version")==0){ ret= Xorriso_option_version(xorriso, 0); + } else if(strcmp(cmd,"volset_id")==0) { + (*idx)++; + ret= Xorriso_option_volset_id(xorriso, arg1, 0); + } else if(strcmp(cmd,"volid")==0) { (*idx)++; ret= Xorriso_option_volid(xorriso,arg1,0); diff --git a/xorriso/xorriso.h b/xorriso/xorriso.h index 6bac10d4..60ea6a7d 100644 --- a/xorriso/xorriso.h +++ b/xorriso/xorriso.h @@ -927,6 +927,9 @@ int Xorriso_option_status_history_max(struct XorrisO *xorriso, int num1, int Xorriso_option_stream_recording(struct XorrisO *xorriso, char *mode, int flag); +/* Option -system_id */ +int Xorriso_option_system_id(struct XorrisO *xorriso, char *name, int flag); + /* Option -tell_media_space */ int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag); @@ -962,6 +965,9 @@ int Xorriso_option_version(struct XorrisO *xorriso, int flag); /* Option -volid */ int Xorriso_option_volid(struct XorrisO *xorriso, char *volid, int flag); +/* Option -volset_id */ +int Xorriso_option_volset_id(struct XorrisO *xorriso, char *name, int flag); + /* Option -xattr "on"|"off" */ int Xorriso_option_xattr(struct XorrisO *xorriso, char *mode, int flag); diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index c7963126..76677e69 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -170,6 +170,8 @@ struct XorrisO { /* the global context of xorriso */ char publisher[129]; char application_id[129]; + char system_id[33]; + char volset_id[129]; char session_logfile[SfileadrL]; int session_lba; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 1ba219b8..53c729fa 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.10.07.140521" +#define Xorriso_timestamP "2009.10.07.180552" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index eb54fb17..eddeda26 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -1229,11 +1229,17 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) xorriso->in_volset_handle= (void *) volset; 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); + strncpy(xorriso->application_id, + un0(iso_image_get_application_id(volset)), 128); + xorriso->application_id[128]= 0; + strncpy(xorriso->publisher, un0(iso_image_get_publisher_id(volset)), 128); + xorriso->publisher[128]= 0; + strncpy(xorriso->system_id, un0(iso_image_get_system_id(volset)), 32); + xorriso->system_id[32]= 0; + strncpy(xorriso->volset_id, un0(iso_image_get_volset_id(volset)), 128); + xorriso->volset_id[128]= 0; /* <<< can be removed as soon as libisofs-0.6.24 is mandatory */ @@ -1722,6 +1728,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) if(image != NULL) { iso_image_set_application_id(image, xorriso->application_id); iso_image_set_publisher_id(image, xorriso->publisher); + iso_image_set_system_id(image, xorriso->system_id); + iso_image_set_volset_id(image, xorriso->volset_id); } if((xorriso->do_aaip & 256) && out_cs != NULL) { @@ -12926,11 +12934,9 @@ int Xorriso_pvd_info(struct XorrisO *xorriso, int flag) } } } - sprintf(msg, "System Id : %s\n", un0(iso_image_get_system_id(image))); - Xorriso_result(xorriso,0); sprintf(msg, "Volume Id : %s\n", un0(iso_image_get_volume_id(image))); Xorriso_result(xorriso,0); - sprintf(msg, "Volume Set Id: %s\n", un0(iso_image_get_volset_id(image))); + sprintf(msg, "Volume Set Id: %s\n", xorriso->volset_id); Xorriso_result(xorriso,0); sprintf(msg, "Publisher Id : %s\n", xorriso->publisher); Xorriso_result(xorriso,0); @@ -12939,6 +12945,8 @@ int Xorriso_pvd_info(struct XorrisO *xorriso, int flag) Xorriso_result(xorriso,0); sprintf(msg, "App Id : %s\n", xorriso->application_id); Xorriso_result(xorriso,0); + sprintf(msg, "System Id : %s\n", xorriso->system_id); + Xorriso_result(xorriso,0); sprintf(msg, "Copyright Id : %s\n", un0(iso_image_get_copyright_file_id(image))); Xorriso_result(xorriso,0);