From 2249a536661001835ed185c58953fd31a83969a7 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 14 Jun 2008 18:44:42 +0000 Subject: [PATCH] Gave up the unusual parameter sequences of -extract and -paste_in --- .../trunk/xorriso/convert_man_to_html.sh | 1 - libisoburn/trunk/xorriso/xorriso.1 | 64 ++++++------- libisoburn/trunk/xorriso/xorriso.c | 95 +++++++++++-------- libisoburn/trunk/xorriso/xorriso.h | 8 +- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 91 insertions(+), 79 deletions(-) diff --git a/libisoburn/trunk/xorriso/convert_man_to_html.sh b/libisoburn/trunk/xorriso/convert_man_to_html.sh index b57ef402..6dee248a 100755 --- a/libisoburn/trunk/xorriso/convert_man_to_html.sh +++ b/libisoburn/trunk/xorriso/convert_man_to_html.sh @@ -71,7 +71,6 @@ then -e 's/Navigation in ISO image/\ 
Navigation in ISO image/' \ -e 's/^filesystem:<\/b>/filesystem:<\/b>

/' \ -e 's/osirrox restore options:<\/b>/\ 
osirrox restore options:<\/b>

/' \ - -e 's/The following restore operations are inverse/\ 
The following restore operations are inverse/' \ -e 's/Command compatibility emulations:<\/b>/\ 
Command compatibility emulations:<\/b>

/' \ -e 's/^

