Renames the block_size configuration option to blocksize.

This commit is contained in:
Andrea Mazzoleni 2014-02-12 22:10:06 +01:00
parent 857c8eba63
commit 632b710caa
13 changed files with 28 additions and 25 deletions

View file

@ -951,7 +951,7 @@ See the PATTERN section for more details in the pattern
specifications.
.PP
This option can be used many times.
.SS block_size SIZE_IN_KIBIBYTES
.SS blocksize SIZE_IN_KIBIBYTES
Defines the basic block size in kibi bytes of the parity
blocks. Where one kibi bytes is 1024 bytes.
The default is 256 and it should work for most conditions.

View file

@ -50,8 +50,8 @@ exclude /lost+found/
# Defines the block size in kibi bytes (1024 bytes) (uncomment to enable).
# Default value is 256 -> 256 kibi bytes -> 262144 bytes
# Format: "block_size SIZE_IN_KiB"
#block_size 256
# Format: "blocksize SIZE_IN_KiB"
#blocksize 256
# Automatically save the state when synching after the specied amount
# of GiB processed (uncomment to enable).

View file

@ -54,8 +54,8 @@ exclude \Windows\
# Defines the block size in kibi bytes (1024 bytes) (uncomment to enable).
# Default value is 256 -> 256 kibi bytes -> 262144 bytes
# Format: "block_size SIZE_IN_KiB"
#block_size 256
# Format: "blocksize SIZE_IN_KiB"
#blocksize 256
# Automatically save the state when synching after the specied amount
# of GiB processed (uncomment to enable).

View file

@ -720,7 +720,7 @@ Configuration
This option can be used many times.
block_size SIZE_IN_KIBIBYTES
blocksize SIZE_IN_KIBIBYTES
Defines the basic block size in kibi bytes of the parity
blocks. Where one kibi bytes is 1024 bytes.
The default is 256 and it should work for most conditions.

View file

@ -782,8 +782,8 @@ specifications.
This option can be used many times.
7.8 block_size SIZE_IN_KIBIBYTES
--------------------------------
7.8 blocksize SIZE_IN_KIBIBYTES
-------------------------------
Defines the basic block size in kibi bytes of the parity
blocks. Where one kibi bytes is 1024 bytes.

23
state.c
View file

@ -397,30 +397,33 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
/* skip spaces after the command */
sgetspace(f);
if (strcmp(tag, "block_size") == 0) {
if (strcmp(tag, "blocksize") == 0
/* block_size is the old format of the option */
|| strcmp(tag, "block_size") == 0) {
ret = sgetu32(f, &state->block_size);
if (ret < 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Invalid 'block_size' specification in '%s' at line %u\n", path, line);
fprintf(stderr, "Invalid 'blocksize' specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (state->block_size < 1) {
/* LCOV_EXCL_START */
fprintf(stderr, "Too small 'block_size' specification in '%s' at line %u\n", path, line);
fprintf(stderr, "Too small 'blocksize' specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (state->block_size > 16*1024) {
/* LCOV_EXCL_START */
fprintf(stderr, "Too big 'block_size' specification in '%s' at line %u\n", path, line);
fprintf(stderr, "Too big 'blocksize' specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
/* check if it's a power of 2 */
if ((state->block_size & (state->block_size - 1)) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Not power of 2 'block_size' specification in '%s' at line %u\n", path, line);
fprintf(stderr, "Not power of 2 'blocksize' specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -1966,8 +1969,8 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE
if (blksize != state->block_size) {
/* LCOV_EXCL_START */
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, "Mismatching 'blksize' and 'blocksize' specification in '%s' at line %u\n", path, line);
fprintf(stderr, "Please restore the 'blocksize' value in the configuration file to '%u'\n", blksize / 1024);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -3226,8 +3229,8 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST
if (blksize != state->block_size) {
/* LCOV_EXCL_START */
decoding_error(path, f);
fprintf(stderr, "Mismatching 'blksize' and 'block_size' specification!\n");
fprintf(stderr, "Please restore the 'block_size' value in the configuration file to '%u'\n", blksize / 1024);
fprintf(stderr, "Mismatching 'blksize' and 'blocksize' specification!\n");
fprintf(stderr, "Please restore the 'blocksize' value in the configuration file to '%u'\n", blksize / 1024);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -4240,7 +4243,7 @@ void generate_configuration(const char* path)
printf("# Configuration file generated from %s\n", path);
printf("\n");
printf("# Use this blocksize\n");
printf("block_size %u\n", state.block_size / 1024);
printf("blocksize %u\n", state.block_size / 1024);
printf("\n");
for(i=0;i<LEV_MAX;++i) {
printf("# Set the correct path for the %s file%s\n", lev_name(i), i != 0 ? " (if used)" : "");

View file

@ -1,4 +1,4 @@
block_size 1
blocksize 1
parity test/parity
content test/content
content test/1-content

View file

@ -1,4 +1,4 @@
block_size 1
blocksize 1
parity test/parity
2-parity test/2-parity
content test/content

View file

@ -1,4 +1,4 @@
block_size 1
blocksize 1
parity test/parity
2-parity test/2-parity
3-parity test/3-parity

View file

@ -1,4 +1,4 @@
block_size 1
blocksize 1
parity test/parity
2-parity test/2-parity
3-parity test/3-parity

View file

@ -1,4 +1,4 @@
block_size 1
blocksize 1
parity test/parity
2-parity test/2-parity
3-parity test/3-parity

View file

@ -1,4 +1,4 @@
block_size 1
blocksize 1
parity test/parity
2-parity test/2-parity
3-parity test/3-parity

View file

@ -1,4 +1,4 @@
block_size 1
blocksize 1
parity test/parity
2-parity test/2-parity
3-parity test/3-parity