diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c
index 8d7795b5..486e893e 100644
--- a/libisoburn/trunk/xorriso/xorriso.c
+++ b/libisoburn/trunk/xorriso/xorriso.c
@@ -5419,6 +5419,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->hln_count= 0;
m->hln_array= NULL;
m->hln_targets= NULL;
+ m->hln_change_pending= 0;
m->di_do_widen= NULL;
m->di_disk_paths= NULL;
m->di_iso_paths= NULL;
@@ -5525,6 +5526,14 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag)
}
+int Xorriso_set_change_pending(struct XorrisO *xorriso, int flag)
+{
+ xorriso->volset_change_pending= 1;
+ xorriso->hln_change_pending= 1;
+ return(1);
+}
+
+
int Xorriso_dialog_input(struct XorrisO *xorriso, char line[], int linesize,
int flag)
/*
@@ -12975,8 +12984,7 @@ int Xorriso_restore_sorted(struct XorrisO *xorriso, int count,
{
int i, ret, with_node_array= 0, hflag= 0, hret;
- if(xorriso->hln_array == NULL &&
- !(((xorriso->ino_behavior & 16) && xorriso->do_restore_sort_lba) ||
+ if(!(((xorriso->ino_behavior & 16) && xorriso->do_restore_sort_lba) ||
(xorriso->ino_behavior & 4) || (flag & 1))) {
ret= Xorriso_make_hln_array(xorriso, 0);
if(ret<=0)
@@ -13007,7 +13015,7 @@ int Xorriso_restore_sorted(struct XorrisO *xorriso, int count,
/* Allocate and fill node array */
if(xorriso->node_counter <= 0)
{ret= 2; goto ex;}
- ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit,
+ ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit, 0,
!xorriso->do_restore_sort_lba);
if(ret<=0)
goto ex;
diff --git a/libisoburn/trunk/xorriso/xorriso_eng.html b/libisoburn/trunk/xorriso/xorriso_eng.html
index c0d22eef..68067eba 100644
--- a/libisoburn/trunk/xorriso/xorriso_eng.html
+++ b/libisoburn/trunk/xorriso/xorriso_eng.html
@@ -420,10 +420,10 @@ files or trees to disk:
Download as source code (see README):
-- xorriso-0.4.0.pl00.tar.gz
+
- xorriso-0.4.0.pl01.tar.gz
(1260 KB).
-- (Released 28 Jun 2009)
+- (Released 20 Jul 2009)
@@ -460,6 +460,15 @@ Bug fixes towards xorriso-0.3.8.pl00:
+
+Bug fix towards xorriso-0.4.0.pl00:
+
+- xorriso -as mkisofs did not understand the -C option of growisofs any more
+
+
+
+
+
Enhancements towards previous stable version xorriso-0.3.8.pl00:
@@ -513,15 +522,19 @@ cdrecord and mkisofs.
Development snapshot, version 0.4.1 :
- Bug fixes towards xorriso-0.4.0.pl00:
-- - none yet -
+- xorriso -as mkisofs did not understand the -C option of growisofs any more
+
-- Enhancements towards stable version 0.4.0.pl00:
+
- Enhancements towards stable version 0.4.0.pl01:
-- - none yet -
+- Options -lsl and lsdl now display correct link counts if -hardlinks is on
+
diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h
index f7ddc32f..2fa327c0 100644
--- a/libisoburn/trunk/xorriso/xorriso_private.h
+++ b/libisoburn/trunk/xorriso/xorriso_private.h
@@ -107,7 +107,7 @@ struct XorrisO { /* the global context of xorriso */
bit3= with update:
Do not try to detect hardlink splits and joinings.
bit4= with extract:
- Do not automatically create hln arrays
+ Do not create or use hln arrays if sort_lba_on
*/
int do_joliet;
@@ -403,6 +403,7 @@ struct XorrisO { /* the global context of xorriso */
int hln_count;
void **hln_array;
void **hln_targets;
+ int hln_change_pending; /* whether a change was made since hln creation */
/* >>> this should count all temp_mem and thus change its name */
off_t node_targets_availmem;
@@ -432,6 +433,8 @@ struct XorrisO { /* the global context of xorriso */
};
+int Xorriso_set_change_pending(struct XorrisO *xorriso, int flag);
+
int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag);
int Xorriso_result(struct XorrisO *xorriso, int flag);
diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h
index afa34259..c58a7a4f 100644
--- a/libisoburn/trunk/xorriso/xorriso_timestamp.h
+++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h
@@ -1 +1 @@
-#define Xorriso_timestamP "2009.07.23.103728"
+#define Xorriso_timestamP "2009.07.25.181857"
diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c
index 165e2c38..f44f3a85 100644
--- a/libisoburn/trunk/xorriso/xorrisoburn.c
+++ b/libisoburn/trunk/xorriso/xorrisoburn.c
@@ -208,21 +208,23 @@ int Xorriso_destroy_di_array(struct XorrisO *xorriso, int flag)
}
-int Xorriso_new_node_array(struct XorrisO *xorriso, off_t mem_limit, int flag)
+int Xorriso_new_node_array(struct XorrisO *xorriso, off_t mem_limit,
+ int addon_nodes, int flag)
{
int i;
if(xorriso->node_counter <= 0)
return(1);
- xorriso->node_array= calloc(xorriso->node_counter, sizeof(IsoNode *));
+ xorriso->node_array= calloc(xorriso->node_counter + addon_nodes,
+ sizeof(IsoNode *));
if(xorriso->node_array == NULL) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
return(-1);
}
- for(i= 0; i < xorriso->node_counter; i++)
+ for(i= 0; i < xorriso->node_counter + addon_nodes; i++)
xorriso->node_array[i]= NULL;
- xorriso->node_array_size= xorriso->node_counter;
+ xorriso->node_array_size= xorriso->node_counter + addon_nodes;
xorriso->node_counter= 0;
return(1);
}
@@ -284,6 +286,25 @@ int Xorriso__findi_sorted_ino_cmp(const void *p1, const void *p2)
}
+/* Not suitable for qsort() but for cross-array comparisons.
+ p1 and p2 are actually IsoNode *p1, IsoNode *p2
+*/
+int Xorriso__hln_cmp(const void *p1, const void *p2)
+{
+ int ret;
+
+ ret= Xorriso__findi_sorted_ino_cmp(&p1, &p2);
+ if(ret)
+ return (ret > 0 ? 1 : -1);
+ if(p1 != p2)
+ return(p1 < p2 ? -1 : 1);
+ return(0);
+}
+
+
+/*
+ p1 and p2 are actually IsoNode **p1, IsoNode **p2
+*/
int Xorriso__findi_sorted_cmp(const void *p1, const void *p2)
{
int ret;
@@ -2416,7 +2437,6 @@ int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf,
IsoNode **node, int flag)
{
int ret, min_hl, max_hl, node_idx, i;
- char img_path[SfileadrL];
IsoImage *volume;
memset((char *) stbuf, 0, sizeof(struct stat));
@@ -2492,10 +2512,7 @@ int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf,
if(i == node_idx)
continue;
/* Check whether node is still valid */
- ret= Xorriso_path_from_node(xorriso, xorriso->hln_array[i], img_path, 0);
- if(ret < 0)
- return(ret);
- if(ret > 0)
+ if(iso_node_get_parent(xorriso->hln_array[i]) != NULL)
stbuf->st_nlink++;
}
}
@@ -2917,7 +2934,7 @@ cannot_lstat:;
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
xorriso->pacifier_total, "", 0);
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
if(source_is_dir) {
if(do_not_dive) {
sprintf(xorriso->info_text, "Did not follow mount point : %s",
@@ -3035,7 +3052,7 @@ int Xorriso_copy_properties(struct XorrisO *xorriso,
}
Xorriso_transfer_properties(xorriso, &stbuf, disk_path, node,
((flag & 2) >> 1) | ((flag & 1) << 5) | (flag & 4));
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
return(1);
}
@@ -3217,7 +3234,7 @@ handle_path_node:;
return(0);
}
dir= hdir;
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
iso_node_set_ctime((IsoNode *) dir, time(NULL));
iso_node_set_uid((IsoNode *) dir, geteuid());
iso_node_set_gid((IsoNode *) dir, getegid());
@@ -3259,7 +3276,7 @@ attach_source:;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
iso_node_set_name(node, apt);
xorriso->pacifier_count++;
@@ -6238,7 +6255,7 @@ dir_not_removed:;
if(flag&16)
xorriso->pacifier_count++;
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
ret= 1+!!is_dir;
ex:;
if(sfe!=NULL)
@@ -7181,7 +7198,7 @@ int Xorriso_set_st_mode(struct XorrisO *xorriso, char *in_path,
sprintf(xorriso->info_text,"Permissions now: %-5.5o %s",
(unsigned int) (mode & 0xffff), Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
Xorriso_process_msg_queues(xorriso,0);
return(1);
}
@@ -7198,7 +7215,7 @@ int Xorriso_set_uid(struct XorrisO *xorriso, char *in_path, uid_t uid,
return(ret);
iso_node_set_uid(node, uid);
iso_node_set_ctime(node, time(NULL));
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
Xorriso_process_msg_queues(xorriso,0);
return(1);
}
@@ -7215,7 +7232,7 @@ int Xorriso_set_gid(struct XorrisO *xorriso, char *in_path, gid_t gid,
return(ret);
iso_node_set_gid(node, gid);
iso_node_set_ctime(node, time(NULL));
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
Xorriso_process_msg_queues(xorriso,0);
return(1);
}
@@ -7239,7 +7256,7 @@ int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t,
iso_node_set_mtime(node, t);
if(!(flag&(2|256)))
iso_node_set_ctime(node, time(NULL));
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
Xorriso_process_msg_queues(xorriso,0);
return(1);
}
@@ -8121,6 +8138,21 @@ ex:;
}
+int Xorriso_node_is_valid(struct XorrisO *xorriso, IsoNode *in_node, int flag)
+{
+ IsoNode *node, *parent;
+
+ for(node= in_node; 1; node= parent) {
+ parent= (IsoNode *) iso_node_get_parent(node);
+ if(parent == node)
+ break;
+ if(parent == NULL)
+ return(0); /* Node is not in the tree (any more) */
+ }
+ return(1);
+}
+
+
int Xorriso_path_from_node(struct XorrisO *xorriso, IsoNode *in_node,
char path[SfileadrL], int flag)
{
@@ -8291,7 +8323,7 @@ int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job,
}
/* Copy matching nodes into allocated array */
- ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit, 0);
+ ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit, 0, 0);
if(ret <= 0)
goto ex;
array_job.action= 31; /* internal: register */
@@ -8361,7 +8393,7 @@ int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag)
return(ret);
iso_image_set_volume_id(volume, volid);
if(!(flag&1))
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"Volume ID: '%s'",iso_image_get_volume_id(volume));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
@@ -10560,7 +10592,7 @@ int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path,
}
ret= 0; goto ex;
}
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
ret= 1;
ex:;
Xorriso_process_msg_queues(xorriso,0);
@@ -10690,7 +10722,7 @@ int Xorriso_setfattr(struct XorrisO *xorriso, void *in_node, char *path,
}
ret= 0; goto ex;
}
- xorriso->volset_change_pending= 1;
+ Xorriso_set_change_pending(xorriso, 0);
ret= 1;
ex:;
Xorriso_process_msg_queues(xorriso,0);
@@ -11725,7 +11757,7 @@ int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp,
}
-int Xorriso_all_node_array(struct XorrisO *xorriso, int flag)
+int Xorriso_all_node_array(struct XorrisO *xorriso, int addon_nodes, int flag)
{
int ret;
struct FindjoB *job= NULL;
@@ -11742,7 +11774,7 @@ int Xorriso_all_node_array(struct XorrisO *xorriso, int flag)
&dir_stbuf, 0, 0);
if(ret <= 0)
goto ex;
- ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit, 0);
+ ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit, addon_nodes, 0);
if(ret <= 0)
goto ex;
Findjob_set_action_target(job, 31, NULL, 0);
@@ -11757,20 +11789,43 @@ ex:;
}
-/* @param flag bit0= overwrite existing hln_array (else return 2)
-*/
-int Xorriso_make_hln_array(struct XorrisO *xorriso, int flag)
+int Xorriso_remake_hln_array(struct XorrisO *xorriso, int flag)
{
- int ret;
+ int ret, addon_nodes= 0, i, old_count, old_pt, new_pt;
+ IsoNode **old_nodes;
+ char **old_targets;
- if(xorriso->hln_array != NULL && !(flag & 1))
- return(2);
- Xorriso_destroy_hln_array(xorriso, 0);
-
- ret= Xorriso_all_node_array(xorriso, 0);
+ /* Count hln_targets of which the node has been deleted meanwhile */
+ for(i= 0; i < xorriso->hln_count; i++) {
+ if(xorriso->hln_targets[i] == NULL)
+ continue;
+ if(Xorriso_node_is_valid(xorriso, xorriso->hln_array[i], 0))
+ continue;
+ addon_nodes++;
+ }
+ ret= Xorriso_all_node_array(xorriso, addon_nodes, 0);
if(ret <= 0)
goto ex;
+ if(addon_nodes > 0) {
+ /* Transfer delete nodes with hln_target to node array */
+ for(i= 0; i < xorriso->hln_count; i++) {
+ if(xorriso->hln_targets[i] == NULL)
+ continue;
+ if(Xorriso_node_is_valid(xorriso, xorriso->hln_array[i], 0))
+ continue;
+ if(xorriso->node_counter < xorriso->node_array_size) {
+ xorriso->node_array[xorriso->node_counter++]= xorriso->hln_array[i];
+ iso_node_ref(xorriso->node_array[xorriso->node_counter - 1]);
+ }
+ }
+ }
+
Xorriso_sort_node_array(xorriso, 0);
+ old_nodes= (IsoNode **) xorriso->hln_array;
+ old_targets= (char **) xorriso->hln_targets;
+ old_count= xorriso->hln_count;
+ xorriso->hln_array= 0;
+ xorriso->hln_targets= NULL;
/* Transfer node_array to di_array without unrefering nodes */
xorriso->hln_count= xorriso->node_counter;
@@ -11784,7 +11839,77 @@ int Xorriso_make_hln_array(struct XorrisO *xorriso, int flag)
if(ret<=0)
goto ex;
xorriso->node_targets_availmem= xorriso->temp_mem_limit;
+ if(old_targets != NULL) {
+ /* Transfer targets from old target array */;
+ new_pt= old_pt= 0;
+ while(new_pt < xorriso->hln_count && old_pt < old_count) {
+ ret= Xorriso__hln_cmp(xorriso->hln_array[new_pt], old_nodes[old_pt]);
+ if(ret < 0) {
+ new_pt++;
+ } else if(ret > 0) {
+ old_pt++;
+ } else {
+ xorriso->hln_targets[new_pt]= old_targets[old_pt];
+ if(old_targets[old_pt] != NULL)
+ xorriso->temp_mem_limit-= strlen(old_targets[old_pt]) + 1;
+ old_targets[old_pt]= NULL;
+ new_pt++;
+ old_pt++;
+ }
+ }
+ for(old_pt= 0; old_pt < old_count; old_pt++)
+ if(old_targets[old_pt] != NULL) /* (should not happen) */
+ free(old_targets[old_pt]);
+ free((char *) old_targets);
+ }
+ if(old_nodes != NULL) {
+ for(old_pt= 0; old_pt < old_count; old_pt++)
+ if(old_nodes[old_pt] != NULL)
+ iso_node_unref(old_nodes[old_pt]);
+ free((char *) old_nodes);
+ }
+ xorriso->hln_change_pending= 0;
+ ret= 1;
+ex:;
+ return(ret);
+}
+
+/* @param flag bit0= overwrite existing hln_array (else return 2)
+*/
+int Xorriso_make_hln_array(struct XorrisO *xorriso, int flag)
+{
+ int ret;
+
+ if(xorriso->hln_array != NULL && !(flag & 1)) {
+ /* If no fresh image manipulations occured: keep old array */
+ if(!xorriso->hln_change_pending)
+ return(2);
+ ret= Xorriso_remake_hln_array(xorriso, 0);
+ return(ret);
+ }
+ Xorriso_destroy_hln_array(xorriso, 0);
+
+ ret= Xorriso_all_node_array(xorriso, 0, 0);
+ if(ret <= 0)
+ goto ex;
+ Xorriso_sort_node_array(xorriso, 0);
+
+ /* Transfer node_array to di_array without unrefering nodes */
+ xorriso->hln_count= xorriso->node_counter;
+ xorriso->hln_array= xorriso->node_array;
+ xorriso->node_counter= 0;
+ xorriso->node_array_size= 0;
+ xorriso->node_array= NULL;
+
+ /* Allocate hln_targets */
+ ret= Xorriso_new_hln_array(xorriso, xorriso->temp_mem_limit, 1);
+ if(ret<=0) {
+ Xorriso_destroy_hln_array(xorriso, 0);
+ goto ex;
+ }
+ xorriso->node_targets_availmem= xorriso->temp_mem_limit;
+ xorriso->hln_change_pending= 0;
ret= 1;
ex:;
return(ret);
@@ -11810,7 +11935,7 @@ int Xorriso_make_di_array(struct XorrisO *xorriso, int flag)
return(2);
Xorriso_finish_hl_update(xorriso, 0);
- ret= Xorriso_all_node_array(xorriso, 0);
+ ret= Xorriso_all_node_array(xorriso, 0, 0);
if(ret <= 0)
goto ex;
bytes= xorriso->node_array_size / 8 + 1;