-disk_dev_ino mode ino_only

This commit is contained in:
Thomas Schmitt 2009-02-25 14:40:47 +00:00
parent b6a998318c
commit c8122f4659
5 changed files with 103 additions and 23 deletions

View File

@ -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 "Feb 12, 2008"
.TH XORRISO 1 "Feb 23, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -414,7 +414,10 @@ enhanced images and to restore them to xattr capable file systems.
.SS
.B Command processing:
.br
Commands are either actions or settings. They consist of a command word,
Commands are either actions which happen immediately or settings which
influence following actions. So their sequence does matter.
.br
Commands consist of a command word,
followed by zero or more parameter words. If the list of parameter words
is of variable length (indicated by "[...]" or "[***]") then it has to be
terminated by either the \fBlist delimiter\fR, or the end of argument list,
@ -667,10 +670,10 @@ Enable or disable processing of xattr attributes in user namespace.
If enabled, then xorriso will handle xattr similar to ACL.
See also options -getfattr, -setfattr and above paragraph about xattr.
.TP
\fB\-disk_dev_ino\fR "on"|"off"
\fB\-disk_dev_ino\fR "on"|"ino_only"|"off"
Enable or disable processing of recorded file identification numbers
(dev_t and ino_t). They are eventually stored as xattr "isofs.di" and allow
to substantially accelerate file comparison:
to substantially accelerate file comparison.
.br
If device numbers and inode numbers of the disk filesystems are persistent
and if no irregular alterations of timestamps or system clock happen,
@ -678,6 +681,10 @@ then potential content changes can be detected without reading that content.
File content change is assumed if any of mtime, ctime, device number or inode
number have changed.
.br
Mode "ino_only" replaces the precondition that device numbers are stable by the
precondition that mount points in the compared tree always lead to the
same filesystems. Use this if mode "on" always sees all files changed.
.br
The speed advantage appears only if the loaded session was produced with
-disk_dev_ino "on" too.
.TP
@ -1141,11 +1148,12 @@ match files which have resp. have not a non-trivial ACL.
.br
-has_xattr , -has_no_xattr
.br
match files which have resp. have not xattr name-value pairs.
match files which have resp. have not xattr name-value pairs
from user namespace.
.br
-has_aaip , -has_no_aaip
.br
match files which have ACL or xattr resp. have neither of them.
match files which have ACL or any xattr resp. have neither of them.
.br
Default action is "echo",
@ -3104,11 +3112,17 @@ This changes the directory trees /open_source_project and /personal_mail
in the ISO image so that they become exact copies of their disk counterparts.
ISO file objects get created, deleted or get their attributes adjusted
accordingly.
.br
ACL and xattr will be recorded. Accelerated comparison is enabled at the
expense of potentially larger backup size.
Only media with the expected volume id or blank media are accepted.
Files with names matching *.o or *.swp get excluded explicitely.
.br
Only media with the expected volume id or blank media are accepted.
\fB$\fR xorriso \\
.br
\fB$\fR xorriso -assert_volid 'PROJECTS_MAIL_*' FATAL \\
-acl on -xattr on -disk_dev_ino on \\
.br
-assert_volid 'PROJECTS_MAIL_*' FATAL \\
.br
-dev /dev/sr0 \\
.br
@ -3129,8 +3143,10 @@ the old one.
.br
This makes sense if the full backup leaves substantial remaining capacity
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,
unless option -disk_dev_ino "on" is used.
.br
Option -disk_dev_ino depends on stable device and inode numbers on disk.
Without it, an update run will probably save no time but last longer than
a full backup. Such a slow run might produce a smaller backup, though.
.br
With \fBmount\fR option \fB-o "sbsector="\fR on Linux resp. \fB-s\fR on FreeBSD
it is possible to access the session trees which represent the older backup

View File