−as
\−asScripting, dialog and/\ 
Scripting, dialog and/' \ diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index 8566091d..e84892bf 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -1644,6 +1644,24 @@ of -cut_out part files. With option "concat_split_off" such directories are handled like any other ISO image directory. .TP +\fB\-extract\fR iso_rr_path disk_path +Restore the file objects at and underneath iso_rr_path to their corresponding +addresses at and underneath disk_path. +This is the inverse of -map or -update_r. +.br +If iso_rr_path is a directory and disk_path is an existing directory then +both trees will be merged. Directory attributes get extracted only if the disk +directory is newly created by the restore operation. +Disk files get removed only if they are to be replaced +by file objects from the ISO image. +.br +As many attributes as possible are copied together with restored +file objects. +.TP +\fB\-extract_single\fR iso_rr_path disk_path +Like -extract, but if iso_rr_path is a directory then its sub tree gets not +restored. +.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 @@ -1664,39 +1682,18 @@ ownership and group as in ISO image. Like -cpx but also extracting whole directory trees from the ISO image. .br The resulting disk paths are determined as with shell command cp -r : -If disk_path is an existing directory then the trees will be inserted +If disk_path is an existing directory then the trees will be inserted or merged underneath this directory and will keep their leaf names. The ISO directory "/" has no leaf name and thus gets mapped directly to disk_path. -.br -If directories do already exist under disk_path then their content -eventually gets merged with the content of restored directories -of the same name. Directory attributes get extracted only if the disk -directory is newly created by the restore operation. -Disk files get removed only if they are to be replaced -by file objects from the ISO image. .TP \fB\-cp_rax\fR iso_rr_path [***] disk_path Like -cp_rx but restoring mtime, atime as in ISO image and trying to set ownership and group as in ISO image. -.PP -The following restore operations are inverse mappings of data manipulation -commands which have the same parameters. I.e. the disk_path stays the first -argument although the operation copies data from ISO image to disk. .TP -\fB\-extract\fR disk_path iso_rr_path -Restore the file objects underneath iso_rr_path to their corresponding -addresses underneath disk_path. Attributes get restored as with cp_rax. -This is the inverse mapping of options -map or -update_r with the same -arguments. -.TP -\fB\-extract_single\fR disk_path iso_rr_path -Like -extract, but if iso_rr_path is a directory then its sub tree gets not -restored. -.TP -\fB\-paste_in\fR disk_path byte_offset byte_count iso_rr_path -Read the content of a ISO data file iso_rr_path and write it into a data -file on disk beginning at the byte_offset. Write at most byte_count bytes. -This is the inverse mapping of option -cut_out with the same arguments. +\fB\-paste_in\fR iso_rr_path disk_path byte_offset byte_count +Read the content of a ISO data file and write it into a data file on disk +beginning at the byte_offset. Write at most byte_count bytes. +This is the inverse of option -cut_out. .TP .B Command compatibility emulations: .PP @@ -2143,17 +2140,20 @@ on media and if the expected changes are much smaller than the full backup. An update run will probably save no time but last longer than a full backup. Another good reason may be given if read speed is much higher than write speed. .br -With \fBmount\fR option \fB"sbsector="\fR it is possible to access the session -trees which represent the older backup versions. Multi-session media and -most overwriteable media written by xorriso can tell -the sbsector by xorriso option -toc. .br +With \fBmount\fR option \fB"sbsector="\fR it is possible to access the session +trees which represent the older backup versions. With CD media, Linux mount +accepts session numbers directly by its option "session=". +.br +Multi-session media and most overwriteable media written by xorriso can tell +the sbsector of a session by xorriso option -toc. Another way to keep track of incremental sessions is to set before writing a suitable path for xorriso option -session_log where the sbsector number gets recorded as the second word in each line. .br -With CD media, Linux mount accepts session numbers directly by its option -"session=". +Independently of mount there is xorriso option \fB-osirrox on\fR which enables +the builtin restore commands -extract, -cpx and others. They operate on the +session eventually selected by option \fB-load\fR. .br \fBDo not write more than about 50 sessions\fR to one multi-session media. Theoretical limits are higher but in practice the media deteriorate more early. diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index c498bd26..133ea796 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -8863,30 +8863,18 @@ ex:; } -/* SPLIT : proposed target format - part_{partno}_of_{total_parts}_at_{offset}_with_{bytes}_of_{total_bytes} -*/ - -/* Options -cut_out, -paste_in */ -/* @param flag bit0= -paste_in rather than cut_out -*/ +/* Option -cut_out */ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path, char *start, char *count, char *iso_rr_path, int flag) { int ret; double num; off_t startbyte, bytecount; - char *cmd; - - if(flag&1) - cmd= "paste_in"; - else - cmd= "cut_out"; num= Scanf_io_size(start, 0); if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */ sprintf(xorriso->info_text, - "-%s: startbyte address negative or much too large (%s)", cmd, start); + "-cut_out: startbyte address negative or much too large (%s)", start); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); return(0); } @@ -8894,29 +8882,19 @@ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path, num= Scanf_io_size(count, 0); if(num<=0 || num > 1.0e18) { sprintf(xorriso->info_text, - "-%s: bytecount zero, negative or much too large (%s)", cmd, count); + "-cut_out: bytecount zero, negative or much too large (%s)", count); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); return(0); } bytecount= num; - if(flag&1) { - sprintf(xorriso->info_text, "-paste_in from %s to %s, byte %.f to %.f", - disk_path, iso_rr_path, - (double) startbyte, (double) (startbyte+bytecount)); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + sprintf(xorriso->info_text, + "-cut_out from %s , byte %.f to %.f, and graft as %s", + disk_path, (double) startbyte, (double) (startbyte+bytecount), + iso_rr_path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); - ret= Xorriso_paste_in(xorriso, disk_path, startbyte, bytecount, - iso_rr_path, 0); - } else { - sprintf(xorriso->info_text, - "-cut_out from %s , byte %.f to %.f, and graft as %s", - disk_path, (double) startbyte, (double) (startbyte+bytecount), - iso_rr_path); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); - - ret= Xorriso_cut_out(xorriso, disk_path, startbyte, bytecount, - iso_rr_path, 0); - } + ret= Xorriso_cut_out(xorriso, disk_path, startbyte, bytecount, + iso_rr_path, 0); return(ret); } @@ -9222,8 +9200,8 @@ int Xorriso_option_error_behavior(struct XorrisO *xorriso, bit1=do not reset pacifier, no final pacifier message bit5= -extract_single: eventually do not insert directory tree */ -int Xorriso_option_extract(struct XorrisO *xorriso, char *disk_path, - char *iso_path, int flag) +int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path, + char *disk_path, int flag) { int ret; char eff_origin[SfileadrL], eff_dest[SfileadrL], *ipth; @@ -9843,6 +9821,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " By default \"off\" the inverse operation of xorriso from ISO", " image to disk filesystem is disabled. \"on\" allows xorriso", " to create, overwrite, delete files in the disk filesystem.", +" -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.", " -cpx iso_rr_path [***] disk_path", " Copy leaf file objects from ISO image to disk filesystem.", " -cpax iso_rr_path [***] disk_path", @@ -9851,14 +9832,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " Copy directory trees from ISO image to disk filesystem.", " -cp_rax iso_rr_path [***] disk_path", " Like -cp_rx but trying to restore timestamps and ownership.", -"The following restore options get the same arguments as their counterparts", -"which put files into ISO images. Thus first disk_path and then iso_rr_path:", -" -extract disk_path iso_rr_path", -" Copy tree under iso_rr_path onto disk address disk_path.", -" This avoids the pitfalls of cp -r addressing rules.", " -extract_single disk_path iso_rr_path", " Like -extract but with directory do not insert its sub tree.", -" -paste_in disk_path byte_offset byte_count iso_rr_path", +" -paste_in iso_rr_path disk_path byte_offset byte_count", " Copy ISO file content into a byte interval of a disk file.", "", "Compatibility emulation (argument list may be ended by --):", @@ -10826,6 +10802,41 @@ int Xorriso_option_page(struct XorrisO *xorriso, int len, int width, int flag) } +/* Option -paste_in */ +int Xorriso_option_paste_in(struct XorrisO *xorriso, char *iso_rr_path, + char *disk_path, char *start, char *count, int flag) +{ + int ret; + double num; + off_t startbyte, bytecount; + + num= Scanf_io_size(start, 0); + if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */ + sprintf(xorriso->info_text, + "-paste_in: startbyte address negative or much too large (%s)", start); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + startbyte= num; + num= Scanf_io_size(count, 0); + if(num<=0 || num > 1.0e18) { + sprintf(xorriso->info_text, + "-paste_in : bytecount zero, negative or much too large (%s)", count); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + bytecount= num; + sprintf(xorriso->info_text, "-paste_in from %s to %s, byte %.f to %.f", + disk_path, iso_rr_path, + (double) startbyte, (double) (startbyte+bytecount)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + ret= Xorriso_paste_in(xorriso, disk_path, startbyte, bytecount, + iso_rr_path, 0); + return(ret); +} + + /* Option -path-list */ int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag) { @@ -12138,8 +12149,8 @@ next_command:; Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); ret= 0; } else - ret= Xorriso_option_cut_out(xorriso, arg1, arg2, - argv[(*idx)-2], argv[(*idx)-1], 1); + ret= Xorriso_option_paste_in(xorriso, arg1, arg2, + argv[(*idx)-2], argv[(*idx)-1], 0); } else if(strcmp(cmd,"path-list")==0 || strcmp(cmd,"path_list")==0) { (*idx)++; diff --git a/libisoburn/trunk/xorriso/xorriso.h b/libisoburn/trunk/xorriso/xorriso.h index 258bd5f3..bceb980a 100644 --- a/libisoburn/trunk/xorriso/xorriso.h +++ b/libisoburn/trunk/xorriso/xorriso.h @@ -240,9 +240,7 @@ int Xorriso_option_cpri( struct XorrisO *xorriso, int argc, char **argv, int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag); -/* Options -cut_out, -paste_in */ -/* @param flag bit0= -paste_in rather than cut_out -*/ +/* Option -cut_out */ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path, char *start, char *count, char *iso_rr_path, int flag); @@ -401,6 +399,10 @@ int Xorriso_option_padding(struct XorrisO *xorriso, char *size, int flag); /* Option -page */ int Xorriso_option_page(struct XorrisO *xorriso, int len, int width, int flag); +/* Option -paste_in */ +int Xorriso_option_paste_in(struct XorrisO *xorriso, char *iso_rr_path, + char *disk_path, char *start, char *count, int flag); + /* Option -path-list */ int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag); diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index d7928108..b8a378d4 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.06.14.140459" +#define Xorriso_timestamP "2008.06.14.184512"