New options -map_l, -compare_l, -update_l, -extract_l

This commit is contained in:
Thomas Schmitt 2008-06-17 12:15:16 +00:00
parent 818de9128d
commit a14af44951
4 changed files with 183 additions and 26 deletions

View File

@ -611,6 +611,10 @@ is a directory then its whole sub tree is inserted into the ISO image.
\fB\-map_single\fR disk_path iso_rr_path
Like -map, but if disk_path is a directory then its sub tree is not inserted.
.TP
\fB\-map_l\fR disk_prefix iso_rr_prefix disk_path [***]
Performs -map with each of the disk_path arguments. iso_rr_path will be
composed from disk_path by replacing disk_prefix by iso_rr_prefix.
.TP
\fB\-update\fR disk_path iso_rr_path
Compare file object disk_path with file object iso_rr_path. If they do not
match, then perform the necessary image manipulations to make iso_rr_path
@ -634,10 +638,10 @@ should always be the same as with the first adding of disk_path as iso_rr_path.
.br
If iso_rr_path does not exist yet, then it gets added. If disk_path does not
exist, then iso_rr_path gets deleted.
.br
-update_r is also a convenient compromise between -add addressing and -cpr
addressing: Its semantics is similar to -add and thus avoids the pitfalls
inherited from cp -r behavior. Its syntax resembles cp, though.
.TP
\fB\-update_l\fR disk_prefix iso_rr_prefix disk_path [***]
Performs -update_r with each of the disk_path arguments. iso_rr_path will be
composed from disk_path by replacing disk_prefix by iso_rr_prefix.
.TP
\fB\-cut_out\fR disk_path byte_offset byte_count iso_rr_path
Map a byte interval of a regular disk file into a regular file in the ISO
@ -910,7 +914,7 @@ Switch from eventual modifiying mode to growing mode.
are uncommitted manipulations pending.
So, to perform a final write operation with no new -dev
and no new loading of image, rather execute option -end.
To suppress a final write, execute -rollback -end.
To suppress a final write, execute -rollback_end.
To eject outdev after write without new loading of image, use -commit_eject.
.br
@ -948,7 +952,7 @@ Defined modes are:
.br
"as_needed" cares for used CD-RW, DVD-RW and for used overwriteable media
by applying -blank "fast". It applies -format "full" to yet unformatted
DVD-RAM or BD-RE.
DVD-RAM or BD-RE. Other media or states are gracefully ignored.
.br
"fast" and "all" make CD-RW and unformatted DVD-RW re-usable,
or invalidate overwriteable ISO images.
@ -1423,6 +1427,21 @@ use -rollback to revoke the whole session.
.TP
.B Drive and media related inquiry actions:
.TP
\fB\-devices\fR
Show list of available MMC drives with the addresses of
their libburn standard device files.
.br
This is only possible when no ISO image changes are pending.
After this option was executed, there is no drive current
and no image loaded. Eventually one has to aquire a drive again.
.br
In order to be visible, a device has to offer rw-permissions
with its libburn standard device file. Thus it might be only the
.B superuser
who is able to see all drives.
.br
Drives which are occupied by other processes get not shown.
.TP
\fB\-toc\fR
.br
Show media specific table of content. This is the media session history,
@ -1440,21 +1459,6 @@ to be the most recent real session then.
Some read-only drives and media show no usable session history at all.
Eventually option -rom_toc_scan might help.
.TP
\fB\-devices\fR
Show list of available MMC drives with the addresses of
their libburn standard device files.
.br
This is only possible when no ISO image changes are pending.
After this option was executed, there is no drive current
and no image loaded. Eventually one has to aquire a drive again.
.br
In order to be visible, a device has to offer rw-permissions
with its libburn standard device file. Thus it might be only the
.B superuser
who is able to see all drives.
.br
Drives which are occupied by other processes get not shown.
.TP
\fB\-print_size\fR
Print the foreseeable consumption of 2048 byte blocks
by next -commit. This can last a while as a -commit gets
@ -1606,6 +1610,10 @@ Like -compare but working recursively. I.e. all file objects below both
addresses get compared whether they have counterparts below the other address
and whether both counterparts match.
.TP
\fB\-compare_l\fR disk_prefix iso_rr_prefix disk_path [***]
Performs -compare_r with each of the disk_path arguments. iso_rr_path will be
composed from disk_path by replacing disk_prefix by iso_rr_prefix.
.TP
.B osirrox restore options:
.PP
Normally xorriso only writes to disk files which were given as stdio:
@ -1662,6 +1670,10 @@ file objects.
Like -extract, but if iso_rr_path is a directory then its sub tree gets not
restored.
.TP
\fB\-extract_l\fR iso_rr_prefix disk_prefix iso_rr_path [***]
Performs -extract with each of the iso_rr_path arguments. disk_path will be
composed from iso_rr_path by replacing iso_rr_prefix by disk_prefix.
.TP
\fB\-cpx\fR iso_rr_path [***] disk_path
Extract single leaf file objects from the ISO image and store them under
the address given by disk_path. If more then one iso_rr_path is given then

View File

@ -9659,11 +9659,15 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Insert disk file object at the given iso_rr_path.",
" -map_single disk_path iso_rr_path",
" Like -map but with directory do not insert its sub tree.",
" -map_l disk_prefix iso_rr_prefix disk_path [***]",
" Performs -map with each disk_path.",
" -update disk_path iso_rr_path",
" Compare both file objects and do what is necessary to make",
" iso_rr_path a matching copy of disk_path.",
" -update_r disk_path iso_rr_path",
" Like -update but affecting all files below directories.",
" -update_l disk_prefix iso_rr_prefix disk_path [***]",
" Performs -update_r with each disk_path.",
" -cut_out disk_path byte_offset byte_count iso_rr_path",
" Map a byte interval of a regular disk file into a regular",
" file in the ISO image.",
@ -9815,6 +9819,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" content of filesystem object and ISO object.",
" -compare_r disk_path iso_rr_path ",
" Like -compare but affecting all files below directories.",
" -compare_l disk_prefix iso_rr_prefix disk_path [***]",
" Performs -compare_r with each disk_path.",
"",
"Restore options which copy file objects from ISO image to disk filesystem:",
" -osirrox \"on\"|\"device_files\"|\"off\":\"concat_split_on\"|\"concat_split_off\"",
@ -9824,6 +9830,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -extract iso_rr_path disk_path",
" Copy tree under iso_rr_path onto disk address disk_path.",
" This avoids the pitfalls of cp -r addressing rules.",
" -extract_l iso_rr_prefix disk_prefix iso_rr_path [***]",
" Perform -extract_r with each iso_rr_path.",
" -extract_single iso_rr_path disk_path",
" Like -extract but with directory do not restore sub tree.",
" -cpx iso_rr_path [***] disk_path",
" Copy leaf file objects from ISO image to disk filesystem.",
" -cpax iso_rr_path [***] disk_path",
@ -10319,6 +10329,120 @@ int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path,
}
/* Options -map_l , -compare_l , -update_l , -extract_l */
/* @param flag bit8-11= mode 0= -map_l
1= -compare_l
2= -update_l
3= -extract_l
*/
int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int ret, end_idx, optc= 0, was_failure= 1, i, fret, mode;
int ns_flag= 2|4, nt_flag= 2;
char source_prefix[SfileadrL], target_prefix[SfileadrL], *cmd, **optv= NULL;
char eff_source[SfileadrL], eff_target[SfileadrL], *source_pt, *s_wd, *t_wd;
char sfe[5*SfileadrL];
cmd= "-map_l";
s_wd= xorriso->wdx;
t_wd= xorriso->wdi;
Xorriso_pacifier_reset(xorriso, 0);
mode= (flag>>8) & 15;
if(mode==1)
cmd= "-compare_l";
else if(mode==2)
cmd= "-update_l";
else if(mode==3) {
cmd= "-extract_l";
ns_flag= 2;
s_wd= xorriso->wdi;
nt_flag= 2|4;
t_wd= xorriso->wdx;
}
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1|2);
if(end_idx - (*idx) < 3) {
sprintf(xorriso->info_text, "%s: Not enough arguments given (%d < 3)", cmd,
end_idx - (*idx));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1);
ret= 0; goto ex;
}
ret= Xorriso_normalize_img_path(xorriso, s_wd, argv[*idx],
source_prefix, ns_flag);
if(ret<=0)
goto ex;
ret= Xorriso_normalize_img_path(xorriso, t_wd, argv[(*idx)+1],
target_prefix, nt_flag);
if(ret<=0)
goto ex;
ret= Xorriso_opt_args(xorriso, cmd, argc, argv, (*idx)+2, &end_idx,
&optc, &optv, 2);
if(ret<=0)
goto ex;
for(i= 0; i<optc; i++) {
ret= Xorriso_normalize_img_path(xorriso, s_wd, optv[i],
eff_source, ns_flag);
if(ret<=0)
goto ex;
strcpy(eff_target, target_prefix);
source_pt= eff_source;
if(source_prefix[0]) {
if(strncmp(source_prefix, eff_source, strlen(source_prefix))!=0) {
sprintf(xorriso->info_text,
"%s: disk_path does not begin with disk_prefix", cmd);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1);
ret= 0; goto ex;
}
source_pt+= strlen(source_prefix);
}
strcat(eff_target, source_pt);
#ifdef NIX
if(1)
fprintf(stderr, "xorriso_debug: %s %s %s\n", cmd, eff_source, eff_target);
else
#endif
if(mode==0)
ret= Xorriso_option_map(xorriso, eff_source, eff_target, 2);
else if(mode==1)
ret= Xorriso_option_compare(xorriso, eff_source, eff_target, 2|8);
else if(mode==2)
ret= Xorriso_option_update(xorriso, eff_source, eff_target, 2|8);
else if(mode==2)
ret= Xorriso_option_extract(xorriso, eff_source, eff_target, 2);
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 2);
if(fret>=0)
continue;
goto ex;
}
if(mode==0)
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
else if(mode==1 || mode==2)
Xorriso_pacifier_callback(xorriso, "content bytes read",
xorriso->pacifier_count, 0, "", 1);
else if(mode==3)
Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &optc, &optv,
256);
if(ret<=0)
return(ret);
return(!was_failure);
}
/* Option -mark */
int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag)
{
@ -11737,11 +11861,11 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
static char argn_commands[][40]= {
"add","as","chgrp","chgrpi","chgrp_r","chgrp_ri","chmod","chmodi",
"chmod_r","chmod_ri","chown","chowni","chown_r","chown_ri",
"cpr","cpri","cp_rax","cp_rx","cpax","cpx",
"du","dui","dus","dusi","dux","dusx","find","findi","findx",
"compare_l","cpr","cpri","cp_rax","cp_rx","cpax","cpx",
"du","dui","dus","dusi","dux","dusx","extract_l","find","findi","findx",
"ls","lsi","lsl","lsli","lsd","lsdi","lsdl","lsdli",
"lsx","lslx","lsdx","lsdlx","mv","mvi","mkdir","mkdiri",
"not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri",
"lsx","lslx","lsdx","lsdlx","map_l","mv","mvi","mkdir","mkdiri",
"not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri","update_l",
""
};
@ -11923,6 +12047,9 @@ next_command:;
(*idx)+= 2;
ret= Xorriso_option_compare(xorriso, arg1, arg2, 1);
} else if(strcmp(cmd,"compare_l")==0) {
ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 1<<8);
} else if(strcmp(cmd,"compare_r")==0) {
(*idx)+= 2;
ret= Xorriso_option_compare(xorriso, arg1, arg2, 1|8);
@ -11999,6 +12126,9 @@ next_command:;
(*idx)+= 2;
ret= Xorriso_option_extract(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"extract_l")==0) {
ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 3<<8);
} else if(strcmp(cmd,"extract_single")==0) {
(*idx)+= 2;
ret= Xorriso_option_extract(xorriso, arg1, arg2, 32);
@ -12074,6 +12204,9 @@ next_command:;
(*idx)+= 2;
ret= Xorriso_option_map(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"map_l")==0) {
ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 0);
} else if(strcmp(cmd,"map_single")==0) {
(*idx)+= 2;
ret= Xorriso_option_map(xorriso, arg1, arg2, 32);
@ -12279,6 +12412,9 @@ next_command:;
(*idx)+= 2;
ret= Xorriso_option_update(xorriso, arg1, arg2, 1);
} else if(strcmp(cmd,"update_l")==0) {
ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 2<<8);
} else if(strcmp(cmd,"update_r")==0) {
(*idx)+= 2;
ret= Xorriso_option_update(xorriso, arg1, arg2, 1|8);

View File

@ -361,6 +361,15 @@ int Xorriso_option_lsx(struct XorrisO *xorriso, int argc, char **argv,
int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag);
/* Options -map_l , -compare_l , -update_l , -extract_l */
/* @param flag bit8-11= mode 0= -map_l
1= -compare_l
2= -update_l
3= -extract_l
*/
int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag);
/* Option -mark */
int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.06.14.184512"
#define Xorriso_timestamP "2008.06.17.121524"