Adds UUID to check to detect disk misplacement.

This commit is contained in:
Andrea Mazzoleni 2013-03-03 22:39:46 +01:00
parent 8810d7b05d
commit 768113c670
15 changed files with 272 additions and 34 deletions

9
elem.h
View file

@ -252,12 +252,18 @@ struct snapraid_disk {
tommy_node node;
};
/**
* Max UUID length.
*/
#define UUID_MAX 128
/**
* Disk mapping.
*/
struct snapraid_map {
char name[PATH_MAX]; /**< Name of the disk. */
unsigned position; /**< Position of the disk in the parity. */
char uuid[UUID_MAX]; /**< UUID of the disk. Empty if unknown. */
/* nodes for data structures */
tommy_node node;
@ -617,8 +623,9 @@ static inline struct snapraid_block* disk_block_get(struct snapraid_disk* disk,
/**
* Allocates a disk mapping.
* Uses uuid="" if not available.
*/
struct snapraid_map* map_alloc(const char* name, unsigned position);
struct snapraid_map* map_alloc(const char* name, unsigned position, const char* uuid);
/**
* Deallocates a disk mapping.