Commit 67d7e882 authored by Thomas Schmitt's avatar Thomas Schmitt

Gave up risky direct update of hardlink siblings

parent 40e0333e
......@@ -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 "May 29, 2009"
.TH XORRISO 1 "Jun 22, 2009"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
......@@ -42,7 +42,9 @@ incorporates the libraries of libburnia-project.org .
.br
Operates on an existing ISO image or creates a new one.
.br
Copies files from filesystem into the ISO image.
Copies files from disk filesystem into the ISO image.
.br
Copies files from ISO image to disk filesystem (see osirrox).
.br
Renames or deletes file objects in the ISO image.
.br
......@@ -57,9 +59,7 @@ Can activate ISOLINUX boot images via El Torito.
.br
Can perform multi-session tasks as emulation of mkisofs and cdrecord.
.br
Can restore files from ISO image to disk filesystem (see osirrox).
.br
Can record and restore ACL of disk files.
Can record and restore hard links and ACL.
.br
Content may get zisofs compressed or filtered by external processes.
.br
......@@ -668,7 +668,7 @@ 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"|"without_update"|"start_update"|"end_update"
\fB\-hardlinks\fR "on"|"off"|"without_update"|"start_update"|"end_update" |"start_extract"|"end_extract"
Enable or disable loading and recording of hardlink relations.
.br
In default mode "off", iso_rr files lose their inode numbers at image load
......@@ -690,10 +690,15 @@ and -hardlinks "end_update". This avoids multiple sorting of ISO image nodes.
Mode "without_update" avoids hardlink processing during update commands.
.br
xorriso commands which extract files from an ISO image try to hardlink files
with identical inode number. This applies only to files which
get extracted during execution of that same command. A large number of
hardlink families may exhaust -temp_mem_limit if not -osirrox option
"sort_lba_on" is in effect.
with identical inode number. Normally this applies only to files which
get extracted during execution of that same command. One may surround a group
of extraction commands by -hardlinks "start_extract" and
-hardlinks "end_extract" to allow hard linking among their extracted files.
-osirrox "sort_lba_on" and -hardlinks "start_extract" mutually disable
each other.
.br
A large number of hardlink families may exhaust -temp_mem_limit
if not -osirrox option "sort_lba_on" is in effect.
.br
Hardlink processing automatically enables \fB\-compliance new_rr\fR.
This may be overridden by a following -compliance old_rr . In this case
......
......@@ -5398,6 +5398,9 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->hln_count= 0;
m->hln_array= NULL;
m->hln_targets= NULL;
m->di_do_widen= NULL;
m->di_disk_paths= NULL;
m->di_iso_paths= NULL;
m->node_targets_availmem= 0;
......@@ -8351,6 +8354,28 @@ ex:;
}
int Xorriso_pfx_disk_path(struct XorrisO *xorriso, char *iso_path,
char *iso_prefix, char *disk_prefix,
char disk_path[SfileadrL], int flag)
{
int ret;
char adrc[SfileadrL];
if(strncmp(iso_path, iso_prefix, strlen(iso_prefix))!=0)
return(-1);
if(strlen(disk_prefix) + strlen(iso_path) - strlen(iso_prefix)+1 >= SfileadrL)
return(-1);
if(iso_path[strlen(iso_prefix)] == '/')
strcpy(adrc, iso_path + strlen(iso_prefix) + 1);
else
strcpy(adrc, iso_path + strlen(iso_prefix));
ret= Xorriso_make_abs_adr(xorriso, disk_prefix, adrc, disk_path, 4 | 8);
if(ret <= 0)
return(ret);
return(1);
}
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image
Set to NULL if calling this function from outside ISO world
@param flag bit0= update rather than compare
......@@ -8363,19 +8388,11 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
int flag)
{
int ret, result, uret, follow_links, deleted= 0;
char disk_path[SfileadrL], adrc[SfileadrL];
if(strncmp(iso_path, iso_prefix, strlen(iso_prefix))!=0)
return(-1);
if(strlen(disk_prefix)+strlen(iso_path)-strlen(iso_prefix)+1>=SfileadrL)
return(-1);
if(iso_path[strlen(iso_prefix)]=='/')
strcpy(adrc, iso_path+strlen(iso_prefix)+1);
else
strcpy(adrc, iso_path+strlen(iso_prefix));
char disk_path[SfileadrL];
ret= Xorriso_make_abs_adr(xorriso, disk_prefix, adrc, disk_path, 4|8);
if(ret<=0)
ret= Xorriso_pfx_disk_path(xorriso, iso_path, iso_prefix, disk_prefix,
disk_path, 0);
if(ret <= 0)
return(ret);
/* compare exclusions against disk_path resp. leaf name */
......@@ -8390,7 +8407,7 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
follow_links= (xorriso->do_follow_links ||
(xorriso->do_follow_param && !(flag&2))) <<28;
ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, adrc, &result,
ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, "", &result,
2 | follow_links | ((!(flag&2))<<27) | ((flag&1)<<31));
/* was once: | ((!(flag&1))<<29) */
if(ret<xorriso->find_compare_result)
......@@ -15359,13 +15376,16 @@ not_enough_exec_arguments:;
Findjob_set_action_subjob(job, 13, new_job, 0);
job= new_job;
} else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0) {
} else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0 ||
strcmp(cpt, "widen_hardlinks")==0) {
if(i+1>=end_idx)
goto not_enough_exec_arguments;
i++;
action= 14;
if(strcmp(cpt, "update")==0)
action= 17;
if(strcmp(cpt, "widen_hardlinks")==0)
action= 32;
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, argv[i],
other_path_start, 1|2|4|8);
if(ret<=0)
......@@ -15689,14 +15709,14 @@ int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag)
} else if(strcmp(mode, "without_update") == 0) {
xorriso->ino_behavior&= ~(1 | 2 | 4);
xorriso->ino_behavior|= 8;
Xorriso_destroy_di_array(xorriso, 0);
Xorriso_finish_hl_update(xorriso, 0);
} else if(strcmp(mode, "start_update") == 0) {
xorriso->ino_behavior&= ~(1 | 2 | 4 | 8);
ret= Xorriso_make_di_array(xorriso, 1);
if(ret <= 0)
return(ret);
} else if(strcmp(mode, "end_update") == 0) {
Xorriso_destroy_di_array(xorriso, 0);
Xorriso_finish_hl_update(xorriso, 0);
} else if(strcmp(mode, "start_extract") == 0) {
xorriso->do_restore_sort_lba= 0;
xorriso->ino_behavior&= ~(1 | 2 | 4);
......@@ -16810,7 +16830,7 @@ ex:;
Sfile_destroy_argv(&i, &eff_tgt_array, 0);
(*idx)= end_idx;
if(made_di_array)
Xorriso_destroy_di_array(xorriso, 0);
Xorriso_finish_hl_update(xorriso, 0);
if(made_hln_array)
Xorriso_destroy_hln_array(xorriso, 0);
Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &optc, &optv, 256);
......@@ -18558,7 +18578,7 @@ int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag)
int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag)
{
int ret, mem_pci, zero= 0, result, uret, follow_links;
int ret, mem_pci, zero= 0, result, uret, follow_links, do_register= 1;
int not_in_iso= 0, not_on_disk= 0, made_di_array= 0;
double mem_lut= 0.0, start_time;
char *ipth, *argv[6], sfe[5*SfileadrL];
......@@ -18605,13 +18625,33 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
if(ret!=0)
goto report_outcome;
if(!((xorriso->ino_behavior & 2) || (flag & 16) ||
xorriso->di_array != NULL)) {
/* Create all-image node array sorted by isofs.di */
made_di_array= 1;
ret= Xorriso_make_di_array(xorriso, 0);
if(ret <= 0)
goto ex;
if(!(xorriso->ino_behavior & 2)) {
if(!(xorriso->di_array != NULL || (flag & 16))) {
/* Create all-image node array sorted by isofs.di */
made_di_array= 1;
ret= Xorriso_make_di_array(xorriso, 0);
if(ret <= 0)
goto ex;
}
if(xorriso->di_array != NULL) {
if(!(flag & 8)) {
/* If directory with -update : do not register di_*_paths */
ret= lstat(eff_origin, &stbuf);
if(ret != -1)
if(S_ISDIR(stbuf.st_mode))
do_register= 0;
}
if(do_register) {
ret= Xorriso_lst_append_binary(&(xorriso->di_disk_paths), eff_origin,
strlen(eff_origin) + 1, 0);
if(ret <= 0)
goto ex;
ret= Xorriso_lst_append_binary(&(xorriso->di_iso_paths), eff_dest,
strlen(eff_dest) + 1, 0);
if(ret <= 0)
goto ex;
}
}
}
if(flag&8) {
......@@ -18703,7 +18743,7 @@ report_outcome:;
ex:;
if(made_di_array) {
/* Dispose all-image node array sorted by isofs.di */
Xorriso_destroy_di_array(xorriso, 0);
Xorriso_finish_hl_update(xorriso, 0);
}
if(ret < 0)
return(ret);
......
......@@ -391,18 +391,31 @@ struct XorrisO { /* the global context of xorriso */
int find_compare_result; /* 1=everything matches , 0=mismatch , -1=error */
/* LBA sorting and hardlink matching facility */
/* Tree node collection and LBA sorting facility */
int node_counter;
int node_array_size;
void **node_array;
char **node_targets; /* Memorizes eventual hardlink target paths */
off_t node_targets_availmem;
struct Xorriso_lsT *node_disk_prefixes;
struct Xorriso_lsT *node_img_prefixes;
/* Array of all nodes in the tree, sorted by disk dev,ino */
/* Hardlink matching at restore time memorizes hardlink target paths.
Array of nodes sorted by LBA. */
int hln_count;
void **hln_array;
void **hln_targets;
/* >>> this should count all temp_mem and thus change its name */
off_t node_targets_availmem;
/* Hardlink matching at update time:
Array of all nodes in the tree, sorted by disk dev,ino.
Bitmap of nodes which possibly got new hardlink siblings.
List of involved disk-iso path pairs. */
int di_count;
void **di_array;
char *di_do_widen;
struct Xorriso_lsT *di_disk_paths;
struct Xorriso_lsT *di_iso_paths;
struct PermiteM *perm_stack; /* Temporarily altered dir access permissions */
......@@ -518,6 +531,10 @@ int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done,
off_t count, off_t todo, char *current_object,
int flag);
int Xorriso_pfx_disk_path(struct XorrisO *xorriso, char *iso_path,
char *iso_prefix, char *disk_prefix,
char disk_path[SfileadrL], int flag);
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image
Set to NULL if calling this function from outside ISO world
@param flag bit0= update rather than compare
......@@ -918,6 +935,7 @@ struct FindjoB {
29= show_stream
30= internal: count by xorriso->node_counter
31= internal: register in xorriso->node_array
32= internal: widen_hardlinks disk_equiv: update nodes marked in di_do_widen
*/
int action;
int prune;
......
#define Xorriso_timestamP "2009.06.20.063853"
#define Xorriso_timestamP "2009.06.22.112850"
This diff is collapsed.
......@@ -482,6 +482,8 @@ int Xorriso_make_hln_array(struct XorrisO *xorriso, int flag);
int Xorriso_hardlink_update(struct XorrisO *xorriso, int *compare_result,
char *disk_path, char *iso_rr_path, int flag);
int Xorriso_finish_hl_update(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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment