Compare commits

..

No commits in common. "836480951e9fe25bbcff8ff4c0758e6ded3d697d" and "73b8ee9d2989fae97ed464b63d190c2df95efae3" have entirely different histories.

3 changed files with 19 additions and 33 deletions

View file

@ -2989,12 +2989,14 @@ static int devup(uint64_t device, const char* name, const char* wfile)
if (!CloseHandle(h)) {
DWORD error = GetLastError();
CloseHandle(h);
VirtualFree(buffer, 0, MEM_RELEASE);
windows_errno(error);
log_tag("device:%s:%s:error:%lu\n", file, name, error);
return -1;
}
CloseHandle(h);
VirtualFree(buffer, 0, MEM_RELEASE);
log_tag("attr:%s:%s:power:up\n", file, name);
@ -3344,21 +3346,17 @@ int windows_key_create(windows_key_t* key, void (*destructor)(void*))
return 0;
}
int windows_key_delete(windows_key_t void_key)
int windows_key_delete(windows_key_t key)
{
struct windows_key_context* key = void_key;
struct windows_key_context* context = key;
/* use the destructor for the local variable and remove from the list of destructors */
if (key->func) {
void* value = windows_getspecific(key);
if (value)
key->func(value);
tommy_list_remove_existing(&windows_key_list, &key->node);
}
/* remove from the list of destructors */
if (context->func)
tommy_list_remove_existing(&windows_key_list, &context->node);
TlsFree(key->key);
TlsFree(context->key);
free(key);
free(context);
return 0;
}

View file

@ -310,7 +310,9 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
}
}
/* skip data disks that are not accessible */
if (disk->skip_access)
continue;
if (!state->opt.skip_parity_access) {
for (l = 0; l < state->level; ++l) {
@ -722,9 +724,10 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
pathimport(device, sizeof(device), split_map[s]);
slash = strrchr(device, '/');
if (slash)
slash[1] = 0;
*slash = 0;
else
pathcpy(device, sizeof(device), ".");
if (stat(device, &st) == 0) {
dev = st.st_dev;
@ -874,7 +877,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
pathimport(device, sizeof(device), buffer);
slash = strrchr(device, '/');
if (slash)
slash[1] = 0;
*(slash + 1) = 0;
else
pathcpy(device, sizeof(device), ".");
if (stat(device, &st) == 0) {
@ -1799,9 +1802,6 @@ void state_refresh(struct snapraid_state* state)
/* LCOV_EXCL_STOP */
}
if (disk->skip_access)
continue;
ret = fsinfo(disk->dir, 0, 0, &total_space, &free_space, disk->fstype, sizeof(disk->fstype), disk->fslabel, sizeof(disk->fslabel));
if (ret != 0) {
/* LCOV_EXCL_START */
@ -1828,9 +1828,6 @@ void state_refresh(struct snapraid_state* state)
state->parity[l].total_blocks = 0;
state->parity[l].free_blocks = 0;
if (state->parity[l].skip_access)
continue;
for (s = 0; s < state->parity[l].split_mac; ++s) {
struct snapraid_split* split = &state->parity[l].split_map[s];
uint64_t total_space;
@ -3087,14 +3084,6 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
if (v_split_mac > SPLIT_MAX) {
/* LCOV_EXCL_START */
decoding_error(path, f);
log_fatal(ECONTENT, "Too many splits '%u' in the content file!\n", v_split_mac);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (v_level >= LEV_MAX) {
/* LCOV_EXCL_START */
decoding_error(path, f);
@ -4548,9 +4537,9 @@ static void state_rename_content(struct snapraid_state* state)
pathcpy(dir, sizeof(dir), content->content);
slash = strrchr(dir, '/');
slash = strrchr(tmp, '/');
if (slash)
slash[1] = 0;
*slash = 0;
else
pathcpy(dir, sizeof(dir), ".");
@ -5255,7 +5244,7 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
str_cpu[0] = 0;
}
if (out_temperature) {
snprintf(str_temp, sizeof(str_temp), "%u", out_temperature);
snprintf(str_temp, sizeof(str_eta), "%u", out_temperature);
} else {
str_temp[0] = 0;
}

View file

@ -2101,8 +2101,7 @@ static int devup(dev_t device, const char* name)
}
/* select a random offset */
uint64_t blocks = size / 4096;
offset = blocks > 0 ? (random_u64() % blocks) * 4096 : 0;
offset = (random_u64() % (size / 4096)) * 4096;
#if HAVE_POSIX_FADVISE
/* clear cache */