From 05b17e5f0b807709d9acf901ea4fb43d82a47725 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 16 Jun 2014 23:12:49 +0200 Subject: [PATCH] Allow disks not supporting physical offsets. --- HISTORY | 2 ++ cmdline/mingw.c | 6 ++++++ cmdline/scan.c | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index 6d94db42..0dda1d91 100644 --- a/HISTORY +++ b/HISTORY @@ -10,6 +10,8 @@ SnapRAID HISTORY * Auto exclude the lock file. * Don't prints the 'UUID set' message anymore because it's the normal condition for empty disks. + * In Windows, if the disk doesn't support reading physical offsets, + allows SnapRAID to continue anyway. 6.2 2014/5 ========== diff --git a/cmdline/mingw.c b/cmdline/mingw.c index 33f85c23..cf0b6850 100644 --- a/cmdline/mingw.c +++ b/cmdline/mingw.c @@ -1141,6 +1141,12 @@ int filephy(const char* file, struct stat* st, uint64_t* physical) /* that it's different from the 0 offset reported by the underline file system */ *physical = FILEPHY_WITHOUT_OFFSET; + CloseHandle(h); + return 0; + } else if (error == ERROR_NOT_SUPPORTED) { + /* for disks shared on network this operation is not supported */ + *physical = FILEPHY_UNREPORTED_OFFSET; + CloseHandle(h); return 0; } else { diff --git a/cmdline/scan.c b/cmdline/scan.c index 44971bf4..4cea7f54 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -1375,7 +1375,8 @@ void state_scan(struct snapraid_state* state, int output) if (state->opt.force_order == SORT_PHYSICAL && file->size != 0) { if (phy_file_last != 0 && file->physical == phy_last && phy_last != FILEPHY_WITHOUT_OFFSET) { /* if verbose, prints the list of duplicates */ - if (state->opt.verbose) { + /* if they are supposed real offsets */ + if (state->opt.verbose && phy_last != FILEPHY_UNREPORTED_OFFSET) { fprintf(stderr, "WARNING! Files '%s%s' and '%s%s' have the same physical offset %"PRId64".\n", disk->dir, phy_file_last->sub, disk->dir, file->sub, phy_last); } ++phy_dup;