Keep log verify retries portable across C feature sets
This commit is contained in:
parent
8b2979e11d
commit
6ab25361be
|
|
@ -8,15 +8,13 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
enum {
|
||||
AMDUAT_ASL_LOG_MAGIC_LEN = 8,
|
||||
AMDUAT_ASL_LOG_VERSION = 1,
|
||||
AMDUAT_ASL_LOG_CHUNK_MAX_ENTRIES = 1024u,
|
||||
AMDUAT_ASL_LOG_MAX_RETRIES = 8u,
|
||||
AMDUAT_ASL_LOG_VERIFY_MAX_RETRIES = 6u,
|
||||
AMDUAT_ASL_LOG_VERIFY_RETRY_US = 2000u
|
||||
AMDUAT_ASL_LOG_VERIFY_MAX_RETRIES = 6u
|
||||
};
|
||||
|
||||
static const uint8_t k_amduat_asl_log_magic[AMDUAT_ASL_LOG_MAGIC_LEN] = {
|
||||
|
|
@ -109,13 +107,6 @@ static bool amduat_asl_log_add_size(size_t *acc, size_t add) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static void amduat_asl_log_retry_sleep_us(uint32_t delay_us) {
|
||||
struct timespec ts;
|
||||
ts.tv_sec = (time_t)(delay_us / 1000000u);
|
||||
ts.tv_nsec = (long)((delay_us % 1000000u) * 1000u);
|
||||
(void)nanosleep(&ts, NULL);
|
||||
}
|
||||
|
||||
void amduat_asl_log_chunk_free(amduat_asl_log_chunk_t *chunk) {
|
||||
if (chunk == NULL) {
|
||||
return;
|
||||
|
|
@ -679,7 +670,6 @@ amduat_asl_store_error_t amduat_asl_log_append(
|
|||
verify_attempt + 1u >= AMDUAT_ASL_LOG_VERIFY_MAX_RETRIES) {
|
||||
break;
|
||||
}
|
||||
amduat_asl_log_retry_sleep_us(AMDUAT_ASL_LOG_VERIFY_RETRY_US);
|
||||
verify_attempt++;
|
||||
}
|
||||
if (verify_err != AMDUAT_ASL_STORE_OK) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue