mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 04:17:02 -05:00
Fixes the gen-conf command.
This commit is contained in:
parent
789fed26e9
commit
a64e24d503
3 changed files with 26 additions and 4 deletions
4
HISTORY
4
HISTORY
|
|
@ -1,6 +1,10 @@
|
||||||
SnapRAID HISTORY
|
SnapRAID HISTORY
|
||||||
================
|
================
|
||||||
|
|
||||||
|
5.1 2013/12 (BETA)
|
||||||
|
==================
|
||||||
|
* Fixed the -C, --gen-conf command.
|
||||||
|
|
||||||
5.0 2013/11
|
5.0 2013/11
|
||||||
===========
|
===========
|
||||||
* Added support for up to six levels of parity.
|
* Added support for up to six levels of parity.
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,8 @@ endif
|
||||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR1) check
|
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR1) check
|
||||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
|
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
|
||||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) -a check
|
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) -a check
|
||||||
|
echo --- Check the --gen-conf command
|
||||||
|
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --gen-conf test/content
|
||||||
echo --- Delete some files and sync
|
echo --- Delete some files and sync
|
||||||
rm test/disk4/9*
|
rm test/disk4/9*
|
||||||
rm test/disk5/9*
|
rm test/disk5/9*
|
||||||
|
|
|
||||||
24
state.c
24
state.c
|
|
@ -855,6 +855,10 @@ static void state_map(struct snapraid_state* state)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* without configuration don't check for number of data disks */
|
||||||
|
if (state->no_conf)
|
||||||
|
return;
|
||||||
|
|
||||||
/* count the number of data disks, including holes left after removing some */
|
/* count the number of data disks, including holes left after removing some */
|
||||||
diskcount = 0;
|
diskcount = 0;
|
||||||
for(i=state->maplist;i!=0;i=i->next) {
|
for(i=state->maplist;i!=0;i=i->next) {
|
||||||
|
|
@ -1643,6 +1647,11 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* without configuration, auto assign the block size */
|
||||||
|
if (state->no_conf) {
|
||||||
|
state->block_size = blksize;
|
||||||
|
}
|
||||||
|
|
||||||
if (blksize != state->block_size) {
|
if (blksize != state->block_size) {
|
||||||
fprintf(stderr, "Mismatching 'blksize' and 'block_size' specification in '%s' at line %u\n", path, line);
|
fprintf(stderr, "Mismatching 'blksize' and 'block_size' specification in '%s' at line %u\n", path, line);
|
||||||
fprintf(stderr, "Please restore the 'block_size' value in the configuration file to '%u'\n", blksize / 1024);
|
fprintf(stderr, "Please restore the 'block_size' value in the configuration file to '%u'\n", blksize / 1024);
|
||||||
|
|
@ -2709,6 +2718,11 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* without configuration, auto assign the block size */
|
||||||
|
if (state->no_conf) {
|
||||||
|
state->block_size = blksize;
|
||||||
|
}
|
||||||
|
|
||||||
if (blksize != state->block_size) {
|
if (blksize != state->block_size) {
|
||||||
decoding_error(path, f);
|
decoding_error(path, f);
|
||||||
fprintf(stderr, "Mismatching 'blksize' and 'block_size' specification!\n");
|
fprintf(stderr, "Mismatching 'blksize' and 'block_size' specification!\n");
|
||||||
|
|
@ -3222,8 +3236,10 @@ void state_read(struct snapraid_state* state)
|
||||||
struct snapraid_content* content = node->data;
|
struct snapraid_content* content = node->data;
|
||||||
pathcpy(path, sizeof(path), content->content);
|
pathcpy(path, sizeof(path), content->content);
|
||||||
|
|
||||||
fprintf(stdlog, "content:%s\n", path);
|
if (!state->no_conf) {
|
||||||
fflush(stdlog);
|
fprintf(stdlog, "content:%s\n", path);
|
||||||
|
fflush(stdlog);
|
||||||
|
}
|
||||||
printf("Loading state from %s...\n", path);
|
printf("Loading state from %s...\n", path);
|
||||||
|
|
||||||
f = sopen_read(path);
|
f = sopen_read(path);
|
||||||
|
|
@ -3252,10 +3268,10 @@ void state_read(struct snapraid_state* state)
|
||||||
|
|
||||||
/* if not found, assume empty */
|
/* if not found, assume empty */
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
fprintf(stderr, "No content file found. Assuming empty.\n");
|
||||||
|
|
||||||
/* create the initial mapping */
|
/* create the initial mapping */
|
||||||
state_map(state);
|
state_map(state);
|
||||||
|
|
||||||
fprintf(stderr, "No content file found. Assuming empty.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue