diff --git a/snapraid.1 b/snapraid.1 index ab54edcf..33fc2758 100644 --- a/snapraid.1 +++ b/snapraid.1 @@ -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. diff --git a/snapraid.conf.example b/snapraid.conf.example index 80d8d46e..d569d19b 100644 --- a/snapraid.conf.example +++ b/snapraid.conf.example @@ -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). diff --git a/snapraid.conf.example.windows b/snapraid.conf.example.windows index 271ac88f..19298dcc 100644 --- a/snapraid.conf.example.windows +++ b/snapraid.conf.example.windows @@ -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). diff --git a/snapraid.d b/snapraid.d index f35d1e4b..f90bff55 100644 --- a/snapraid.d +++ b/snapraid.d @@ -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. diff --git a/snapraid.txt b/snapraid.txt index e6b3cc86..31dc3e0a 100644 --- a/snapraid.txt +++ b/snapraid.txt @@ -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. diff --git a/state.c b/state.c index 9084a7a7..e0dd2013 100644 --- a/state.c +++ b/state.c @@ -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