From 1cb1eefdd54b6fb3f4a1e98e7bff77201f7cf8c0 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 31 Aug 2009 21:09:16 +0000 Subject: [PATCH] New option -scdbackup_tag --- libisoburn/trunk/xorriso/xorriso.1 | 10 +++- libisoburn/trunk/xorriso/xorriso.c | 50 +++++++++++++++++++- libisoburn/trunk/xorriso/xorriso.h | 11 +++++ libisoburn/trunk/xorriso/xorriso_private.h | 2 + libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 17 ++----- 6 files changed, 75 insertions(+), 17 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index 8206a91f..01c49e61 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/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 "Aug 29, 2009" +.TH XORRISO 1 "Aug 31, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -2946,6 +2946,14 @@ X of Y MB written (fifo nn%) [buf mmm%] .br nn% done, estimate finish Tue Jul 15 20:13:28 2008 .TP +\fB\-scdbackup_tag\fR name timestamp +Set the parameters "name" and "timestamp" for an scdbackup checksum tag. +It will be appended to the -md5 session tag if the image starts at LBA 0, +which is the case if output gets written as first session onto a sequential +media, or piped into a program, named pipe or character device. +.br +Program scdbackup_verify will recognize and verify these tags. +.TP .B Scripting, dialog and program control features: .TP \fB\-no_rc\fR diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index db7d6283..63a8ccf1 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -4690,6 +4690,8 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->do_joliet= 0; m->do_aaip= 0; m->do_md5= 0; + m->scdbackup_tag_name[0]= 0; + m->scdbackup_tag_time[0]= 0; m->relax_compliance= 0; m->do_follow_pattern= 1; m->do_follow_param= 0; @@ -7129,6 +7131,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->scdbackup_tag_name[0] == 0 && + xorriso->scdbackup_tag_time[0] == 0); + sprintf(line, "-scdbackup_tag "); + Text_shellsafe(xorriso->scdbackup_tag_name, line, 1); + strcat(line, " "); + Text_shellsafe(xorriso->scdbackup_tag_time, line, 1); + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (Xorriso_get_relax_text(xorriso, sfe, 0) == 2); sprintf(line,"-compliance %s\n", sfe); if(!(is_default && no_defaults)) @@ -10725,6 +10737,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, " --acl Record eventual ACLs of files", " --xattr Record eventual user space xattr of files", " --md5 Compute and record MD5 checksums of data files", +" --scdbackup_tag NAME TIME With --md5 record a scdbackup checksum tag", " --for_backup Use all options which improve backup fidelity", " -V ID, -volid ID Set Volume ID", " -b FILE, -eltorito-boot FILE", @@ -10889,6 +10902,13 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, Xorriso_option_xattr(xorriso, "on", 0); } else if(strcmp(argv[i], "--md5")==0) { Xorriso_option_md5(xorriso, "on", 0); + } else if(strcmp(argv[i], "--scdbackup_tag")==0) { + if(i + 2 >= argc) + goto not_enough_args; + i+= 2; + ret= Xorriso_option_scdbackup_tag(xorriso, argv[i-1], argv[i], 0); + if(ret <= 0) + goto problem_handler_1; } else if(strcmp(argv[i], "--for_backup")==0) { Xorriso_option_hardlinks(xorriso, "on", 0); Xorriso_option_acl(xorriso, "on", 0); @@ -11107,6 +11127,9 @@ not_enough_args:; strcmp(argv[i], "--md5")==0 || strcmp(argv[i], "--for_backup")==0) { /* was already handled in first argument scan */; + } else if(strcmp(argv[i], "--scdbackup_tag")==0) { + /* was already handled in first argument scan */; + i+= 2; } else if(strcmp(argv[i], "-z")==0 || strcmp(argv[i], "-transparent-compression")==0) { /* was already handled in first argument scan */; @@ -15586,6 +15609,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " and their use in file comparison.", " -md5 \"on\"|\"all\"|\"off\"", " Enable resp. disable processing of MD5 checksums.", +" -scdbackup_tag name timestamp", +" Enable production of scdbackup tag with -md5 on", " -ban_stdio_write", " Allow for writing only the usage of optical drives.", " -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"", @@ -17721,6 +17746,23 @@ unknown_mode:; } +/* Option -scdbackup_tag name timestamp */ +int Xorriso_option_scdbackup_tag(struct XorrisO *xorriso, char *name, + char *timestamp, int flag) +{ + if(strlen(name) > 80 || strlen(timestamp) > 18 || + name[0] == 0 || timestamp[0] == 0) { + sprintf(xorriso->info_text, + "Unsuitable name or timestamp given with -scdbackup_tag"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + strcpy(xorriso->scdbackup_tag_name, name); + strcpy(xorriso->scdbackup_tag_time, timestamp); + return(1); +} + + /* Option -session_log */ int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag) { @@ -17730,6 +17772,7 @@ int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag) } + /* Option -setfacl_list alias -setfacl_listi */ int Xorriso_option_setfacl_listi(struct XorrisO *xorriso, char *path, int flag) { @@ -18842,7 +18885,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, "assert_volid","boot_image","compare","compare_r","drive_class", "errfile_log","error_behavior","extract","extract_single", "load","logfile", - "map","map_single","page","return_with","update","update_r", + "map","map_single","page","return_with", + "scdbackup_tag","update","update_r", "" }; static char arg4_commands[][40]= { @@ -19524,6 +19568,10 @@ next_command:; (*idx)++; Xorriso_option_rom_toc_scan(xorriso, arg1, 0); + } else if(strcmp(cmd,"scdbackup_tag")==0) { + (*idx)+= 2; + ret= Xorriso_option_scdbackup_tag(xorriso, arg1, arg2, 0); + } else if(strcmp(cmd,"session_log")==0) { (*idx)++; ret= Xorriso_option_session_log(xorriso, arg1, 0); diff --git a/libisoburn/trunk/xorriso/xorriso.h b/libisoburn/trunk/xorriso/xorriso.h index 19c5ae65..d7d29b11 100644 --- a/libisoburn/trunk/xorriso/xorriso.h +++ b/libisoburn/trunk/xorriso/xorriso.h @@ -485,6 +485,9 @@ int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag); int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form, char *treatment, int flag); +/* Option -calm_drive */ +int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag); + /* Option -cd alias -cdi */ int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag); @@ -683,6 +686,10 @@ int Xorriso_option_list_delimiter(struct XorrisO *xorriso, char *text, /* Option -list_formats */ int Xorriso_option_list_formats(struct XorrisO *xorriso, int flag); +/* Option -list_profiles */ +int Xorriso_option_list_profiles(struct XorrisO *xorriso, char *which, + int flag); + /* Option -load session|track|sbsector value */ /* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high @return <=0 error , 1 success, 2 revoked by -reassure @@ -855,6 +862,10 @@ int Xorriso_option_rollback(struct XorrisO *xorriso, int flag); int Xorriso_option_rom_toc_scan(struct XorrisO *xorriso, char *mode, int flag); +/* Option -scdbackup_tag */ +int Xorriso_option_scdbackup_tag(struct XorrisO *xorriso, char *name, + char *timestamp, int flag); + /* Option -session_log */ int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag); diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index 69fb5d68..3afaa19a 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -130,6 +130,8 @@ struct XorrisO { /* the global context of xorriso */ bit3= make file content stability check by double reading bit4= use recorded MD5 as proxy of ISO file */ + char scdbackup_tag_name[81]; + char scdbackup_tag_time[19]; int relax_compliance; /* opaque bitfield to be set by xorrisoburn */ int do_follow_pattern; diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index d5ba7628..33ced780 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.08.31.210528" +#define Xorriso_timestamP "2009.08.31.211005" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index 06168f59..8d938096 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -702,7 +702,7 @@ int Xorriso_get_drive_handles(struct XorrisO *xorriso, ret= burn_drive_get_drive_role(*drive); if(ret != 1) { sprintf(xorriso->info_text, - "Output device is not an MMC drive. Desired operation does not apply"); + "Output device is not an MMC drive. Desired operation does not apply."); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); return(2); } @@ -1830,7 +1830,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) isoburn_igopt_set_over_ugid(sopts, 0, 0, (uid_t) 0, (gid_t) 0); isoburn_igopt_set_out_charset(sopts, out_cs); isoburn_igopt_set_fifo_size(sopts, xorriso->fs * 2048); - + isoburn_igopt_set_scdbackup_tag(sopts, xorriso->scdbackup_tag_name, + xorriso->scdbackup_tag_time); if(image!=NULL && strlen(Xorriso_program_versioN)+strlen(Xorriso_timestamP)<80) { sprintf(xorriso_id, "XORRISO-%s %s", @@ -5870,18 +5871,6 @@ int Xorriso_list_formats(struct XorrisO *xorriso, int flag) return(0); if(ret == 2) goto ex; - -#ifdef NIX - /* <<< obsoleted by bit0 of Xorriso_get_drive_handles */ - ret= burn_drive_get_drive_role(drive); - if(ret!=1) { - sprintf(xorriso->info_text, - "output device is not an MMC drive. -list_format does not apply"); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); - ret= 2; goto ex; - } -#endif /* NIX */ - ret = burn_disc_get_formats(drive, &status, &size, &dummy, &num_formats); if(ret<=0) {