Moves the seed info in the checksum line.

This commit is contained in:
Andrea Mazzoleni 2013-06-22 18:26:21 +02:00
parent 8fc805c272
commit 1b0a38f924
4 changed files with 35 additions and 27 deletions

View file

@ -1007,8 +1007,9 @@ This file is read and written by the \(a"sync\(a" command, and only read by
.SS blk_size SIZE
Defines the size of the block in bytes. It must match the size
defined in the configuration file.
.SS checksum CHECKSUM
Defines the checksum kind used. It can be only \(a"murmur3\(a".
.SS checksum CHECKSUM SEED
Defines the checksum kind used. It can be \(a"murmur3\(a" or \(a"spooky2\(a".
SEED is a 128 bits seed used in all the hash operations.
From SnapRAID 2.0 the old \(a"md5\(a" checksum is not supported anymore.
.SS map NAME INDEX [UUID]
Defines the position INDEX of the disk NAME in the parity computation.

View file

@ -724,8 +724,9 @@ Content
Defines the size of the block in bytes. It must match the size
defined in the configuration file.
checksum CHECKSUM
Defines the checksum kind used. It can be only "murmur3".
checksum CHECKSUM SEED
Defines the checksum kind used. It can be "murmur3" or "spooky2".
SEED is a 128 bits seed used in all the hash operations.
From SnapRAID 2.0 the old "md5" checksum is not supported anymore.
map NAME INDEX [UUID]

View file

@ -797,10 +797,11 @@ This file is read and written by the "sync" command, and only read by
Defines the size of the block in bytes. It must match the size
defined in the configuration file.
10.2 checksum CHECKSUM
----------------------
10.2 checksum CHECKSUM SEED
---------------------------
Defines the checksum kind used. It can be only "murmur3".
Defines the checksum kind used. It can be "murmur3" or "spooky2".
SEED is a 128 bits seed used in all the hash operations.
From SnapRAID 2.0 the old "md5" checksum is not supported anymore.
10.3 map NAME INDEX [UUID]
@ -884,22 +885,29 @@ for which the parity is computed using the previous value.
This field is used only when you interrupt manually the "sync"
command.
10.11 symlink DISK PATH
10.11 inf BLOCK TIME
--------------------
Information shared by all the block at the specified offset.
TIME is the last time of the hash/parity verification done at this
block.
10.12 symlink DISK PATH
-----------------------
Defines a symbolic link in the specified DISK.
10.12 hardlink DISK PATH
10.13 hardlink DISK PATH
------------------------
Defines a hard link in the specified DISK.
10.13 to PATH
10.14 to PATH
-------------
Defines where the previous symlink or hardlink links to.
10.14 dir DISK PATH
10.15 dir DISK PATH
-------------------
Defines an empty directory in the specified DISK.

30
state.c
View file

@ -894,7 +894,7 @@ void state_read(struct snapraid_state* state)
/* it's for compatibility with version 1.0 where MD5 was implicit. */
state->hash = HASH_UNDEFINED;
/* start with a zero seed */
/* start with a zero seed, it was the default in old versions */
memset(state->hashseed, 0, HASH_SIZE);
disk = 0;
@ -1494,15 +1494,20 @@ void state_read(struct snapraid_state* state)
fprintf(stderr, "Invalid 'checksum' specification '%s' in '%s' at line %u\n", buffer, path, line);
exit(EXIT_FAILURE);
}
} else if (strcmp(tag, "seed") == 0) {
hash = oathash8(hash, 'e');
ret = sgethex(f, state->hashseed, HASH_SIZE);
if (ret < 0) {
fprintf(stderr, "Invalid 'seed' specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
c = sgetc(f);
if (c == ' ') {
/* read the seed if present */
ret = sgethex(f, state->hashseed, HASH_SIZE);
if (ret < 0) {
fprintf(stderr, "Invalid 'seed' specification in '%s' at line %u\n", path, line);
exit(EXIT_FAILURE);
}
hash = oathashm(hash, state->hashseed, HASH_SIZE);
} else {
sungetc(c, f);
memset(state->hashseed, 0, HASH_SIZE);
}
hash = oathashm(hash, state->hashseed, HASH_SIZE);
} else if (strcmp(tag, "blksize") == 0) {
block_off_t blksize;
@ -1728,14 +1733,7 @@ void state_write(struct snapraid_state* state)
fprintf(stderr, "Unexpected hash when writing the content file '%s'.\n", serrorfile(f));
exit(EXIT_FAILURE);
}
sputeol(f);
if (serror(f)) {
fprintf(stderr, "Error writing the content file '%s'. %s.\n", serrorfile(f), strerror(errno));
exit(EXIT_FAILURE);
}
sputsl("seed ", f);
hash = oathash8(hash, 'e');
sputc(' ', f);
sputhex(state->hashseed, HASH_SIZE, f);
hash = oathashm(hash, state->hashseed, HASH_SIZE);
sputeol(f);