@ -6356,7 +6356,9 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= ((xorriso->do_aaip & (16 | 32 | 64)) == 0);
sprintf(line,"-disk_dev_ino %s\n", (xorriso->do_aaip & 16 ? "on" : "off"));
sprintf(line,"-disk_dev_ino %s\n",
(xorriso->do_aaip & 16 ? (xorriso->do_aaip & 128 ? "ino_only" : "on" )
: "off"));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -6951,7 +6953,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
if(xorriso->do_aaip & 32) {
/* dev,inode comparison. Eventually skip content comparison */
ret= Xorriso_record_dev_inode(xorriso, "", s1.st_dev, s1.st_ino, NULL,
iso_adr, 1 | 2 | ((flag & (1 << 28)) >> 23));
iso_adr, 1 | 2 | ((flag & (1 << 28)) >> 23) | (xorriso->do_aaip & 128));
if(ret < 0) {
ret= -1; goto ex;
} else if(ret == 0) { /* match */
@ -13018,13 +13020,15 @@ int Xorriso_option_dialog(struct XorrisO *xorriso, char *mode, int flag)
}
/* Option -disk_dev_ino "on"|"off" */
/* Option -disk_dev_ino "on"|"ino_only"|"off" */
int Xorriso_option_disk_dev_ino(struct XorrisO *xorriso, char *mode, int flag)
{
if(strcmp(mode, "on") == 0)
xorriso->do_aaip|= 16 | 32 | 64;
xorriso->do_aaip= (xorriso->do_aaip & ~128) | 16 | 32 | 64;
else if(strcmp(mode, "ino_only") == 0)
xorriso->do_aaip|= 16 | 32 | 64 | 128;
else if(strcmp(mode, "off") == 0)
xorriso->do_aaip &= ~(16 | 32 | 64);
xorriso->do_aaip &= ~(16 | 32 | 64 | 128);
else {
sprintf(xorriso->info_text, "-disk_dev_ino: unknown mode '%s'", mode);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
@ -13905,7 +13909,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Enable resp. disable reading and writing of ACLs.",
" -xattr \"on\"|\"off\"",
" Enable resp. disable reading and writing of xattr.",
" -disk_dev_ino \"on\"|\"off\"",
" -disk_dev_ino \"on\"|\"ino_only\"|\"off\"",
" Enable resp. disable recording of disk file dev_t and ino_t",
" and their use in file comparison.",
" -ban_stdio_write",

View File

@ -104,6 +104,7 @@ struct XorrisO { /* the global context of xorriso */
int do_aaip; /* bit0= ACL in , bit1= ACL out , bit2= EA in , bit3= EA out
bit4= record dev,inode , bit5= check dev,inode
bit6= omit content check if dev,inode check is conclusive
bit7= omit dev check mit bit5
*/
int relax_compliance; /* opaque bitfield to be set by xorrisoburn */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.02.19.183707"
#define Xorriso_timestamP "2009.02.25.144045"

View File

@ -120,6 +120,12 @@ int Xorriso_path_from_node(struct XorrisO *xorriso, IsoNode *node, int lba,
isoburn_igopt_always_gmt)
/* <<< Whether to allow xattr and ACL with the root node.
(It is supposed to work since libisofs-ng resision 479)
*/
#define Xorriso_root_with_aaiP yes
/* ------------------------------------------------------------------------ */
@ -1694,6 +1700,35 @@ int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume,
return(*volume != NULL);
}
/*
@param flag bit0= do not issue warning
*/
int Xorriso_aaip_warn_of_root(struct XorrisO *xorriso, IsoNode *node, int flag)
{
#ifndef Xorriso_root_with_aaiP
int ret;
IsoDir *root= NULL;
IsoImage *volume;
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(ret);
root= iso_image_get_root(volume);
if(node == (IsoNode *) root) {
sprintf(xorriso->info_text,
"Cannot attach ACL or xattr to ISO root directory");
if(!(flag & 1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
return(0);
}
#endif /* ! Xorriso_root_with_aaiP */
return(1);
}
/* @param flag bit0=do not complain about non existent node */
int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume,
@ -8838,7 +8873,7 @@ int Xorriso_getfname(struct XorrisO *xorriso, char *path, int flag)
strlen(path + path_offset), 8);
if(ret <= 0)
return(-1);
sprintf(xorriso->result_line, "# file: %s\n", bsl_path);
sprintf(xorriso->result_line, "# file: %s\n", bsl_path[0] ? bsl_path : ".");
free(bsl_path);
bsl_path= NULL;
/* temporarily disable -backslash_codes with result output */
@ -9032,7 +9067,7 @@ int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag)
@param path is used as address if node is NULL.
@param access_text "access" ACL in long text form
@param default_text "default" ACL in long text form
@param flag Unused yet, submit 0
@param flag bit0= do not warn of root directory if not capable of AAIP
@return >0 success , <=0 failure
*/
int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path,
@ -9048,6 +9083,12 @@ int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path,
goto ex;
}
ret= Xorriso_aaip_warn_of_root(xorriso, node, flag & 1);
if (ret < 0)
goto ex;
if (ret == 0)
{ret= 1; goto ex;}
#ifdef Xorriso_with_aaiP
ret= iso_node_set_acl_text(node, access_text, default_text, 0);
#else
@ -9169,6 +9210,7 @@ ex:;
bit1= Do not clear the existing attribute list
bit2= Delete the attributes with the given names
bit3= Allow non-user attributes.
bit4= do not warn of root if incapable of AAIP
@return >0 success , <=0 failure
*/
int Xorriso_setfattr(struct XorrisO *xorriso, void *in_node, char *path,
@ -9185,6 +9227,12 @@ int Xorriso_setfattr(struct XorrisO *xorriso, void *in_node, char *path,
goto ex;
}
ret= Xorriso_aaip_warn_of_root(xorriso, node, !!(flag & 16));
if (ret < 0)
goto ex;
if (ret == 0)
{ret= 1; goto ex;}
#ifdef Xorriso_with_aaiP
ret= iso_node_set_attrs(node, num_attrs, names, value_lengths, values,
flag & (1 | 2 | 4 | 8));
@ -9423,6 +9471,7 @@ ex:
-1=error
bit5= if not bit0:
transfer dev,inode from eventual link target
bit7= omit dev check mit bit1
*/
int Xorriso_record_dev_inode(struct XorrisO *xorriso, char *disk_path,
dev_t dev, ino_t ino,
@ -9474,11 +9523,21 @@ int Xorriso_record_dev_inode(struct XorrisO *xorriso, char *disk_path,
goto ex;
if(ret == 0)
{ret= 2; goto ex;}
if(flag & 128) {
if(di_l <= 0)
{ret= 1; goto ex;}
hino= 0;
for(i= di[0] + 2; i < di_l && i - di[0] - 2 < di[(int) di[0] + 1]; i++)
hino= (hino << 8) | ((unsigned char *) di)[i];
if(hino != ino)
{ret= 1; goto ex;}
} else {
if(l != di_l)
{ret= 1; goto ex;}
for(i= 0; i < l; i++)
if(di[i] != buf[i])
{ret= 1; goto ex;}
}
ret= 0;
} else {
ret= Xorriso_setfattr(xorriso, in_node, iso_path,