From e784320c2feb32cfcaf95ddd898724e6d0e55f41 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 9 May 2009 20:17:35 +0000 Subject: [PATCH] New option -hardlinks --- libisoburn/trunk/xorriso/xorriso.1 | 19 +++++++- libisoburn/trunk/xorriso/xorriso.c | 49 +++++++++++++++++--- libisoburn/trunk/xorriso/xorriso.h | 3 ++ libisoburn/trunk/xorriso/xorriso_private.h | 7 +++ libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 34 ++++++-------- 6 files changed, 85 insertions(+), 29 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index 11f997a3..f3f74f7b 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 "Apr 23, 2009" +.TH XORRISO 1 "May 09, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -670,6 +670,23 @@ terminal where xorriso runs. Before attributing this local character set to the produced ISO image, check whether the terminal properly displays all intended filenames, especially exotic national characters. .TP +\fB\-hardlinks\fR "on"|"off" +Enable or disable loading and recording of hardlink relations. +.br +In default mode "off", iso_rr files lose their inode numbers at image load +time. Each iso_rr file object which has no inode number at image generation +time will get a new unique inode number if -compliance is set to -new_rr. +.br +Mode "on" preserves eventual inode numbers from the loaded image. +When committing a session it searches for families of iso_rr files +which stem from the same disk file, have identical content and have +identical properties. The family members all get the same inode number. +.br +Mode "on" automatically enables \fB\-compliance new_rr\fR. This may be +overridden by a following -compliance old_rr . In this case the resulting +image will violate the RRIP-1.10 specs for entry PX in the same way as +mkisofs does. +.TP \fB\-acl\fR "on"|"off" Enable or disable processing of ACLs. If enabled, then xorriso will obtain ACLs from disk file objects, diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index aa397eb2..e772a6e8 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -5231,6 +5231,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->add_plainly= 0; m->split_size= 0; strcpy(m->list_delimiter, "--"); + m->ino_behavior= 3; m->do_joliet= 0; m->do_aaip= 0; m->relax_compliance= 0; @@ -7351,11 +7352,6 @@ 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_get_relax_text(xorriso, sfe, 0) == 2); - sprintf(line,"-compliance %s\n", sfe); - if(!(is_default && no_defaults)) - Xorriso_status_result(xorriso,filter,fp,flag&2); - if(xorriso->do_global_uid) { sprintf(line,"-uid %lu\n", (unsigned long) xorriso->global_uid); Xorriso_status_result(xorriso,filter,fp,flag&2); @@ -7574,6 +7570,17 @@ 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->ino_behavior & (1 | 2)) == 3); + switch (xorriso->ino_behavior & 3) { + case 0: form= "on"; + break; case 1: form= "new_ino"; + break; case 2: form= "no_hardlinks"; + break; default: form= "off"; + } + sprintf(line,"-hardlinks %s\n", form); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= ((xorriso->do_aaip & (1 | 4)) == 0); sprintf(line,"-acl %s\n", (xorriso->do_aaip & 1 ? "on" : "off")); if(!(is_default && no_defaults)) @@ -7589,6 +7596,11 @@ 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_get_relax_text(xorriso, sfe, 0) == 2); + sprintf(line,"-compliance %s\n", sfe); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->assert_volid[0] == 0); sprintf(line, "-assert_volid "); Text_shellsafe(xorriso->assert_volid, line, 1); @@ -15280,6 +15292,25 @@ int Xorriso_option_grow_blindly(struct XorrisO *xorriso, char *msc2, int flag) } +/* Option -hardlinks "on"|"off" */ +int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "off")==0) { + xorriso->ino_behavior|= 1 | 2; + } else if(strcmp(mode, "on")==0) { + xorriso->ino_behavior&= ~(1 | 2); + } else { + sprintf(xorriso->info_text, "-hardlinks: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(xorriso->ino_behavior & 2) + Xorriso_option_compliance(xorriso, "new_rr", 0); + + return(1); +} + + /* Option -help and part of -prog_help */ int Xorriso_option_help(struct XorrisO *xorriso, int flag) { @@ -16352,7 +16383,7 @@ ex:; } -/* Options -mount , -mount_mds , -session_string */ +/* Options -mount , -mount_cmd , -session_string */ /* @param bit0= -mount_cmd: print mount command to result channel rather than performing it bit1= preform -session_string rather than -mount_cmd @@ -18413,7 +18444,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, "backslash_codes","blank", "cd","cdi","cdx","charset","close","commit_eject","compliance", "dev","dialog","disk_dev_ino","disk_pattern","dummy","eject", - "iso_rr_pattern","follow","format","fs","gid","grow_blindly", + "iso_rr_pattern","follow","format","fs","gid","grow_blindly","hardlinks", "history","indev","in_charset","joliet","list_delimiter","local_charset", "mark","not_leaf","not_list","not_mgt", "options_from_file","osirrox","outdev","out_charset","overwrite", @@ -18836,6 +18867,10 @@ next_command:; (*idx)++; ret= Xorriso_option_grow_blindly(xorriso,arg1,0); + } else if(strcmp(cmd,"hardlinks")==0) { + (*idx)++; + ret= Xorriso_option_hardlinks(xorriso, arg1, 0); + } else if(strcmp(cmd,"help")==0) { Xorriso_option_help(xorriso,0); diff --git a/libisoburn/trunk/xorriso/xorriso.h b/libisoburn/trunk/xorriso/xorriso.h index b103a752..679807ad 100644 --- a/libisoburn/trunk/xorriso/xorriso.h +++ b/libisoburn/trunk/xorriso/xorriso.h @@ -488,6 +488,9 @@ int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag); /* Option -grow_blindly */ int Xorriso_option_grow_blindly(struct XorrisO *xorriso, char *msc2, int flag); +/* Option -hardlinks "on"|"off" */ +int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag); + /* Option -help and part of -prog_help */ int Xorriso_option_help(struct XorrisO *xorriso, int flag); diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index f0e8c72e..528a1fcb 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -99,6 +99,13 @@ struct XorrisO { /* the global context of xorriso */ /* >>> put libisofs aspects here <<< */ + int ino_behavior; /* bit0= at image load time: + Do not load PX inode numbers but generate new + unique ones for all loaded IsoNode. + bit1= at image generation time: + Do not consolidate suitable nodes to hardlinks. + */ + int do_joliet; int do_aaip; /* bit0= ACL in diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 779980d3..7853e4bd 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.05.09.201241" +#define Xorriso_timestamP "2009.05.09.201742" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index 6c494c70..cde24280 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -542,8 +542,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) int lba, track, session, params_flag, adr_mode; char volid[33], adr_data[163], *adr_pt; - static int no_rr_or_joliet= 0; - if((flag&3)==0) { sprintf(xorriso->info_text, "XORRISOBURN program error : Xorriso_aquire_drive bit0+bit1 not set"); @@ -706,18 +704,18 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) goto ex; ext= isoburn_ropt_noiso1999; -#ifdef isoburn_ropt_noaaip if(!(xorriso->do_aaip & (1 | 4 | 32))) - ext|= isoburn_ropt_noaaip; -#endif -#ifdef isoburn_ropt_noacl + ext|= isoburn_ropt_noaaip; if(!(xorriso->do_aaip & 1)) - ext|= isoburn_ropt_noacl; -#endif -#ifdef isoburn_ropt_noea + ext|= isoburn_ropt_noacl; if(!(xorriso->do_aaip & 4)) - ext|= isoburn_ropt_noea; + ext|= isoburn_ropt_noea; + +#ifdef isoburn_ropt_noino + if (xorriso->ino_behavior & 1) + ext|= isoburn_ropt_noino; #endif + isoburn_ropt_set_extensions(ropts, ext); isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555); @@ -747,13 +745,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) goto ex; } - /* <<< */ - if(no_rr_or_joliet) { - isoburn_ropt_set_extensions(ropts, - isoburn_ropt_noiso1999 | isoburn_ropt_norock | isoburn_ropt_nojoliet); - } - - ret= isoburn_read_image(drive, ropts, &volset); /* <<< Resetting to normal thresholds */ @@ -1140,7 +1131,7 @@ int Xorriso_auto_format(struct XorrisO *xorriso, int flag) */ int Xorriso_write_session(struct XorrisO *xorriso, int flag) { - int ret, relax= 0, i, pacifier_speed= 0, data_lba; + int ret, relax= 0, i, pacifier_speed= 0, data_lba, ext; int major, minor, micro; char xorriso_id[256], *img_id, sfe[5*SfileadrL], *cpt, *out_cs; struct isoburn_imgen_opts *sopts= NULL; @@ -1374,8 +1365,11 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) } isoburn_igopt_set_level(sopts, 3); - isoburn_igopt_set_extensions(sopts, 1 | ((!!xorriso->do_joliet)<<1) | - ((!!(xorriso->do_aaip & (2 | 8 | 16 | 256))) << 5)); + ext= isoburn_igopt_rockridge | + ((!!xorriso->do_joliet) * isoburn_igopt_joliet) | + (( !(xorriso->ino_behavior & 2)) * isoburn_igopt_hardlinks) | + ((!!(xorriso->do_aaip & (2 | 8 | 16 | 256))) * isoburn_igopt_aaip); + isoburn_igopt_set_extensions(sopts, ext); isoburn_igopt_set_relaxed(sopts, relax); isoburn_igopt_set_sort_files(sopts, 1); isoburn_igopt_set_over_mode(sopts, 0, 0, (mode_t) 0, (mode_t) 0);