Gave up the unusual parameter sequences of -extract and -paste_in

This commit is contained in:
Thomas Schmitt 2008-06-14 18:44:42 +00:00
parent a15e636952
commit 818de9128d
5 changed files with 91 additions and 79 deletions

View File

@ -71,7 +71,6 @@ then
-e 's/<b>Navigation in ISO image/\&nbsp;<BR><b>Navigation in ISO image/' \ -e 's/<b>Navigation in ISO image/\&nbsp;<BR><b>Navigation in ISO image/' \
-e 's/^filesystem:<\/b>/filesystem:<\/b><BR>\&nbsp;<BR>/' \ -e 's/^filesystem:<\/b>/filesystem:<\/b><BR>\&nbsp;<BR>/' \
-e 's/<b>osirrox restore options:<\/b>/\&nbsp;<BR><b>osirrox restore options:<\/b><BR>\&nbsp;<BR>/' \ -e 's/<b>osirrox restore options:<\/b>/\&nbsp;<BR><b>osirrox restore options:<\/b><BR>\&nbsp;<BR>/' \
-e 's/The following restore operations are inverse/\&nbsp;<BR>The following restore operations are inverse/' \
-e 's/<b>Command compatibility emulations:<\/b>/\&nbsp;<BR><b>Command compatibility emulations:<\/b><BR>\&nbsp;<BR>/' \ -e 's/<b>Command compatibility emulations:<\/b>/\&nbsp;<BR><b>Command compatibility emulations:<\/b><BR>\&nbsp;<BR>/' \
-e 's/^<p><b>&minus;as</<p>\&nbsp;<BR><b>\&minus;as</' \ -e 's/^<p><b>&minus;as</<p>\&nbsp;<BR><b>\&minus;as</' \
-e 's/<b>Scripting, dialog and/\&nbsp;<BR><b>Scripting, dialog and/' \ -e 's/<b>Scripting, dialog and/\&nbsp;<BR><b>Scripting, dialog and/' \

View File

@ -1644,6 +1644,24 @@ of -cut_out part files.
With option "concat_split_off" such directories are With option "concat_split_off" such directories are
handled like any other ISO image directory. handled like any other ISO image directory.
.TP .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 \fB\-cpx\fR iso_rr_path [***] disk_path
Extract single leaf file objects from the ISO image and store them under 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 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. Like -cpx but also extracting whole directory trees from the ISO image.
.br .br
The resulting disk paths are determined as with shell command cp -r : 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 "/" underneath this directory and will keep their leaf names. The ISO directory "/"
has no leaf name and thus gets mapped directly to disk_path. 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 .TP
\fB\-cp_rax\fR iso_rr_path [***] disk_path \fB\-cp_rax\fR iso_rr_path [***] disk_path
Like -cp_rx but restoring mtime, atime as in ISO image and trying to set Like -cp_rx but restoring mtime, atime as in ISO image and trying to set
ownership and group as in ISO image. 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 .TP
\fB\-extract\fR disk_path iso_rr_path \fB\-paste_in\fR iso_rr_path disk_path byte_offset byte_count
Restore the file objects underneath iso_rr_path to their corresponding Read the content of a ISO data file and write it into a data file on disk
addresses underneath disk_path. Attributes get restored as with cp_rax. beginning at the byte_offset. Write at most byte_count bytes.
This is the inverse mapping of options -map or -update_r with the same This is the inverse of option -cut_out.
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.
.TP .TP
.B Command compatibility emulations: .B Command compatibility emulations:
.PP .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. 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. Another good reason may be given if read speed is much higher than write speed.
.br .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 .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 Another way to keep track of incremental sessions is to
set before writing a suitable path for xorriso option -session_log where set before writing a suitable path for xorriso option -session_log where
the sbsector number gets recorded as the second word in each line. the sbsector number gets recorded as the second word in each line.
.br .br
With CD media, Linux mount accepts session numbers directly by its option Independently of mount there is xorriso option \fB-osirrox on\fR which enables
"session=". the builtin restore commands -extract, -cpx and others. They operate on the
session eventually selected by option \fB-load\fR.
.br .br
\fBDo not write more than about 50 sessions\fR to one multi-session media. \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. Theoretical limits are higher but in practice the media deteriorate more early.

View File

@ -8863,30 +8863,18 @@ ex:;
} }
/* SPLIT : proposed target format /* Option -cut_out */
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
*/
int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path, int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
char *start, char *count, char *iso_rr_path, int flag) char *start, char *count, char *iso_rr_path, int flag)
{ {
int ret; int ret;
double num; double num;
off_t startbyte, bytecount; off_t startbyte, bytecount;
char *cmd;
if(flag&1)
cmd= "paste_in";
else
cmd= "cut_out";
num= Scanf_io_size(start, 0); num= Scanf_io_size(start, 0);
if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */ if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */
sprintf(xorriso->info_text, 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); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0); return(0);
} }
@ -8894,29 +8882,19 @@ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
num= Scanf_io_size(count, 0); num= Scanf_io_size(count, 0);
if(num<=0 || num > 1.0e18) { if(num<=0 || num > 1.0e18) {
sprintf(xorriso->info_text, 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); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0); return(0);
} }
bytecount= num; bytecount= num;
if(flag&1) { sprintf(xorriso->info_text,
sprintf(xorriso->info_text, "-paste_in from %s to %s, byte %.f to %.f", "-cut_out from %s , byte %.f to %.f, and graft as %s",
disk_path, iso_rr_path, disk_path, (double) startbyte, (double) (startbyte+bytecount),
(double) startbyte, (double) (startbyte+bytecount)); iso_rr_path);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
ret= Xorriso_paste_in(xorriso, disk_path, startbyte, bytecount, ret= Xorriso_cut_out(xorriso, disk_path, startbyte, bytecount,
iso_rr_path, 0); 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);
}
return(ret); return(ret);
} }
@ -9222,8 +9200,8 @@ int Xorriso_option_error_behavior(struct XorrisO *xorriso,
bit1=do not reset pacifier, no final pacifier message bit1=do not reset pacifier, no final pacifier message
bit5= -extract_single: eventually do not insert directory tree bit5= -extract_single: eventually do not insert directory tree
*/ */
int Xorriso_option_extract(struct XorrisO *xorriso, char *disk_path, int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path,
char *iso_path, int flag) char *disk_path, int flag)
{ {
int ret; int ret;
char eff_origin[SfileadrL], eff_dest[SfileadrL], *ipth; 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", " By default \"off\" the inverse operation of xorriso from ISO",
" image to disk filesystem is disabled. \"on\" allows xorriso", " image to disk filesystem is disabled. \"on\" allows xorriso",
" to create, overwrite, delete files in the disk filesystem.", " 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", " -cpx iso_rr_path [***] disk_path",
" Copy leaf file objects from ISO image to disk filesystem.", " Copy leaf file objects from ISO image to disk filesystem.",
" -cpax iso_rr_path [***] disk_path", " -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.", " Copy directory trees from ISO image to disk filesystem.",
" -cp_rax iso_rr_path [***] disk_path", " -cp_rax iso_rr_path [***] disk_path",
" Like -cp_rx but trying to restore timestamps and ownership.", " 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", " -extract_single disk_path iso_rr_path",
" Like -extract but with directory do not insert its sub tree.", " 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.", " Copy ISO file content into a byte interval of a disk file.",
"", "",
"Compatibility emulation (argument list may be ended by --):", "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 */ /* Option -path-list */
int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag) 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); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; ret= 0;
} else } else
ret= Xorriso_option_cut_out(xorriso, arg1, arg2, ret= Xorriso_option_paste_in(xorriso, arg1, arg2,
argv[(*idx)-2], argv[(*idx)-1], 1); argv[(*idx)-2], argv[(*idx)-1], 0);
} else if(strcmp(cmd,"path-list")==0 || strcmp(cmd,"path_list")==0) { } else if(strcmp(cmd,"path-list")==0 || strcmp(cmd,"path_list")==0) {
(*idx)++; (*idx)++;

View File

@ -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 Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag); int *idx, int flag);
/* Options -cut_out, -paste_in */ /* Option -cut_out */
/* @param flag bit0= -paste_in rather than cut_out
*/
int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path, int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
char *start, char *count, char *iso_rr_path, int flag); 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 */ /* Option -page */
int Xorriso_option_page(struct XorrisO *xorriso, int len, int width, int flag); 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 */ /* Option -path-list */
int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag); int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag);

View File

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