More precise file modification time, now using nanoseconds.

This commit is contained in:
Andrea Mazzoleni 2012-07-10 23:24:31 +02:00
parent 97b0464d75
commit 71c7f4dffb
15 changed files with 130 additions and 40 deletions

8
sync.c
View file

@ -196,12 +196,14 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
/* check if the file is changed */
if (handle[j].st.st_size != block_file_get(block)->size
|| handle[j].st.st_mtime != block_file_get(block)->mtime
|| handle[j].st.st_mtime != block_file_get(block)->mtime_sec
|| handle[j].st.st_mtim.tv_nsec != block_file_get(block)->mtime_nsec
|| handle[j].st.st_ino != block_file_get(block)->inode
) {
if (handle[j].st.st_size != block_file_get(block)->size)
fprintf(stderr, "Unexpected size change at file '%s'.\n", handle[j].path);
else if (handle[j].st.st_mtime != block_file_get(block)->mtime)
else if (handle[j].st.st_mtime != block_file_get(block)->mtime_sec
|| handle[j].st.st_mtim.tv_nsec != block_file_get(block)->mtime_nsec)
fprintf(stderr, "Unexpected time change at file '%s'.\n", handle[j].path);
else
fprintf(stderr, "Unexpected inode change from %"PRIu64" to %"PRIu64" at file '%s'.\n", block_file_get(block)->inode, handle[j].st.st_ino, handle[j].path);
@ -209,7 +211,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
++unrecoverable_error;
/* if the file is charnged, it means that it was modified during sync */
/* if the file is changed, it means that it was modified during sync */
/* this isn't a serious error, so we skip this block, and continue with others */
skip_this_block = 1;
continue;