Renames snapraid_parity to handle.

This commit is contained in:
Andrea Mazzoleni 2014-11-09 10:25:39 +01:00
parent 0991de6c71
commit 7718e6d206
6 changed files with 27 additions and 27 deletions

View file

@ -583,7 +583,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
return -1;
}
static int state_check_process(struct snapraid_state* state, int fix, struct snapraid_parity** parity, block_off_t blockstart, block_off_t blockmax)
static int state_check_process(struct snapraid_state* state, int fix, struct snapraid_parity_handle** parity, block_off_t blockstart, block_off_t blockmax)
{
struct snapraid_handle* handle;
unsigned diskmax;
@ -1788,8 +1788,8 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b
data_off_t size;
data_off_t out_size;
int ret;
struct snapraid_parity parity[LEV_MAX];
struct snapraid_parity* parity_ptr[LEV_MAX];
struct snapraid_parity_handle parity[LEV_MAX];
struct snapraid_parity_handle* parity_ptr[LEV_MAX];
unsigned error;
unsigned l;

View file

@ -26,7 +26,7 @@
/****************************************************************************/
/* dry */
static int state_dry_process(struct snapraid_state* state, struct snapraid_parity** parity, block_off_t blockstart, block_off_t blockmax)
static int state_dry_process(struct snapraid_state* state, struct snapraid_parity_handle** parity, block_off_t blockstart, block_off_t blockmax)
{
struct snapraid_handle* handle;
unsigned diskmax;
@ -178,10 +178,10 @@ void state_dry(struct snapraid_state* state, block_off_t blockstart, block_off_t
{
block_off_t blockmax;
int ret;
struct snapraid_parity parity[LEV_MAX];
struct snapraid_parity_handle parity[LEV_MAX];
/* the following initialization is to avoid clang warnings about */
/* potential state->level change, that never happens */
struct snapraid_parity* parity_ptr[LEV_MAX] = { 0 };
struct snapraid_parity_handle* parity_ptr[LEV_MAX] = { 0 };
unsigned error;
unsigned l;

View file

@ -89,7 +89,7 @@ void parity_overflow(struct snapraid_state* state, data_off_t size)
}
}
int parity_create(struct snapraid_parity* parity, const char* path, data_off_t* out_size, int mode)
int parity_create(struct snapraid_parity_handle* parity, const char* path, data_off_t* out_size, int mode)
{
int ret;
int flags;
@ -146,7 +146,7 @@ bail:
/* LCOV_EXCL_STOP */
}
int parity_chsize(struct snapraid_parity* parity, data_off_t size, data_off_t* out_size, int skip_fallocate)
int parity_chsize(struct snapraid_parity_handle* parity, data_off_t size, data_off_t* out_size, int skip_fallocate)
{
int ret;
@ -263,7 +263,7 @@ bail:
/* LCOV_EXCL_STOP */
}
int parity_open(struct snapraid_parity* parity, const char* path, int mode)
int parity_open(struct snapraid_parity_handle* parity, const char* path, int mode)
{
int ret;
int flags;
@ -318,7 +318,7 @@ bail:
/* LCOV_EXCL_STOP */
}
int parity_sync(struct snapraid_parity* parity)
int parity_sync(struct snapraid_parity_handle* parity)
{
#if HAVE_FSYNC
int ret;
@ -338,7 +338,7 @@ int parity_sync(struct snapraid_parity* parity)
return 0;
}
int parity_close(struct snapraid_parity* parity)
int parity_close(struct snapraid_parity_handle* parity)
{
int ret;
@ -364,7 +364,7 @@ int parity_close(struct snapraid_parity* parity)
return 0;
}
int parity_write(struct snapraid_parity* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size)
int parity_write(struct snapraid_parity_handle* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size)
{
ssize_t write_ret;
data_off_t offset;
@ -409,7 +409,7 @@ int parity_write(struct snapraid_parity* parity, block_off_t pos, unsigned char*
return 0;
}
int parity_read(struct snapraid_parity* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size, FILE* out)
int parity_read(struct snapraid_parity_handle* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size, FILE* out)
{
ssize_t read_ret;
data_off_t offset;

View file

@ -21,7 +21,7 @@
/****************************************************************************/
/* parity */
struct snapraid_parity {
struct snapraid_parity_handle {
char path[PATH_MAX]; /**< Path of the file. */
int f; /**< Handle of the file. */
struct stat st; /**< Stat info of the opened file. */
@ -42,38 +42,38 @@ void parity_overflow(struct snapraid_state* state, data_off_t size);
* Creates the parity file.
* \param out_size Return the size of the parity file.
*/
int parity_create(struct snapraid_parity* parity, const char* path, data_off_t* out_size, int mode);
int parity_create(struct snapraid_parity_handle* parity, const char* path, data_off_t* out_size, int mode);
/**
* Changes the parity size.
* \param out_size Return the size of the parity file. The out_size is set also on error to reflect a partial resize.
*/
int parity_chsize(struct snapraid_parity* parity, data_off_t size, data_off_t* out_size, int skip_fallocate);
int parity_chsize(struct snapraid_parity_handle* parity, data_off_t size, data_off_t* out_size, int skip_fallocate);
/**
* Opens an already existing parity file.
*/
int parity_open(struct snapraid_parity* parity, const char* path, int mode);
int parity_open(struct snapraid_parity_handle* parity, const char* path, int mode);
/**
* Flushes the parity file in the disk.
*/
int parity_sync(struct snapraid_parity* parity);
int parity_sync(struct snapraid_parity_handle* parity);
/**
* Closes the parity file.
*/
int parity_close(struct snapraid_parity* parity);
int parity_close(struct snapraid_parity_handle* parity);
/**
* Read a block from the parity file.
*/
int parity_read(struct snapraid_parity* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size, FILE* out);
int parity_read(struct snapraid_parity_handle* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size, FILE* out);
/**
* Writes a block in the parity file.
*/
int parity_write(struct snapraid_parity* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size);
int parity_write(struct snapraid_parity_handle* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size);
#endif

View file

@ -35,7 +35,7 @@ struct snapraid_rehash {
struct snapraid_block* block;
};
static int state_scrub_process(struct snapraid_state* state, struct snapraid_parity** parity, block_off_t blockstart, block_off_t blockmax, time_t timelimit, block_off_t lastlimit, time_t now)
static int state_scrub_process(struct snapraid_state* state, struct snapraid_parity_handle** parity, block_off_t blockstart, block_off_t blockmax, time_t timelimit, block_off_t lastlimit, time_t now)
{
struct snapraid_handle* handle;
void* rehandle_alloc;
@ -509,8 +509,8 @@ int state_scrub(struct snapraid_state* state, int percentage, int olderthan)
time_t recentlimit;
unsigned count;
int ret;
struct snapraid_parity parity[LEV_MAX];
struct snapraid_parity* parity_ptr[LEV_MAX];
struct snapraid_parity_handle parity[LEV_MAX];
struct snapraid_parity_handle* parity_ptr[LEV_MAX];
snapraid_info* infomap;
unsigned error;
time_t now;

View file

@ -326,7 +326,7 @@ struct snapraid_rehash {
struct snapraid_block* block;
};
static int state_sync_process(struct snapraid_state* state, struct snapraid_parity** parity, block_off_t blockstart, block_off_t blockmax)
static int state_sync_process(struct snapraid_state* state, struct snapraid_parity_handle** parity, block_off_t blockstart, block_off_t blockmax)
{
struct snapraid_handle* handle;
void* rehandle_alloc;
@ -1026,10 +1026,10 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
data_off_t size;
data_off_t out_size;
int ret;
struct snapraid_parity parity[LEV_MAX];
struct snapraid_parity_handle parity[LEV_MAX];
/* the following initialization is to avoid clang warnings about */
/* potential state->level change, that never happens */
struct snapraid_parity* parity_ptr[LEV_MAX] = { 0 };
struct snapraid_parity_handle* parity_ptr[LEV_MAX] = { 0 };
unsigned unrecoverable_error;
unsigned l;
int skip_sync = 0;