From 71d2a66f4220a64ac896706d56c0de7eae7b8d2e Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 27 Mar 2008 08:56:26 +0000 Subject: [PATCH] * src/common.h (check_device_option): New global. * src/incremen.c (procdir): Use boolean and instead of bitwise one. Patch by Jean-Louis Martineau. Compare device numbers only if check_device_option is set. * src/tar.c: New command line options --no-check-device and --check-device. Proposed by Jean-Louis Martineau. (parse_opt): Hanlde new options. (decode_options): Initialize check_device_option to true. --- ChangeLog | 13 +++++++++++++ THANKS | 1 + src/common.h | 2 ++ src/incremen.c | 3 ++- src/tar.c | 18 ++++++++++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 83a613f..3a62405 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-03-27 Sergey Poznyakoff + + * src/common.h (check_device_option): New global. + * src/incremen.c (procdir): Use boolean and instead of bitwise + one. Patch by Jean-Louis Martineau. + Compare device numbers only if check_device_option is set. + * src/tar.c: New command line options --no-check-device and + --check-device. Proposed by Jean-Louis Martineau. + (parse_opt): Hanlde new options. + (decode_options): Initialize check_device_option to true. + + * THANKS: Update + 2008-03-06 Sergey Poznyakoff * bootstrap: Use rsync to get translations. diff --git a/THANKS b/THANKS index 6d9e432..1b40c3e 100644 --- a/THANKS +++ b/THANKS @@ -217,6 +217,7 @@ Janne Snabb snabb@niksula.hut.fi Jason R. Mastaler jason@webmaster.net Jason Armistead Jason.Armistead@otis.com Jay Fenlason hack@gnu.org +Jean-Louis Martineau martineau@zmanda.com Jean-Michel Soenen soenen@lectra.fr Jean-Loup Gailly jloup@chorus.fr Jeff Moskow jeff@rtr.com diff --git a/src/common.h b/src/common.h index e2fdf0d..9e0a3fb 100644 --- a/src/common.h +++ b/src/common.h @@ -188,6 +188,8 @@ GLOBAL enum old_files old_files_option; /* Specified file name for incremental list. */ GLOBAL const char *listed_incremental_option; +/* Check device numbers when doing incremental dumps. */ +GLOBAL bool check_device_option; /* Specified mode change string. */ GLOBAL struct mode_change *mode_option; diff --git a/src/incremen.c b/src/incremen.c index 1c9113c..d75b844 100644 --- a/src/incremen.c +++ b/src/incremen.c @@ -250,7 +250,8 @@ procdir (char *name_buffer, struct stat *stat_data, directories, consider all NFS devices as equal, relying on the i-node to establish differences. */ - if (! (((DIR_IS_NFS (directory) & nfs) + if (! ((!check_device_option + || (DIR_IS_NFS (directory) && nfs) || directory->device_number == stat_data->st_dev) && directory->inode_number == stat_data->st_ino)) { diff --git a/src/tar.c b/src/tar.c index f3228e1..4a58a74 100644 --- a/src/tar.c +++ b/src/tar.c @@ -249,6 +249,7 @@ enum ANCHORED_OPTION = CHAR_MAX + 1, ATIME_PRESERVE_OPTION, BACKUP_OPTION, + CHECK_DEVICE_OPTION, CHECKPOINT_OPTION, CHECKPOINT_ACTION_OPTION, DELAY_DIRECTORY_RESTORE_OPTION, @@ -275,6 +276,7 @@ enum MTIME_OPTION, NEWER_MTIME_OPTION, NO_ANCHORED_OPTION, + NO_CHECK_DEVICE_OPTION, NO_DELAY_DIRECTORY_RESTORE_OPTION, NO_IGNORE_CASE_OPTION, NO_IGNORE_COMMAND_ERROR_OPTION, @@ -411,6 +413,12 @@ static struct argp_option options[] = { " NUMBER defaults to 1"), GRID+1 }, {"seek", 'n', NULL, 0, N_("archive is seekable"), GRID+1 }, + {"no-check-device", NO_CHECK_DEVICE_OPTION, NULL, 0, + N_("do not check device numbers when creating incremental archives"), + GRID+1 }, + {"check-device", CHECK_DEVICE_OPTION, NULL, 0, + N_("check device numbers when creating incremental archives (default)"), + GRID+1 }, #undef GRID #define GRID 30 @@ -1545,6 +1553,14 @@ parse_opt (int key, char *arg, struct argp_state *state) " on this platform"))); break; + case CHECK_DEVICE_OPTION: + check_device_option = true; + break; + + case NO_CHECK_DEVICE_OPTION: + check_device_option = false; + break; + case CHECKPOINT_OPTION: if (arg) { @@ -2053,6 +2069,8 @@ decode_options (int argc, char **argv) owner_option = -1; group_option = -1; + check_device_option = true; + /* Convert old-style tar call by exploding option element and rearranging options accordingly. */ -- 2.45.2