Fixed the recognition of reuse of inodes in diff.

This commit is contained in:
Andrea Mazzoleni 2011-07-27 18:51:07 +02:00
parent c69590ffbe
commit 628fd0e683
3 changed files with 30 additions and 8 deletions

View file

@ -1,6 +1,10 @@
SnapRAID HISTORY
================
1.6 2011/8
==========
* In "diff" now recognizes the reuse of inodes.
1.5 2011/7
==========
* Ignores extra spaces in the configuration file.

View file

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT([snapraid], [1.5], [], [], [http://snapraid.sourceforge.net])
AC_INIT([snapraid], [1.6], [], [], [http://snapraid.sourceforge.net])
AM_INIT_AUTOMAKE([foreign no-dependencies -Wall])
AC_CONFIG_SRCDIR([snapraid.c])
AC_CONFIG_HEADER([config.h])

32
scan.c
View file

@ -187,16 +187,34 @@ static void scan_file(struct snapraid_scan* scan, struct snapraid_state* state,
}
}
if (state->gui) {
fprintf(stderr, "scan:update:%s:%s\n", disk->name, file->sub);
fflush(stderr);
}
if (output) {
printf("Update '%s%s'\n", disk->dir, file->sub);
if (strcmp(file->sub, sub) == 0) {
/* if the name is the same, it's an update */
if (state->gui) {
fprintf(stderr, "scan:update:%s:%s\n", disk->name, file->sub);
fflush(stderr);
}
if (output) {
printf("Update '%s%s'\n", disk->dir, file->sub);
}
++scan->count_change;
} else {
/* if the name is different, it's an inode reuse */
if (state->gui) {
fprintf(stderr, "scan:remove:%s:%s\n", disk->name, file->sub);
fprintf(stderr, "scan:add:%s:%s\n", disk->name, sub);
fflush(stderr);
}
if (output) {
printf("Remove '%s%s'\n", disk->dir, file->sub);
printf("Add '%s%s'\n", disk->dir, sub);
}
++scan->count_remove;
++scan->count_insert;
}
/* remove it */
++scan->count_change;
scan_file_remove(state, disk, file);
/* and continue to reinsert it */