mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-20 15:06:34 -05:00
Adjust verbs in comments
This commit is contained in:
parent
52212305a5
commit
452a595067
23 changed files with 243 additions and 243 deletions
|
|
@ -64,7 +64,7 @@ struct failed_struct {
|
|||
};
|
||||
|
||||
/**
|
||||
* Checks if a block hash matches the specified buffer.
|
||||
* Check if a block hash matches the specified buffer.
|
||||
* Return ==0 if equal
|
||||
*/
|
||||
static int blockcmp(struct snapraid_state* state, int rehash, struct snapraid_block* block, unsigned pos_size, unsigned char* buffer, unsigned char* buffer_zero)
|
||||
|
|
@ -94,7 +94,7 @@ static int blockcmp(struct snapraid_state* state, int rehash, struct snapraid_bl
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the hash of all the failed block we are expecting to recover are now matching.
|
||||
* Check if the hash of all the failed block we are expecting to recover are now matching.
|
||||
*/
|
||||
static int is_hash_matching(struct snapraid_state* state, int rehash, unsigned diskmax, struct failed_struct* failed, unsigned* failed_map, unsigned failed_count, void** buffer, void* buffer_zero)
|
||||
{
|
||||
|
|
@ -137,7 +137,7 @@ static int is_hash_matching(struct snapraid_state* state, int rehash, unsigned d
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if specified parity is now matching with a recomputed one.
|
||||
* Check if specified parity is now matching with a recomputed one.
|
||||
*/
|
||||
static int is_parity_matching(struct snapraid_state* state, unsigned diskmax, unsigned i, void** buffer, void** buffer_recov)
|
||||
{
|
||||
|
|
@ -156,7 +156,7 @@ static int is_parity_matching(struct snapraid_state* state, unsigned diskmax, un
|
|||
|
||||
/**
|
||||
* Repair errors.
|
||||
* Returns <0 if failure for missing strategy, >0 if data is wrong and we cannot rebuild correctly, 0 on success.
|
||||
* Return <0 if failure for missing strategy, >0 if data is wrong and we cannot rebuild correctly, 0 on success.
|
||||
* If success, the parity are computed in the buffer variable.
|
||||
*/
|
||||
static int repair_step(struct snapraid_state* state, int rehash, unsigned pos, unsigned diskmax, struct failed_struct* failed, unsigned* failed_map, unsigned failed_count, void** buffer, void** buffer_recov, void* buffer_zero)
|
||||
|
|
@ -587,7 +587,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
|
|||
/**
|
||||
* Post process all the files at the specified block index ::i.
|
||||
* For each file, if we are at the last block, closes it,
|
||||
* adjust the timestamp, and prints the result.
|
||||
* adjust the timestamp, and print the result.
|
||||
*
|
||||
* This works with the assumption to always process the whole files to
|
||||
* fix. This assumption is not always correct, and in such case we have to
|
||||
|
|
@ -603,7 +603,7 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
|
|||
if (state->opt.badonly)
|
||||
return 0;
|
||||
|
||||
/* for all the files prints the final status, and does the final time fix */
|
||||
/* for all the files print the final status, and does the final time fix */
|
||||
/* we also ensure to close files after processing the last block */
|
||||
for (j = 0; j < diskmax; ++j) {
|
||||
struct snapraid_block* block;
|
||||
|
|
@ -1270,7 +1270,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
}
|
||||
}
|
||||
|
||||
/* now writes recovered files */
|
||||
/* now write recovered files */
|
||||
if (fix) {
|
||||
/* update the fixed files */
|
||||
for (j = 0; j < failed_count; ++j) {
|
||||
|
|
@ -1862,7 +1862,7 @@ bail:
|
|||
free(buffer_alloc);
|
||||
free(buffer);
|
||||
|
||||
/* fails if some error are present after the run */
|
||||
/* fail if some error are present after the run */
|
||||
if (fix) {
|
||||
if (state->opt.expect_unrecoverable) {
|
||||
if (unrecoverable_error == 0)
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ static double raid_prob_of_one_or_more_failures(double array_failure_rate, doubl
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints a string with space padding.
|
||||
* Print a string with space padding.
|
||||
*/
|
||||
static void printl(const char* str, size_t pad)
|
||||
{
|
||||
|
|
@ -610,7 +610,7 @@ static void printl(const char* str, size_t pad)
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints a probability with space padding.
|
||||
* Print a probability with space padding.
|
||||
*/
|
||||
static void printp(double v, size_t pad)
|
||||
{
|
||||
|
|
@ -828,7 +828,7 @@ static void state_smart(unsigned n, tommy_list* low)
|
|||
printf("Probability that at least one disk is going to fail in the next year is %.0f%%.\n", p_at_least_one_failure * 100);
|
||||
log_tag("summary:array_failure:%g:%g\n", array_failure_rate, p_at_least_one_failure);
|
||||
|
||||
/* prints extra stats only in verbose mode */
|
||||
/* print extra stats only in verbose mode */
|
||||
if (msg_level < MSG_VERBOSE)
|
||||
goto bail;
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ static int filter_apply(struct snapraid_filter* filter, struct snapraid_filter**
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
/* matches dirs with dirs and files with files */
|
||||
/* match dirs with dirs and files with files */
|
||||
if (filter->is_dir && !is_dir)
|
||||
return 0;
|
||||
if (!filter->is_dir && is_dir)
|
||||
|
|
|
|||
102
cmdline/elem.h
102
cmdline/elem.h
|
|
@ -413,27 +413,27 @@ struct snapraid_parity {
|
|||
typedef uint32_t snapraid_info;
|
||||
|
||||
/**
|
||||
* Allocates a content.
|
||||
* Allocate a content.
|
||||
*/
|
||||
struct snapraid_content* content_alloc(const char* path, uint64_t dev);
|
||||
|
||||
/**
|
||||
* Deallocates a content.
|
||||
* Deallocate a content.
|
||||
*/
|
||||
void content_free(struct snapraid_content* content);
|
||||
|
||||
/**
|
||||
* Allocates a filter pattern for files and directories.
|
||||
* Allocate a filter pattern for files and directories.
|
||||
*/
|
||||
struct snapraid_filter* filter_alloc_file(int is_include, const char* pattern);
|
||||
|
||||
/**
|
||||
* Allocates a filter pattern for disks.
|
||||
* Allocate a filter pattern for disks.
|
||||
*/
|
||||
struct snapraid_filter* filter_alloc_disk(int is_include, const char* pattern);
|
||||
|
||||
/**
|
||||
* Deallocates an exclusion.
|
||||
* Deallocate an exclusion.
|
||||
*/
|
||||
void filter_free(struct snapraid_filter* filter);
|
||||
|
||||
|
|
@ -456,7 +456,7 @@ static inline int filter_hidden(int enable, struct dirent* dd)
|
|||
}
|
||||
|
||||
/**
|
||||
* Filters a path using a list of filters.
|
||||
* Filter a path using a list of filters.
|
||||
* For each element of the path all the filters are applied, until the first one that matches.
|
||||
* Return !=0 if it should be excluded.
|
||||
*/
|
||||
|
|
@ -476,20 +476,20 @@ int filter_existence(int filter_missing, const char* dir, const char* sub);
|
|||
int filter_correctness(int filter_error, tommy_arrayblkof* infoarr, struct snapraid_disk* disk, struct snapraid_file* file);
|
||||
|
||||
/**
|
||||
* Filters a dir using a list of filters.
|
||||
* Filter a dir using a list of filters.
|
||||
* For each element of the path all the filters are applied, until the first one that matches.
|
||||
* Return !=0 if should be excluded.
|
||||
*/
|
||||
int filter_dir(tommy_list* filterlist, struct snapraid_filter** reason, const char* disk, const char* sub);
|
||||
|
||||
/**
|
||||
* Filters a path if it's a content file.
|
||||
* Filter a path if it's a content file.
|
||||
* Return !=0 if should be excluded.
|
||||
*/
|
||||
int filter_content(tommy_list* contentlist, const char* path);
|
||||
|
||||
/**
|
||||
* Checks if the specified hash is invalid.
|
||||
* Check if the specified hash is invalid.
|
||||
*
|
||||
* An invalid hash is represented with all bytes at 0x00.
|
||||
*/
|
||||
|
|
@ -505,7 +505,7 @@ static inline int hash_is_invalid(const unsigned char* hash)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified hash represent the zero block.
|
||||
* Check if the specified hash represent the zero block.
|
||||
*
|
||||
* A zero hash is represented with all bytes at 0xFF.
|
||||
*/
|
||||
|
|
@ -521,7 +521,7 @@ static inline int hash_is_zero(const unsigned char* hash)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified hash is a real hash.
|
||||
* Check if the specified hash is a real hash.
|
||||
*/
|
||||
static inline int hash_is_real(const unsigned char* hash)
|
||||
{
|
||||
|
|
@ -567,7 +567,7 @@ static inline void block_state_set(struct snapraid_block* block, unsigned state)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified block has an updated hash.
|
||||
* Check if the specified block has an updated hash.
|
||||
*
|
||||
* Note that EMPTY / CHG / DELETED return 0.
|
||||
*/
|
||||
|
|
@ -579,7 +579,7 @@ static inline int block_has_updated_hash(const struct snapraid_block* block)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified block has a past hash,
|
||||
* Check if the specified block has a past hash,
|
||||
* i.e. the hash of the data that it's now overwritten or lost.
|
||||
*
|
||||
* Note that EMPTY / BLK / REP return 0.
|
||||
|
|
@ -592,7 +592,7 @@ static inline int block_has_past_hash(const struct snapraid_block* block)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified block is part of a file.
|
||||
* Check if the specified block is part of a file.
|
||||
*
|
||||
* Note that EMPTY / DELETED return 0.
|
||||
*/
|
||||
|
|
@ -605,7 +605,7 @@ static inline int block_has_file(const struct snapraid_block* block)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the block has an invalid parity than needs to be updated.
|
||||
* Check if the block has an invalid parity than needs to be updated.
|
||||
*
|
||||
* Note that EMPTY / BLK return 0.
|
||||
*/
|
||||
|
|
@ -618,7 +618,7 @@ static inline int block_has_invalid_parity(const struct snapraid_block* block)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the block is part of a file with valid parity.
|
||||
* Check if the block is part of a file with valid parity.
|
||||
*
|
||||
* Note that anything different than BLK return 0.
|
||||
*/
|
||||
|
|
@ -670,43 +670,43 @@ void file_rename(struct snapraid_file* file, const char* sub);
|
|||
void file_copy(struct snapraid_file* src_file, struct snapraid_file* dest_file);
|
||||
|
||||
/**
|
||||
* Returns the name of the file, without the dir.
|
||||
* Return the name of the file, without the dir.
|
||||
*/
|
||||
const char* file_name(const struct snapraid_file* file);
|
||||
|
||||
/**
|
||||
* Checks if the block is the last in the file.
|
||||
* Check if the block is the last in the file.
|
||||
*/
|
||||
int file_block_is_last(struct snapraid_file* file, block_off_t file_pos);
|
||||
|
||||
/**
|
||||
* Gets the size in bytes of the block.
|
||||
* Get the size in bytes of the block.
|
||||
* If it's the last block of a file it could be less than block_size.
|
||||
*/
|
||||
unsigned file_block_size(struct snapraid_file* file, block_off_t file_pos, unsigned block_size);
|
||||
|
||||
/**
|
||||
* Compares a file with an inode.
|
||||
* Compare a file with an inode.
|
||||
*/
|
||||
int file_inode_compare_to_arg(const void* void_arg, const void* void_data);
|
||||
|
||||
/**
|
||||
* Compares files by inode.
|
||||
* Compare files by inode.
|
||||
*/
|
||||
int file_inode_compare(const void* void_a, const void* void_b);
|
||||
|
||||
/**
|
||||
* Compares files by path.
|
||||
* Compare files by path.
|
||||
*/
|
||||
int file_path_compare(const void* void_a, const void* void_b);
|
||||
|
||||
/**
|
||||
* Compares files by physical address.
|
||||
* Compare files by physical address.
|
||||
*/
|
||||
int file_physical_compare(const void* void_a, const void* void_b);
|
||||
|
||||
/**
|
||||
* Computes the hash of a file inode.
|
||||
* Compute the hash of a file inode.
|
||||
*/
|
||||
static inline tommy_uint32_t file_inode_hash(uint64_t inode)
|
||||
{
|
||||
|
|
@ -714,7 +714,7 @@ static inline tommy_uint32_t file_inode_hash(uint64_t inode)
|
|||
}
|
||||
|
||||
/**
|
||||
* Compares a file with a path.
|
||||
* Compare a file with a path.
|
||||
*/
|
||||
int file_path_compare_to_arg(const void* void_arg, const void* void_data);
|
||||
|
||||
|
|
@ -727,7 +727,7 @@ int file_namestamp_compare(const void* void_a, const void* void_b);
|
|||
int file_pathstamp_compare(const void* void_a, const void* void_b);
|
||||
|
||||
/**
|
||||
* Computes the hash of a file path.
|
||||
* Compute the hash of a file path.
|
||||
*/
|
||||
static inline tommy_uint32_t file_path_hash(const char* sub)
|
||||
{
|
||||
|
|
@ -735,7 +735,7 @@ static inline tommy_uint32_t file_path_hash(const char* sub)
|
|||
}
|
||||
|
||||
/**
|
||||
* Computes the hash of a file stamp.
|
||||
* Compute the hash of a file stamp.
|
||||
*/
|
||||
static inline tommy_uint32_t file_stamp_hash(data_off_t size, int64_t mtime_sec, int mtime_nsec)
|
||||
{
|
||||
|
|
@ -789,12 +789,12 @@ static inline unsigned link_flag_get(struct snapraid_link* link, unsigned mask)
|
|||
}
|
||||
|
||||
/**
|
||||
* Allocates a link.
|
||||
* Allocate a link.
|
||||
*/
|
||||
struct snapraid_link* link_alloc(const char* name, const char* link, unsigned link_flag);
|
||||
|
||||
/**
|
||||
* Deallocates a link.
|
||||
* Deallocate a link.
|
||||
*/
|
||||
void link_free(struct snapraid_link* link);
|
||||
|
||||
|
|
@ -804,12 +804,12 @@ void link_free(struct snapraid_link* link);
|
|||
int link_name_compare_to_arg(const void* void_arg, const void* void_data);
|
||||
|
||||
/**
|
||||
* Compares links by path.
|
||||
* Compare links by path.
|
||||
*/
|
||||
int link_alpha_compare(const void* void_a, const void* void_b);
|
||||
|
||||
/**
|
||||
* Computes the hash of a link name.
|
||||
* Compute the hash of a link name.
|
||||
*/
|
||||
static inline tommy_uint32_t link_name_hash(const char* name)
|
||||
{
|
||||
|
|
@ -832,12 +832,12 @@ static inline void dir_flag_clear(struct snapraid_dir* dir, unsigned mask)
|
|||
}
|
||||
|
||||
/**
|
||||
* Allocates a dir.
|
||||
* Allocate a dir.
|
||||
*/
|
||||
struct snapraid_dir* dir_alloc(const char* name);
|
||||
|
||||
/**
|
||||
* Deallocates a dir.
|
||||
* Deallocate a dir.
|
||||
*/
|
||||
void dir_free(struct snapraid_dir* dir);
|
||||
|
||||
|
|
@ -847,7 +847,7 @@ void dir_free(struct snapraid_dir* dir);
|
|||
int dir_name_compare(const void* void_arg, const void* void_data);
|
||||
|
||||
/**
|
||||
* Computes the hash of a dir name.
|
||||
* Compute the hash of a dir name.
|
||||
*/
|
||||
static inline tommy_uint32_t dir_name_hash(const char* name)
|
||||
{
|
||||
|
|
@ -855,12 +855,12 @@ static inline tommy_uint32_t dir_name_hash(const char* name)
|
|||
}
|
||||
|
||||
/**
|
||||
* Allocates a disk.
|
||||
* Allocate a disk.
|
||||
*/
|
||||
struct snapraid_disk* disk_alloc(const char* name, const char* dir, uint64_t dev);
|
||||
|
||||
/**
|
||||
* Deallocates a disk.
|
||||
* Deallocate a disk.
|
||||
*/
|
||||
void disk_free(struct snapraid_disk* disk);
|
||||
|
||||
|
|
@ -922,18 +922,18 @@ block_off_t fs_file2par_get(struct snapraid_disk* disk, struct snapraid_file* fi
|
|||
|
||||
/**
|
||||
* Get the block from the parity position.
|
||||
* Returns BLOCK_EMPTY==0 if the block is over the end of the disk or not used.
|
||||
* Return BLOCK_EMPTY==0 if the block is over the end of the disk or not used.
|
||||
*/
|
||||
struct snapraid_block* fs_par2block_get(struct snapraid_disk* disk, block_off_t parity_pos);
|
||||
|
||||
/**
|
||||
* Allocates a disk mapping.
|
||||
* Allocate a disk mapping.
|
||||
* Uses uuid="" if not available.
|
||||
*/
|
||||
struct snapraid_map* map_alloc(const char* name, unsigned position, block_off_t total_blocks, block_off_t free_blocks, const char* uuid);
|
||||
|
||||
/**
|
||||
* Deallocates a disk mapping.
|
||||
* Deallocate a disk mapping.
|
||||
*/
|
||||
void map_free(struct snapraid_map* map);
|
||||
|
||||
|
|
@ -945,7 +945,7 @@ void map_free(struct snapraid_map* map);
|
|||
#define INFO_MASK 0x7
|
||||
|
||||
/**
|
||||
* Makes an info.
|
||||
* Make an info.
|
||||
*/
|
||||
static inline snapraid_info info_make(time_t last_access, int error, int rehash, int justsynced)
|
||||
{
|
||||
|
|
@ -962,7 +962,7 @@ static inline snapraid_info info_make(time_t last_access, int error, int rehash,
|
|||
}
|
||||
|
||||
/**
|
||||
* Extracts the time information.
|
||||
* Extract the time information.
|
||||
* This is the last time when the block was know to be correct.
|
||||
* The "scrubbed" info tells if the time is referreing at the latest sync or scrub.
|
||||
*/
|
||||
|
|
@ -972,8 +972,8 @@ static inline time_t info_get_time(snapraid_info info)
|
|||
}
|
||||
|
||||
/**
|
||||
* Extracts the error information.
|
||||
* Reports if the block address had some problem.
|
||||
* Extract the error information.
|
||||
* Report if the block address had some problem.
|
||||
*/
|
||||
static inline int info_get_bad(snapraid_info info)
|
||||
{
|
||||
|
|
@ -981,8 +981,8 @@ static inline int info_get_bad(snapraid_info info)
|
|||
}
|
||||
|
||||
/**
|
||||
* Extracts the rehash information.
|
||||
* Reports if the block address is using the old hash and needs to be rehashed.
|
||||
* Extract the rehash information.
|
||||
* Report if the block address is using the old hash and needs to be rehashed.
|
||||
*/
|
||||
static inline int info_get_rehash(snapraid_info info)
|
||||
{
|
||||
|
|
@ -990,8 +990,8 @@ static inline int info_get_rehash(snapraid_info info)
|
|||
}
|
||||
|
||||
/**
|
||||
* Extracts the scrubbed information.
|
||||
* Reports if the block address was never scrubbed.
|
||||
* Extract the scrubbed information.
|
||||
* Report if the block address was never scrubbed.
|
||||
*/
|
||||
static inline int info_get_justsynced(snapraid_info info)
|
||||
{
|
||||
|
|
@ -1012,7 +1012,7 @@ static inline time_t info_get_scrubtime(snapraid_info info)
|
|||
}
|
||||
|
||||
/**
|
||||
* Marks the block address as with error.
|
||||
* Mark the block address as with error.
|
||||
*/
|
||||
static inline snapraid_info info_set_bad(snapraid_info info)
|
||||
{
|
||||
|
|
@ -1020,7 +1020,7 @@ static inline snapraid_info info_set_bad(snapraid_info info)
|
|||
}
|
||||
|
||||
/**
|
||||
* Marks the block address as with rehash.
|
||||
* Mark the block address as with rehash.
|
||||
*/
|
||||
static inline snapraid_info info_set_rehash(snapraid_info info)
|
||||
{
|
||||
|
|
@ -1028,7 +1028,7 @@ static inline snapraid_info info_set_rehash(snapraid_info info)
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the info at the specified position.
|
||||
* Set the info at the specified position.
|
||||
* The position is allocated if not yet done.
|
||||
*/
|
||||
static inline void info_set(tommy_arrayblkof* array, unsigned pos, snapraid_info info)
|
||||
|
|
@ -1039,7 +1039,7 @@ static inline void info_set(tommy_arrayblkof* array, unsigned pos, snapraid_info
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the info at the specified position.
|
||||
* Get the info at the specified position.
|
||||
* For not allocated position, 0 is returned.
|
||||
*/
|
||||
static inline snapraid_info info_get(tommy_arrayblkof* array, unsigned pos)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ struct snapraid_handle {
|
|||
};
|
||||
|
||||
/**
|
||||
* Creates a file.
|
||||
* Create a file.
|
||||
* The file is created if missing, and opened with write access.
|
||||
* If the file is created, the handle->created is set.
|
||||
* The initial size of the file is stored in the file->st struct.
|
||||
|
|
@ -50,13 +50,13 @@ int handle_create(struct snapraid_handle* handle, struct snapraid_file* file, in
|
|||
int handle_truncate(struct snapraid_handle* handle, struct snapraid_file* file);
|
||||
|
||||
/**
|
||||
* Opens a file.
|
||||
* Open a file.
|
||||
* The file is opened for reading.
|
||||
*/
|
||||
int handle_open(struct snapraid_handle* handle, struct snapraid_file* file, int mode, fptr* out, fptr* out_missing);
|
||||
|
||||
/**
|
||||
* Closes a file.
|
||||
* Close a file.
|
||||
*/
|
||||
int handle_close(struct snapraid_handle* handle);
|
||||
|
||||
|
|
@ -67,17 +67,17 @@ int handle_close(struct snapraid_handle* handle);
|
|||
int handle_read(struct snapraid_handle* handle, block_off_t file_pos, unsigned char* block_buffer, unsigned block_size, fptr* out, fptr* out_missing);
|
||||
|
||||
/**
|
||||
* Writes a block to a file.
|
||||
* Write a block to a file.
|
||||
*/
|
||||
int handle_write(struct snapraid_handle* handle, block_off_t file_pos, unsigned char* block_buffer, unsigned block_size);
|
||||
|
||||
/**
|
||||
* Changes the modification time of the file to the saved value.
|
||||
* Change the modification time of the file to the saved value.
|
||||
*/
|
||||
int handle_utime(struct snapraid_handle* handle);
|
||||
|
||||
/**
|
||||
* Maps the unsorted list of disk to an ordered vector.
|
||||
* Map the unsorted list of disk to an ordered vector.
|
||||
* \param diskmax The size of the vector.
|
||||
* \return The allocated vector of pointers.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
/* import */
|
||||
|
||||
/**
|
||||
* Compares the hash of two import blocks.
|
||||
* Compare the hash of two import blocks.
|
||||
*/
|
||||
int import_block_hash_compare(const void* void_arg, const void* void_data)
|
||||
{
|
||||
|
|
@ -43,7 +43,7 @@ int import_block_prevhash_compare(const void* void_arg, const void* void_data)
|
|||
}
|
||||
|
||||
/**
|
||||
* Computes the hash of the hash for an import block.
|
||||
* Compute the hash of the hash for an import block.
|
||||
* We just use the first 32 bit of the hash itself.
|
||||
*/
|
||||
static inline tommy_uint32_t import_block_hash(const unsigned char* hash)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ struct snapraid_import_file {
|
|||
};
|
||||
|
||||
/**
|
||||
* Deallocates an import file.
|
||||
* Deallocate an import file.
|
||||
*/
|
||||
void import_file_free(struct snapraid_import_file* file);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ int exit_success = 0;
|
|||
int exit_failure = 1;
|
||||
int exit_sync_needed = 2;
|
||||
|
||||
/* Adds missing Windows declaration */
|
||||
/* Add missing Windows declaration */
|
||||
typedef struct _FILE_ATTRIBUTE_TAG_INFO {
|
||||
DWORD FileAttributes;
|
||||
DWORD ReparseTag;
|
||||
|
|
@ -260,7 +260,7 @@ static char conv_utf8_buffer[CONV_ROLL][PATH_MAX];
|
|||
static pthread_mutex_t conv_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Converts a generic string from UTF8 to UTF16.
|
||||
* Convert a generic string from UTF8 to UTF16.
|
||||
*/
|
||||
static wchar_t* u8tou16(const char* src)
|
||||
{
|
||||
|
|
@ -284,7 +284,7 @@ static wchar_t* u8tou16(const char* src)
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts a generic string from UTF16 to UTF8.
|
||||
* Convert a generic string from UTF16 to UTF8.
|
||||
*/
|
||||
static char* u16tou8ex(const wchar_t* src, size_t number_of_wchar, size_t* result_length_without_terminator)
|
||||
{
|
||||
|
|
@ -325,7 +325,7 @@ static int is_slash(char c)
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts a path to the Windows format.
|
||||
* Convert a path to the Windows format.
|
||||
*
|
||||
* If only_is_required is 1, the extended-length format is used only if required.
|
||||
*
|
||||
|
|
@ -435,7 +435,7 @@ static BOOL GetReparseTagInfoByHandle(HANDLE hFile, FILE_ATTRIBUTE_TAG_INFO* lpF
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts Windows attr to the Unix stat format.
|
||||
* Convert Windows attr to the Unix stat format.
|
||||
*/
|
||||
static void windows_attr2stat(DWORD FileAttributes, DWORD ReparseTag, struct windows_stat* st)
|
||||
{
|
||||
|
|
@ -513,7 +513,7 @@ static void windows_attr2stat(DWORD FileAttributes, DWORD ReparseTag, struct win
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts Windows info to the Unix stat format.
|
||||
* Convert Windows info to the Unix stat format.
|
||||
*/
|
||||
static void windows_info2stat(const BY_HANDLE_FILE_INFORMATION* info, const FILE_ATTRIBUTE_TAG_INFO* tag, struct windows_stat* st)
|
||||
{
|
||||
|
|
@ -550,7 +550,7 @@ static void windows_info2stat(const BY_HANDLE_FILE_INFORMATION* info, const FILE
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts Windows info to the Unix stat format.
|
||||
* Convert Windows info to the Unix stat format.
|
||||
*/
|
||||
static void windows_stream2stat(const BY_HANDLE_FILE_INFORMATION* info, const FILE_ID_BOTH_DIR_INFO* stream, struct windows_stat* st)
|
||||
{
|
||||
|
|
@ -584,7 +584,7 @@ static void windows_stream2stat(const BY_HANDLE_FILE_INFORMATION* info, const FI
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts Windows findfirst info to the Unix stat format.
|
||||
* Convert Windows findfirst info to the Unix stat format.
|
||||
*/
|
||||
static void windows_finddata2stat(const WIN32_FIND_DATAW* info, struct windows_stat* st)
|
||||
{
|
||||
|
|
@ -657,7 +657,7 @@ static void windows_stream2dirent(const BY_HANDLE_FILE_INFORMATION* info, const
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts Windows error to errno.
|
||||
* Convert Windows error to errno.
|
||||
*/
|
||||
static void windows_errno(DWORD error)
|
||||
{
|
||||
|
|
@ -1956,8 +1956,8 @@ static int devtree(const char* name, const char* custom, const char* wfile, devi
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads smartctl --scan from a stream.
|
||||
* Returns 0 on success.
|
||||
* Read smartctl --scan from a stream.
|
||||
* Return 0 on success.
|
||||
*/
|
||||
static int smartctl_scan(FILE* f, tommy_list* list)
|
||||
{
|
||||
|
|
@ -2068,7 +2068,7 @@ static int devscan(tommy_list* list)
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets SMART attributes.
|
||||
* Get SMART attributes.
|
||||
*/
|
||||
static int devsmart(uint64_t device, const char* name, const char* custom, uint64_t* smart, char* serial)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ int fallback(int f, struct stat* st)
|
|||
/* cmd */
|
||||
|
||||
/**
|
||||
* Creates a file with random content.
|
||||
* Create a file with random content.
|
||||
* - If the file exists it's rewritten, but avoiding to truncating it to 0.
|
||||
*/
|
||||
void cmd_generate_file(const char* path, int size)
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ struct snapraid_parity_handle {
|
|||
};
|
||||
|
||||
/**
|
||||
* Computes the size of the allocated parity data in number of blocks.
|
||||
* Compute the size of the allocated parity data in number of blocks.
|
||||
*
|
||||
* This includes parity blocks not yet written and still invalid.
|
||||
*/
|
||||
block_off_t parity_allocated_size(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Computes the size of the used parity data in number of blocks.
|
||||
* Compute the size of the used parity data in number of blocks.
|
||||
*
|
||||
* This includes only parity blocks used for files, not counting
|
||||
* potential invalid parity at the end.
|
||||
|
|
@ -52,7 +52,7 @@ block_off_t parity_allocated_size(struct snapraid_state* state);
|
|||
block_off_t parity_used_size(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Checks if the parity needs to be updated with a "sync".
|
||||
* Check if the parity needs to be updated with a "sync".
|
||||
*
|
||||
* This is the same logic used in "status" to detect an incomplete "sync",
|
||||
* that ignores invalid block, if they are not used by a file in any disk.
|
||||
|
|
@ -66,34 +66,34 @@ int parity_is_invalid(struct snapraid_state* state);
|
|||
int parity_is_invalid(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Reports all the files outside the specified parity size.
|
||||
* Report all the files outside the specified parity size.
|
||||
*/
|
||||
void parity_overflow(struct snapraid_state* state, data_off_t size);
|
||||
|
||||
/**
|
||||
* Creates the parity file.
|
||||
* Create the parity file.
|
||||
* \param out_size Return the size of the parity file.
|
||||
*/
|
||||
int parity_create(struct snapraid_parity_handle* parity, const char* path, data_off_t* out_size, int mode);
|
||||
|
||||
/**
|
||||
* Changes the parity size.
|
||||
* Change 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_handle* parity, data_off_t size, data_off_t* out_size, int skip_fallocate);
|
||||
|
||||
/**
|
||||
* Opens an already existing parity file.
|
||||
* Open an already existing parity file.
|
||||
*/
|
||||
int parity_open(struct snapraid_parity_handle* parity, const char* path, int mode);
|
||||
|
||||
/**
|
||||
* Flushes the parity file in the disk.
|
||||
* Flush the parity file in the disk.
|
||||
*/
|
||||
int parity_sync(struct snapraid_parity_handle* parity);
|
||||
|
||||
/**
|
||||
* Closes the parity file.
|
||||
* Close the parity file.
|
||||
*/
|
||||
int parity_close(struct snapraid_parity_handle* parity);
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ int parity_close(struct snapraid_parity_handle* parity);
|
|||
int parity_read(struct snapraid_parity_handle* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size, fptr* out);
|
||||
|
||||
/**
|
||||
* Writes a block in the parity file.
|
||||
* Write a block in the parity file.
|
||||
*/
|
||||
int parity_write(struct snapraid_parity_handle* parity, block_off_t pos, unsigned char* block_buffer, unsigned block_size);
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ static int clean_dir(struct snapraid_state* state, const char* dir)
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a link to the specified disk entry.
|
||||
* Create a link to the specified disk entry.
|
||||
*/
|
||||
static void make_link(const char* pool_dir, const char* share_dir, struct snapraid_disk* disk, const char* sub)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ static inline int hardlink(const char* a, const char* b)
|
|||
|
||||
/**
|
||||
* Get the device UUID.
|
||||
* Returns 0 on success.
|
||||
* Return 0 on success.
|
||||
*/
|
||||
int devuuid(uint64_t device, char* uuid, size_t size);
|
||||
|
||||
|
|
@ -289,13 +289,13 @@ int devuuid(uint64_t device, char* uuid, size_t size);
|
|||
/**
|
||||
* Get the physcal address of the specified file.
|
||||
* This is expected to be just a hint and not necessarely correct or unique.
|
||||
* Returns 0 on success.
|
||||
* Return 0 on success.
|
||||
*/
|
||||
int filephy(const char* path, uint64_t size, uint64_t* physical);
|
||||
|
||||
/**
|
||||
* Checks if the underline filesystem support persistent inodes.
|
||||
* Returns -1 on error, 0 on success.
|
||||
* Check if the underline filesystem support persistent inodes.
|
||||
* Return -1 on error, 0 on success.
|
||||
*/
|
||||
int fsinfo(const char* path, int* has_persistent_inode, uint64_t* total_space, uint64_t* free_space);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ struct snapraid_scan {
|
|||
};
|
||||
|
||||
/**
|
||||
* Removes the specified link from the data set.
|
||||
* Remove the specified link from the data set.
|
||||
*/
|
||||
static void scan_link_remove(struct snapraid_scan* scan, struct snapraid_link* link)
|
||||
{
|
||||
|
|
@ -65,7 +65,7 @@ static void scan_link_remove(struct snapraid_scan* scan, struct snapraid_link* l
|
|||
}
|
||||
|
||||
/**
|
||||
* Inserts the specified link in the data set.
|
||||
* Insert the specified link in the data set.
|
||||
*/
|
||||
static void scan_link_insert(struct snapraid_scan* scan, struct snapraid_link* link)
|
||||
{
|
||||
|
|
@ -81,7 +81,7 @@ static void scan_link_insert(struct snapraid_scan* scan, struct snapraid_link* l
|
|||
}
|
||||
|
||||
/**
|
||||
* Processes a symbolic link.
|
||||
* Process a symbolic link.
|
||||
*/
|
||||
static void scan_link(struct snapraid_scan* scan, int is_diff, const char* sub, const char* linkto, unsigned link_flag)
|
||||
{
|
||||
|
|
@ -350,7 +350,7 @@ static void scan_file_delayed_allocate(struct snapraid_scan* scan, struct snapra
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if a file is completely formed of blocks with invalid parity,
|
||||
* Check if a file is completely formed of blocks with invalid parity,
|
||||
* and no rehash is tagged, and if it has at least one block.
|
||||
*/
|
||||
static int file_is_full_invalid_parity_and_stable(struct snapraid_state* state, struct snapraid_disk* disk, struct snapraid_file* file)
|
||||
|
|
@ -383,7 +383,7 @@ static int file_is_full_invalid_parity_and_stable(struct snapraid_state* state,
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if a file is completely formed of blocks with an updated hash,
|
||||
* Check if a file is completely formed of blocks with an updated hash,
|
||||
* and no rehash is tagged, and if it has at least one block.
|
||||
*/
|
||||
static int file_is_full_hashed_and_stable(struct snapraid_state* state, struct snapraid_disk* disk, struct snapraid_file* file)
|
||||
|
|
@ -562,7 +562,7 @@ static void scan_file_keep(struct snapraid_scan* scan, struct snapraid_file* fil
|
|||
}
|
||||
|
||||
/**
|
||||
* Processes a file.
|
||||
* Process a file.
|
||||
*/
|
||||
static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub, struct stat* st, uint64_t physical)
|
||||
{
|
||||
|
|
@ -928,7 +928,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes the specified dir from the data set.
|
||||
* Remove the specified dir from the data set.
|
||||
*/
|
||||
static void scan_emptydir_remove(struct snapraid_scan* scan, struct snapraid_dir* dir)
|
||||
{
|
||||
|
|
@ -947,7 +947,7 @@ static void scan_emptydir_remove(struct snapraid_scan* scan, struct snapraid_dir
|
|||
}
|
||||
|
||||
/**
|
||||
* Inserts the specified dir in the data set.
|
||||
* Insert the specified dir in the data set.
|
||||
*/
|
||||
static void scan_emptydir_insert(struct snapraid_scan* scan, struct snapraid_dir* dir)
|
||||
{
|
||||
|
|
@ -963,7 +963,7 @@ static void scan_emptydir_insert(struct snapraid_scan* scan, struct snapraid_dir
|
|||
}
|
||||
|
||||
/**
|
||||
* Processes a dir.
|
||||
* Process a dir.
|
||||
*/
|
||||
static void scan_emptydir(struct snapraid_scan* scan, const char* sub)
|
||||
{
|
||||
|
|
@ -1040,7 +1040,7 @@ static int dd_name_compare(const void* void_a, const void* void_b)
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the stat info of a dir entry.
|
||||
* Return the stat info of a dir entry.
|
||||
*/
|
||||
#if HAVE_STRUCT_DIRENT_D_STAT
|
||||
#define DSTAT(file, dd, buf) dstat(dd)
|
||||
|
|
@ -1063,7 +1063,7 @@ struct stat* dstat(const char* file, struct stat* st)
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Processes a directory.
|
||||
* Process a directory.
|
||||
* Return != 0 if at least one file or link is processed.
|
||||
*/
|
||||
static int scan_dir(struct snapraid_scan* scan, int level, int is_diff, const char* dir, const char* sub)
|
||||
|
|
@ -1409,7 +1409,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
|
||||
/* if inodes or UUID are not persistent/changed/unsupported */
|
||||
if (disk->has_volatile_inodes || disk->has_different_uuid || disk->has_unsupported_uuid) {
|
||||
/* removes all the inodes from the inode collection */
|
||||
/* remove all the inodes from the inode collection */
|
||||
/* if they are not persistent, all of them could be changed now */
|
||||
/* and we don't want to find false matching ones */
|
||||
/* see scan_file() for more details */
|
||||
|
|
@ -1538,7 +1538,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
/* files without offset are expected to have duplicates */
|
||||
&& phy_last != FILEPHY_WITHOUT_OFFSET
|
||||
) {
|
||||
/* if verbose, prints the list of duplicates real offsets */
|
||||
/* if verbose, print the list of duplicates real offsets */
|
||||
/* other cases are for offsets not supported, so we don't need to report them file by file */
|
||||
if (phy_last >= FILEPHY_REAL_OFFSET) {
|
||||
log_fatal("WARNING! Files '%s%s' and '%s%s' have the same physical offset %" PRId64 ".\n", disk->dir, phy_file_last->sub, disk->dir, file->sub, phy_last);
|
||||
|
|
@ -1588,7 +1588,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
}
|
||||
}
|
||||
|
||||
/* checks for disks where all the previously existing files where removed */
|
||||
/* check for disks where all the previously existing files where removed */
|
||||
if (!state->opt.force_empty) {
|
||||
int all_missing = 0;
|
||||
int all_rewritten = 0;
|
||||
|
|
@ -1635,7 +1635,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
}
|
||||
}
|
||||
|
||||
/* checks for disks without the physical offset support */
|
||||
/* check for disks without the physical offset support */
|
||||
if (state->opt.force_order == SORT_PHYSICAL) {
|
||||
done = 0;
|
||||
for (i = state->disklist; i != 0; i = i->next) {
|
||||
|
|
@ -1655,7 +1655,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
}
|
||||
}
|
||||
|
||||
/* checks for disks without persistent inodes */
|
||||
/* check for disks without persistent inodes */
|
||||
done = 0;
|
||||
for (i = state->disklist; i != 0; i = i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
|
|
@ -1673,7 +1673,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
log_fatal(". Move operations won't be optimal.\n");
|
||||
}
|
||||
|
||||
/* checks for disks with changed UUID */
|
||||
/* check for disks with changed UUID */
|
||||
done = 0;
|
||||
for (i = state->disklist; i != 0; i = i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
|
|
@ -1695,7 +1695,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
log_fatal(". Move operations won't be optimal.\n");
|
||||
}
|
||||
|
||||
/* checks for disks with unsupported UUID */
|
||||
/* check for disks with unsupported UUID */
|
||||
done = 0;
|
||||
for (i = state->disklist; i != 0; i = i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ bail:
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a * b / c approximated to the upper value.
|
||||
* Return a * b / c approximated to the upper value.
|
||||
*/
|
||||
static uint32_t md(uint32_t a, uint32_t b, uint32_t c)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct snapraid_search_file {
|
|||
};
|
||||
|
||||
/**
|
||||
* Deallocates a search file.
|
||||
* Deallocate a search file.
|
||||
*/
|
||||
void search_file_free(struct snapraid_search_file* file);
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ void state_done(struct snapraid_state* state)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks the configuration.
|
||||
* Check the configuration.
|
||||
*/
|
||||
static void state_config_check(struct snapraid_state* state, const char* path, tommy_list* filterlist_disk)
|
||||
{
|
||||
|
|
@ -205,7 +205,7 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* checks for equal paths */
|
||||
/* check for equal paths */
|
||||
for (i = state->contentlist; i != 0; i = i->next) {
|
||||
struct snapraid_content* content = i->data;
|
||||
|
||||
|
|
@ -1053,7 +1053,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
}
|
||||
|
||||
/**
|
||||
* Finds a disk by name.
|
||||
* Find a disk by name.
|
||||
*/
|
||||
static struct snapraid_disk* find_disk(struct snapraid_state* state, const char* name)
|
||||
{
|
||||
|
|
@ -1080,7 +1080,7 @@ static struct snapraid_disk* find_disk(struct snapraid_state* state, const char*
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates the disk mapping if required.
|
||||
* Update the disk mapping if required.
|
||||
*/
|
||||
static void state_map(struct snapraid_state* state)
|
||||
{
|
||||
|
|
@ -1090,7 +1090,7 @@ static void state_map(struct snapraid_state* state)
|
|||
unsigned diskcount;
|
||||
unsigned l;
|
||||
|
||||
/* removes all the mapping without a disk */
|
||||
/* remove all the mapping without a disk */
|
||||
/* this happens when a disk is removed from the configuration file */
|
||||
/* From SnapRAID 4.0 mappings are automatically removed if a disk is not used */
|
||||
/* when saving the content file, but we keep this code to import older content files. */
|
||||
|
|
@ -1164,7 +1164,7 @@ static void state_map(struct snapraid_state* state)
|
|||
/* counter for the number of UUID mismatches */
|
||||
uuid_mismatch = 0;
|
||||
|
||||
/* checks if mapping match the disk uuid */
|
||||
/* check if mapping match the disk uuid */
|
||||
if (!state->opt.skip_disk_access) {
|
||||
for (i = state->maplist; i != 0; i = i->next) {
|
||||
struct snapraid_map* map = i->data;
|
||||
|
|
@ -1212,7 +1212,7 @@ static void state_map(struct snapraid_state* state)
|
|||
}
|
||||
}
|
||||
|
||||
/* checks the parity uuid */
|
||||
/* check the parity uuid */
|
||||
if (!state->opt.skip_parity_access) {
|
||||
for (l = 0; l < state->level; ++l) {
|
||||
char uuid[UUID_MAX];
|
||||
|
|
@ -1349,13 +1349,13 @@ void state_refresh(struct snapraid_state* state)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks the content.
|
||||
* Check the content.
|
||||
*/
|
||||
static void state_content_check(struct snapraid_state* state, const char* path)
|
||||
{
|
||||
tommy_node* i;
|
||||
|
||||
/* checks that any map has different name and position */
|
||||
/* check that any map has different name and position */
|
||||
for (i = state->maplist; i != 0; i = i->next) {
|
||||
struct snapraid_map* map = i->data;
|
||||
tommy_node* j;
|
||||
|
|
@ -1378,7 +1378,7 @@ static void state_content_check(struct snapraid_state* state, const char* path)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the position is REQUIRED, or we can completely clear it from the state.
|
||||
* Check if the position is REQUIRED, or we can completely clear it from the state.
|
||||
*
|
||||
* Note that position with only DELETED blocks are discarged.
|
||||
*/
|
||||
|
|
@ -1400,7 +1400,7 @@ static int position_is_required(struct snapraid_state* state, block_off_t pos)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the info block is REQUIREQ.
|
||||
* Check if the info block is REQUIREQ.
|
||||
*
|
||||
* This is used to ensure that we keep the last check used for scrubbing.
|
||||
* and that we add it when importing old context files.
|
||||
|
|
@ -1446,7 +1446,7 @@ static void position_clear_deleted(struct snapraid_state* state, block_off_t pos
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if a block position in a disk is deleted.
|
||||
* Check if a block position in a disk is deleted.
|
||||
*/
|
||||
static int is_block_deleted(struct snapraid_disk* disk, block_off_t pos)
|
||||
{
|
||||
|
|
@ -1678,7 +1678,7 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST
|
|||
tommy_hashdyn_insert(&disk->stampset, &file->stampset, file, file_stamp_hash(file->size, file->mtime_sec, file->mtime_nsec));
|
||||
tommy_list_insert_tail(&disk->filelist, &file->nodelist, file);
|
||||
|
||||
/* reads all the blocks */
|
||||
/* read all the blocks */
|
||||
v_idx = 0;
|
||||
while (v_idx < file->blockmax) {
|
||||
block_off_t v_pos;
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@
|
|||
#define LEV_MAX 6
|
||||
|
||||
/**
|
||||
* Returns the parity name: Parity, 2-Parity, 3-Parity, 4-Parity, 5-Parity, 6-Parity.
|
||||
* Return the parity name: Parity, 2-Parity, 3-Parity, 4-Parity, 5-Parity, 6-Parity.
|
||||
*/
|
||||
const char* lev_name(unsigned level);
|
||||
|
||||
/**
|
||||
* Returns the parity name used in the config file: parity, 2-parity, 3-parity, 4-parity, 5-parity, 6-parity.
|
||||
* Return the parity name used in the config file: parity, 2-parity, 3-parity, 4-parity, 5-parity, 6-parity.
|
||||
*/
|
||||
const char* lev_config_name(unsigned level);
|
||||
|
||||
|
|
@ -175,27 +175,27 @@ struct snapraid_state {
|
|||
};
|
||||
|
||||
/**
|
||||
* Initializes the state.
|
||||
* Initialize the state.
|
||||
*/
|
||||
void state_init(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Deinitializes the state.
|
||||
* Deinitialize the state.
|
||||
*/
|
||||
void state_done(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Reads the configuration file.
|
||||
* Read the configuration file.
|
||||
*/
|
||||
void state_config(struct snapraid_state* state, const char* path, const char* command, struct snapraid_option* opt, tommy_list* filterlist_disk);
|
||||
|
||||
/**
|
||||
* Reads the state.
|
||||
* Read the state.
|
||||
*/
|
||||
void state_read(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Writes the new state.
|
||||
* Write the new state.
|
||||
*/
|
||||
void state_write(struct snapraid_state* state);
|
||||
|
||||
|
|
@ -205,12 +205,12 @@ void state_write(struct snapraid_state* state);
|
|||
int state_diff(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Scans all the disks to update the state.
|
||||
* Scan all the disks to update the state.
|
||||
*/
|
||||
void state_scan(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Sets the nanosecond timestamp of all files that have a zero value.
|
||||
* Set the nanosecond timestamp of all files that have a zero value.
|
||||
*/
|
||||
void state_nano(struct snapraid_state* state);
|
||||
|
||||
|
|
@ -220,12 +220,12 @@ void state_nano(struct snapraid_state* state);
|
|||
void state_device(struct snapraid_state* state, int operation);
|
||||
|
||||
/**
|
||||
* Syncs the parity data.
|
||||
* Sync the parity data.
|
||||
*/
|
||||
int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t blockcount);
|
||||
|
||||
/**
|
||||
* Checks (and fixes) all the files and parity data.
|
||||
* Check (and fixes) all the files and parity data.
|
||||
* \param fix If we have to fix, after checking.
|
||||
*/
|
||||
int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, block_off_t blockcount);
|
||||
|
|
@ -259,7 +259,7 @@ int state_scrub(struct snapraid_state* state, int percentage, int olderthan);
|
|||
int state_status(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Finds duplicates.
|
||||
* Find duplicates.
|
||||
*/
|
||||
void state_dup(struct snapraid_state* state);
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ void state_dup(struct snapraid_state* state);
|
|||
void state_list(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Creates pool tree.
|
||||
* Create pool tree.
|
||||
*/
|
||||
void state_pool(struct snapraid_state* state);
|
||||
|
||||
|
|
@ -287,17 +287,17 @@ void state_refresh(struct snapraid_state* state);
|
|||
void state_filter(struct snapraid_state* state, tommy_list* filterlist_file, tommy_list* filterlist_disk, int filter_missing, int filter_error);
|
||||
|
||||
/**
|
||||
* Begins the progress visualization.
|
||||
* Begin the progress visualization.
|
||||
*/
|
||||
int state_progress_begin(struct snapraid_state* state, block_off_t blockstart, block_off_t blockmax, block_off_t countmax);
|
||||
|
||||
/**
|
||||
* Ends the progress visualization.
|
||||
* End the progress visualization.
|
||||
*/
|
||||
void state_progress_end(struct snapraid_state* state, block_off_t countpos, block_off_t countmax, data_off_t countsize);
|
||||
|
||||
/**
|
||||
* Writes the progress.
|
||||
* Write the progress.
|
||||
*/
|
||||
int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off_t countpos, block_off_t countmax, data_off_t countsize);
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ static inline void state_usage_parity(struct snapraid_state* state, unsigned lev
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints the stats of the usage time.
|
||||
* Print the stats of the usage time.
|
||||
*/
|
||||
void state_usage_print(struct snapraid_state* state);
|
||||
|
||||
|
|
|
|||
112
cmdline/stream.h
112
cmdline/stream.h
|
|
@ -98,66 +98,66 @@ struct stream {
|
|||
typedef struct stream STREAM;
|
||||
|
||||
/**
|
||||
* Opens a stream for reading. Like fopen("r").
|
||||
* Open a stream for reading. Like fopen("r").
|
||||
*/
|
||||
STREAM* sopen_read(const char* file);
|
||||
|
||||
/**
|
||||
* Opens a stream for writing. Like fopen("w").
|
||||
* Open a stream for writing. Like fopen("w").
|
||||
*/
|
||||
STREAM* sopen_write(const char* file);
|
||||
|
||||
/**
|
||||
* Opens a set of streams for writing. Like fopen("w").
|
||||
* Open a set of streams for writing. Like fopen("w").
|
||||
*/
|
||||
STREAM* sopen_multi_write(unsigned count);
|
||||
|
||||
/**
|
||||
* Specifies the file to open.
|
||||
* Specify the file to open.
|
||||
*/
|
||||
int sopen_multi_file(STREAM* s, unsigned i, const char* file);
|
||||
|
||||
/**
|
||||
* Closes a stream. Like fclose().
|
||||
* Close a stream. Like fclose().
|
||||
*/
|
||||
int sclose(STREAM* s);
|
||||
|
||||
/**
|
||||
* Returns the handle of the file.
|
||||
* Return the handle of the file.
|
||||
* In case of multi file, the first one is returned.
|
||||
*/
|
||||
int shandle(STREAM* s);
|
||||
|
||||
/**
|
||||
* Fills the read stream buffer and read a char.
|
||||
* Fill the read stream buffer and read a char.
|
||||
* \note Don't call this directly, but use sgetc().
|
||||
* \return The char read, or EOF on error.
|
||||
*/
|
||||
int sfill(STREAM* s);
|
||||
|
||||
/**
|
||||
* Flushes the write stream buffer.
|
||||
* Flush the write stream buffer.
|
||||
* \return 0 on success, or EOF on error.
|
||||
*/
|
||||
int sflush(STREAM* s);
|
||||
|
||||
/**
|
||||
* Gets the file pointer.
|
||||
* Get the file pointer.
|
||||
*/
|
||||
int64_t stell(STREAM* s);
|
||||
|
||||
/**
|
||||
* Gets the CRC of the processed data.
|
||||
* Get the CRC of the processed data.
|
||||
*/
|
||||
uint32_t scrc(STREAM* s);
|
||||
|
||||
/**
|
||||
* Gets the CRC of the processed data in put.
|
||||
* Get the CRC of the processed data in put.
|
||||
*/
|
||||
uint32_t scrc_stream(STREAM* s);
|
||||
|
||||
/**
|
||||
* Checks if the buffer has enough data loaded.
|
||||
* Check if the buffer has enough data loaded.
|
||||
*/
|
||||
static inline int sptrlookup(STREAM* s, int size)
|
||||
{
|
||||
|
|
@ -165,7 +165,7 @@ static inline int sptrlookup(STREAM* s, int size)
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the current stream ptr.
|
||||
* Get the current stream ptr.
|
||||
*/
|
||||
static inline unsigned char* sptrget(STREAM* s)
|
||||
{
|
||||
|
|
@ -173,7 +173,7 @@ static inline unsigned char* sptrget(STREAM* s)
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the current stream ptr.
|
||||
* Set the current stream ptr.
|
||||
*/
|
||||
static inline void sptrset(STREAM* s, unsigned char* ptr)
|
||||
{
|
||||
|
|
@ -181,7 +181,7 @@ static inline void sptrset(STREAM* s, unsigned char* ptr)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks the error status. Like ferror().
|
||||
* Check the error status. Like ferror().
|
||||
*/
|
||||
static inline int serror(STREAM* s)
|
||||
{
|
||||
|
|
@ -189,7 +189,7 @@ static inline int serror(STREAM* s)
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks the eof status. Like feof().
|
||||
* Check the eof status. Like feof().
|
||||
*/
|
||||
static inline int seof(STREAM* s)
|
||||
{
|
||||
|
|
@ -197,7 +197,7 @@ static inline int seof(STREAM* s)
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the index of the handle that caused the error.
|
||||
* Get the index of the handle that caused the error.
|
||||
*/
|
||||
static inline int serrorindex(STREAM* s)
|
||||
{
|
||||
|
|
@ -205,7 +205,7 @@ static inline int serrorindex(STREAM* s)
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the path of the handle that caused the error.
|
||||
* Get the path of the handle that caused the error.
|
||||
*/
|
||||
static inline const char* serrorfile(STREAM* s)
|
||||
{
|
||||
|
|
@ -221,7 +221,7 @@ int ssync(STREAM* s);
|
|||
/* get */
|
||||
|
||||
/**
|
||||
* Reads a char. Like fgetc().
|
||||
* Read a char. Like fgetc().
|
||||
*/
|
||||
static inline int sgetc(STREAM* s)
|
||||
{
|
||||
|
|
@ -231,7 +231,7 @@ static inline int sgetc(STREAM* s)
|
|||
}
|
||||
|
||||
/**
|
||||
* Unreads a char.
|
||||
* Unread a char.
|
||||
* Like ungetc() but you have to unget the same char read.
|
||||
*/
|
||||
static inline void sungetc(int c, STREAM* s)
|
||||
|
|
@ -241,13 +241,13 @@ static inline void sungetc(int c, STREAM* s)
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads a fixed amount of chars.
|
||||
* Returns 0 on success, or -1 on error.
|
||||
* Read a fixed amount of chars.
|
||||
* Return 0 on success, or -1 on error.
|
||||
*/
|
||||
int sread(STREAM* f, void* void_data, unsigned size);
|
||||
|
||||
/**
|
||||
* Gets a char from a stream, ignoring one '\r'.
|
||||
* Get a char from a stream, ignoring one '\r'.
|
||||
*/
|
||||
static inline int sgeteol(STREAM* f)
|
||||
{
|
||||
|
|
@ -261,8 +261,8 @@ static inline int sgeteol(STREAM* f)
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads all the spaces and tabs.
|
||||
* Returns the number of spaces and tabs read.
|
||||
* Read all the spaces and tabs.
|
||||
* Return the number of spaces and tabs read.
|
||||
*/
|
||||
static inline int sgetspace(STREAM* f)
|
||||
{
|
||||
|
|
@ -280,28 +280,28 @@ static inline int sgetspace(STREAM* f)
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads until the first space or tab.
|
||||
* Stops at the first ' ', '\t', '\n' or EOF.
|
||||
* Returns <0 if the buffer is too small, or the number of chars read.
|
||||
* Read until the first space or tab.
|
||||
* Stop at the first ' ', '\t', '\n' or EOF.
|
||||
* Return <0 if the buffer is too small, or the number of chars read.
|
||||
*/
|
||||
int sgettok(STREAM* f, char* str, int size);
|
||||
|
||||
/**
|
||||
* Reads until the end of line.
|
||||
* Stops at the first '\n' or EOF. Note that '\n' is left in the stream.
|
||||
* Returns <0 if the buffer is too small, or the number of chars read.
|
||||
* Read until the end of line.
|
||||
* Stop at the first '\n' or EOF. Note that '\n' is left in the stream.
|
||||
* Return <0 if the buffer is too small, or the number of chars read.
|
||||
*/
|
||||
int sgetline(STREAM* f, char* str, int size);
|
||||
|
||||
/**
|
||||
* Like sgetline() but removes ' ' and '\t' at the end.
|
||||
* Like sgetline() but remove ' ' and '\t' at the end.
|
||||
*/
|
||||
int sgetlasttok(STREAM* f, char* str, int size);
|
||||
|
||||
/**
|
||||
* Reads a 32 bit number.
|
||||
* Stops at the first not digit char or EOF.
|
||||
* Returns <0 if there isn't enough to read.
|
||||
* Read a 32 bit number.
|
||||
* Stop at the first not digit char or EOF.
|
||||
* Return <0 if there isn't enough to read.
|
||||
*/
|
||||
int sgetu32(STREAM* f, uint32_t* value);
|
||||
|
||||
|
|
@ -309,26 +309,26 @@ int sgetu32(STREAM* f, uint32_t* value);
|
|||
/* binary get */
|
||||
|
||||
/**
|
||||
* Reads a binary 32 bit number in packet format.
|
||||
* Returns <0 if there isn't enough to read.
|
||||
* Read a binary 32 bit number in packet format.
|
||||
* Return <0 if there isn't enough to read.
|
||||
*/
|
||||
int sgetb32(STREAM* f, uint32_t* value);
|
||||
|
||||
/**
|
||||
* Reads a binary 64 bit number in packet format.
|
||||
* Returns <0 if there isn't enough to read.
|
||||
* Read a binary 64 bit number in packet format.
|
||||
* Return <0 if there isn't enough to read.
|
||||
*/
|
||||
int sgetb64(STREAM* f, uint64_t* value);
|
||||
|
||||
/**
|
||||
* Reads a binary 32 bit number in little endian format.
|
||||
* Returns <0 if there isn't enough to read.
|
||||
* Read a binary 32 bit number in little endian format.
|
||||
* Return <0 if there isn't enough to read.
|
||||
*/
|
||||
int sgetble32(STREAM* f, uint32_t* value);
|
||||
|
||||
/**
|
||||
* Reads a binary string.
|
||||
* Returns -1 on error or if the buffer is too small, or the number of chars read.
|
||||
* Read a binary string.
|
||||
* Return -1 on error or if the buffer is too small, or the number of chars read.
|
||||
*/
|
||||
int sgetbs(STREAM* f, char* str, int size);
|
||||
|
||||
|
|
@ -336,8 +336,8 @@ int sgetbs(STREAM* f, char* str, int size);
|
|||
/* put */
|
||||
|
||||
/**
|
||||
* Writes a char. Like fputc().
|
||||
* Returns 0 on success or -1 on error.
|
||||
* Write a char. Like fputc().
|
||||
* Return 0 on success or -1 on error.
|
||||
*/
|
||||
static inline int sputc(int c, STREAM* s)
|
||||
{
|
||||
|
|
@ -351,8 +351,8 @@ static inline int sputc(int c, STREAM* s)
|
|||
}
|
||||
|
||||
/**
|
||||
* Writes a end of line.
|
||||
* Returns 0 on success or -1 on error.
|
||||
* Write a end of line.
|
||||
* Return 0 on success or -1 on error.
|
||||
*/
|
||||
static inline int sputeol(STREAM* s)
|
||||
{
|
||||
|
|
@ -365,7 +365,7 @@ static inline int sputeol(STREAM* s)
|
|||
|
||||
/**
|
||||
* Write a sized string.
|
||||
* Returns 0 on success or -1 on error.
|
||||
* Return 0 on success or -1 on error.
|
||||
*/
|
||||
int swrite(const void* data, unsigned size, STREAM* f);
|
||||
|
||||
|
|
@ -373,26 +373,26 @@ int swrite(const void* data, unsigned size, STREAM* f);
|
|||
/* binary put */
|
||||
|
||||
/**
|
||||
* Writes a binary 32 bit number in packed format.
|
||||
* Returns 0 on success or -1 on error.
|
||||
* Write a binary 32 bit number in packed format.
|
||||
* Return 0 on success or -1 on error.
|
||||
*/
|
||||
int sputb32(uint32_t value, STREAM* s);
|
||||
|
||||
/**
|
||||
* Writes a binary 64 bit number in packed format.
|
||||
* Returns 0 on success or -1 on error.
|
||||
* Write a binary 64 bit number in packed format.
|
||||
* Return 0 on success or -1 on error.
|
||||
*/
|
||||
int sputb64(uint64_t value, STREAM* s);
|
||||
|
||||
/**
|
||||
* Writes a binary 32 bit number in little endian format.
|
||||
* Returns 0 on success or -1 on error.
|
||||
* Write a binary 32 bit number in little endian format.
|
||||
* Return 0 on success or -1 on error.
|
||||
*/
|
||||
int sputble32(uint32_t value, STREAM* s);
|
||||
|
||||
/**
|
||||
* Writes a binary string.
|
||||
* Returns 0 on success or -1 on error.
|
||||
* Write a binary string.
|
||||
* Return 0 on success or -1 on error.
|
||||
*/
|
||||
int sputbs(const char* str, STREAM* s);
|
||||
|
||||
|
|
|
|||
|
|
@ -732,9 +732,9 @@ char* strdup_nofail(const char* str)
|
|||
/* smartctl */
|
||||
|
||||
/**
|
||||
* Matches a string with the specified pattern.
|
||||
* Match a string with the specified pattern.
|
||||
* Like sscanf() a space match any sequence of spaces.
|
||||
* Returns 0 if it matches.
|
||||
* Return 0 if it matches.
|
||||
*/
|
||||
static int smatch(const char* str, const char* pattern)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -175,51 +175,51 @@ char* polish(char* s);
|
|||
/* path */
|
||||
|
||||
/**
|
||||
* Copies a path limiting the size.
|
||||
* Aborts if too long.
|
||||
* Copy a path limiting the size.
|
||||
* Abort if too long.
|
||||
*/
|
||||
void pathcpy(char* dst, size_t size, const char* src);
|
||||
|
||||
/**
|
||||
* Concatenates a path limiting the size.
|
||||
* Aborts if too long.
|
||||
* Concatenate a path limiting the size.
|
||||
* Abort if too long.
|
||||
*/
|
||||
void pathcat(char* dst, size_t size, const char* src);
|
||||
|
||||
/**
|
||||
* Concatenates a path limiting the size.
|
||||
* Aborts if too long.
|
||||
* Concatenate a path limiting the size.
|
||||
* Abort if too long.
|
||||
*/
|
||||
void pathcatc(char* dst, size_t size, char c);
|
||||
|
||||
/**
|
||||
* Imports a path limiting the size.
|
||||
* Import a path limiting the size.
|
||||
* In Windows all the backslash are converted to the C standard of forward slash.
|
||||
* Aborts if too long.
|
||||
* Abort if too long.
|
||||
*/
|
||||
void pathimport(char* dst, size_t size, const char* src);
|
||||
|
||||
/**
|
||||
* Exports a path limiting the size.
|
||||
* Export a path limiting the size.
|
||||
* In Windows all the C slashes are converted to the Windows backslash.
|
||||
* Aborts if too long.
|
||||
* Abort if too long.
|
||||
*/
|
||||
void pathexport(char* dst, size_t size, const char* src);
|
||||
|
||||
/**
|
||||
* Prints a path.
|
||||
* Aborts if too long.
|
||||
* Print a path.
|
||||
* Abort if too long.
|
||||
*/
|
||||
void pathprint(char* dst, size_t size, const char* format, ...) __attribute__((format(attribute_printf, 3, 4)));
|
||||
|
||||
/**
|
||||
* Ensures the presence of a terminating slash, if it isn't empty.
|
||||
* Aborts if too long.
|
||||
* Ensure the presence of a terminating slash, if it isn't empty.
|
||||
* Abort if too long.
|
||||
*/
|
||||
void pathslash(char* dst, size_t size);
|
||||
|
||||
/**
|
||||
* Cuts everything after the latest slash.
|
||||
* Cut everything after the latest slash.
|
||||
*/
|
||||
void pathcut(char* dst);
|
||||
|
||||
|
|
@ -233,13 +233,13 @@ int pathcmp(const char* a, const char* b);
|
|||
/* filesystem */
|
||||
|
||||
/**
|
||||
* Creates all the ancestor directories if missing.
|
||||
* Create all the ancestor directories if missing.
|
||||
* The file name, after the last /, is ignored.
|
||||
*/
|
||||
int mkancestor(const char* file);
|
||||
|
||||
/**
|
||||
* Changes the modification time of an open file.
|
||||
* Change the modification time of an open file.
|
||||
*/
|
||||
int fmtime(int f, int64_t mtime_sec, int mtime_nsec);
|
||||
|
||||
|
|
@ -278,8 +278,8 @@ void malloc_fail(size_t size);
|
|||
/* smartctl */
|
||||
|
||||
/**
|
||||
* Reads smartctl attributes from a stream.
|
||||
* Returns 0 on success.
|
||||
* Read smartctl attributes from a stream.
|
||||
* Return 0 on success.
|
||||
*/
|
||||
int smartctl_attribute(FILE* f, const char* file, const char* name, uint64_t* smart, char* serial);
|
||||
|
||||
|
|
|
|||
|
|
@ -972,7 +972,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
|
|||
if (!error_on_this_block && !io_error_on_this_block
|
||||
&& (!silent_error_on_this_block || fixed_error_on_this_block)
|
||||
) {
|
||||
/* updates the parity only if really needed */
|
||||
/* update the parity only if really needed */
|
||||
if (parity_needs_to_be_updated) {
|
||||
/* compute the parity */
|
||||
raid_gen(diskmax, state->level, state->block_size, buffer);
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ int devuuid(uint64_t device, char* uuid, size_t uuid_size)
|
|||
int filephy(const char* path, uint64_t size, uint64_t* physical)
|
||||
{
|
||||
#if HAVE_LINUX_FIEMAP_H
|
||||
/* In Linux gets the real physical address of the file */
|
||||
/* In Linux get the real physical address of the file */
|
||||
/* Note that FIEMAP doesn't require root permission */
|
||||
int f;
|
||||
struct {
|
||||
|
|
@ -327,7 +327,7 @@ int randomize(void* ptr, size_t size)
|
|||
|
||||
/**
|
||||
* Read a file extracting the contained device number in %u:%u format.
|
||||
* Returns 0 on error.
|
||||
* Return 0 on error.
|
||||
*/
|
||||
#if HAVE_LINUX_DEVICE
|
||||
static dev_t devread(const char* path)
|
||||
|
|
@ -620,7 +620,7 @@ static int devscan(tommy_list* list)
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Gets SMART attributes.
|
||||
* Get SMART attributes.
|
||||
*/
|
||||
static int devsmart(dev_t device, const char* name, const char* custom, uint64_t* smart, char* serial)
|
||||
{
|
||||
|
|
@ -769,7 +769,7 @@ static int devup(const char* mount)
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* removes the just created dir */
|
||||
/* remove the just created dir */
|
||||
rmdir(path);
|
||||
|
||||
return 0;
|
||||
|
|
@ -873,7 +873,7 @@ static int device_thread(tommy_list* list, void* (*func)(void* arg))
|
|||
tommy_node* i;
|
||||
|
||||
#if HAVE_PTHREAD_CREATE
|
||||
/* starts all threads */
|
||||
/* start all threads */
|
||||
for (i = tommy_list_head(list); i != 0; i = i->next) {
|
||||
devinfo_t* devinfo = i->data;
|
||||
|
||||
|
|
@ -885,7 +885,7 @@ static int device_thread(tommy_list* list, void* (*func)(void* arg))
|
|||
}
|
||||
}
|
||||
|
||||
/* joins all threads */
|
||||
/* join all threads */
|
||||
for (i = tommy_list_head(list); i != 0; i = i->next) {
|
||||
devinfo_t* devinfo = i->data;
|
||||
void* retval;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ void** malloc_nofail_vector_align(int nd, int n, size_t size, void** freeptr);
|
|||
void* malloc_nofail_test(size_t size);
|
||||
|
||||
/**
|
||||
* Tests the memory vector for RAM problems.
|
||||
* Test the memory vector for RAM problems.
|
||||
* If a problem is found, it crashes.
|
||||
*/
|
||||
void mtest_vector(int n, size_t size, void** vv);
|
||||
|
|
@ -69,7 +69,7 @@ extern int crc_x86;
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Computes CRC-32 (Castagnoli) for a single byte without IV.
|
||||
* Compute CRC-32 (Castagnoli) for a single byte without IV.
|
||||
*/
|
||||
static inline uint32_t crc32c_plain(uint32_t crc, unsigned char c)
|
||||
{
|
||||
|
|
@ -85,14 +85,14 @@ static inline uint32_t crc32c_plain(uint32_t crc, unsigned char c)
|
|||
}
|
||||
|
||||
/**
|
||||
* Computes the CRC-32 (Castagnoli)
|
||||
* Compute the CRC-32 (Castagnoli)
|
||||
*/
|
||||
uint32_t (*crc32c)(uint32_t crc, const unsigned char* ptr, unsigned size);
|
||||
uint32_t crc32c_gen(uint32_t crc, const unsigned char* ptr, unsigned size);
|
||||
uint32_t crc32c_x86(uint32_t crc, const unsigned char* ptr, unsigned size);
|
||||
|
||||
/**
|
||||
* Initializes the CRC-32 (Castagnoli) support.
|
||||
* Initialize the CRC-32 (Castagnoli) support.
|
||||
*/
|
||||
void crc32c_init(void);
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ void crc32c_init(void);
|
|||
#define HASH_SPOOKY2 2
|
||||
|
||||
/**
|
||||
* Computes the HASH of a memory block.
|
||||
* Compute the HASH of a memory block.
|
||||
* Seed is a 128 bit vector.
|
||||
*/
|
||||
void memhash(unsigned kind, const unsigned char* seed, void* digest, const void* src, size_t size);
|
||||
|
|
@ -132,14 +132,14 @@ unsigned memdiff(const unsigned char* data1, const unsigned char* data2, size_t
|
|||
/* lock */
|
||||
|
||||
/**
|
||||
* Creates and locks the lock file.
|
||||
* Returns -1 on error, otherwise it's the file handle to pass to lock_unlock().
|
||||
* Create and locks the lock file.
|
||||
* Return -1 on error, otherwise it's the file handle to pass to lock_unlock().
|
||||
*/
|
||||
int lock_lock(const char* file);
|
||||
|
||||
/**
|
||||
* Unlocks the lock file.
|
||||
* Returns -1 on error.
|
||||
* Unlock the lock file.
|
||||
* Return -1 on error.
|
||||
*/
|
||||
int lock_unlock(int f);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue