mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-03 13:20:28 -05:00
Change "diff" to return an error if a "sync" is required
This commit is contained in:
parent
7e06c8eefa
commit
83d967e2c0
11 changed files with 104 additions and 16 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#include "support.h"
|
||||
#include "elem.h"
|
||||
#include "state.h"
|
||||
#include "parity.h"
|
||||
|
||||
struct snapraid_scan {
|
||||
struct snapraid_state* state; /**< State used. */
|
||||
|
|
@ -1340,7 +1341,7 @@ static int scan_dir(struct snapraid_scan* scan, int is_diff, const char* dir, co
|
|||
return processed;
|
||||
}
|
||||
|
||||
void state_scan(struct snapraid_state* state, int is_diff)
|
||||
static int state_diffscan(struct snapraid_state* state, int is_diff)
|
||||
{
|
||||
tommy_node* i;
|
||||
tommy_node* j;
|
||||
|
|
@ -1743,5 +1744,27 @@ void state_scan(struct snapraid_state* state, int is_diff)
|
|||
msg_flush();
|
||||
|
||||
tommy_list_foreach(&scanlist, (tommy_foreach_func*)free);
|
||||
|
||||
if (is_diff) {
|
||||
/* check for file difference */
|
||||
if (!no_difference)
|
||||
return -1;
|
||||
|
||||
/* check also for incomplete "sync" */
|
||||
if (parity_is_invalid(state))
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int state_diff(struct snapraid_state* state)
|
||||
{
|
||||
return state_diffscan(state, 1);
|
||||
}
|
||||
|
||||
void state_scan(struct snapraid_state* state)
|
||||
{
|
||||
(void)state_diffscan(state, 0); /* ignore return value */
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue