diff options
author | vkalintiris <vasilis@netdata.cloud> | 2021-03-10 10:37:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-10 10:37:47 +0200 |
commit | adec24dffa763654bfa8cfa9ae3bd53296c2c24f (patch) | |
tree | 63f5307373399ed797e2721fadfa2f83971a61b9 /spawn | |
parent | 86ca37683eac5ffd4172c5e62652409087791999 (diff) |
Rename struct avl to avl_element and the typedef to avl_t (#10735)
Before:
```
struct foobar {
avl avl;
...
}
```
After:
```
struct foobar {
avl_t avl;
...
};
```
Which makes figuring out the type from field name easier.
Diffstat (limited to 'spawn')
-rw-r--r-- | spawn/spawn.c | 14 | ||||
-rw-r--r-- | spawn/spawn.h | 2 | ||||
-rw-r--r-- | spawn/spawn_server.c | 12 |
3 files changed, 14 insertions, 14 deletions
diff --git a/spawn/spawn.c b/spawn/spawn.c index 256c046790..017ba7f393 100644 --- a/spawn/spawn.c +++ b/spawn/spawn.c @@ -62,7 +62,7 @@ uint64_t spawn_enq_cmd(char *command_to_run) { unsigned queue_size; uint64_t serial; - avl *avl_ret; + avl_t *avl_ret; struct spawn_cmd_info *cmdinfo; cmdinfo = create_spawn_cmd(command_to_run); @@ -79,8 +79,8 @@ uint64_t spawn_enq_cmd(char *command_to_run) cmdinfo->serial = serial; /* No need to take the cmd mutex since it is unreachable at the moment */ /* enqueue command */ - avl_ret = avl_insert(&spawn_cmd_queue.cmd_tree, (avl *)cmdinfo); - fatal_assert(avl_ret == (avl *)cmdinfo); + avl_ret = avl_insert(&spawn_cmd_queue.cmd_tree, (avl_t *)cmdinfo); + fatal_assert(avl_ret == (avl_t *)cmdinfo); uv_mutex_unlock(&spawn_cmd_queue.mutex); /* wake up event loop */ @@ -93,13 +93,13 @@ uint64_t spawn_enq_cmd(char *command_to_run) */ void spawn_wait_cmd(uint64_t serial, int *exit_status, time_t *exec_run_timestamp) { - avl *avl_ret; + avl_t *avl_ret; struct spawn_cmd_info tmp, *cmdinfo; tmp.serial = serial; uv_mutex_lock(&spawn_cmd_queue.mutex); - avl_ret = avl_search(&spawn_cmd_queue.cmd_tree, (avl *)&tmp); + avl_ret = avl_search(&spawn_cmd_queue.cmd_tree, (avl_t *)&tmp); uv_mutex_unlock(&spawn_cmd_queue.mutex); fatal_assert(avl_ret); /* Could be NULL if more than 1 threads wait for the command */ @@ -122,13 +122,13 @@ void spawn_wait_cmd(uint64_t serial, int *exit_status, time_t *exec_run_timestam void spawn_deq_cmd(struct spawn_cmd_info *cmdinfo) { unsigned queue_size; - avl *avl_ret; + avl_t *avl_ret; uv_mutex_lock(&spawn_cmd_queue.mutex); queue_size = spawn_cmd_queue.size; fatal_assert(queue_size); /* dequeue command */ - avl_ret = avl_remove(&spawn_cmd_queue.cmd_tree, (avl *)cmdinfo); + avl_ret = avl_remove(&spawn_cmd_queue.cmd_tree, (avl_t *)cmdinfo); fatal_assert(avl_ret); spawn_cmd_queue.size = queue_size - 1; diff --git a/spawn/spawn.h b/spawn/spawn.h index 34b2632e03..6a44143389 100644 --- a/spawn/spawn.h +++ b/spawn/spawn.h @@ -42,7 +42,7 @@ struct spawn_prot_header { #define SPAWN_CMD_DONE 0x00000008 struct spawn_cmd_info { - avl avl; + avl_t avl; /* concurrency control per command */ uv_mutex_t mutex; diff --git a/spawn/spawn_server.c b/spawn/spawn_server.c index f84fab1caa..57bcdf99a3 100644 --- a/spawn/spawn_server.c +++ b/spawn/spawn_server.c @@ -16,7 +16,7 @@ static char prot_buffer[MAX_COMMAND_LENGTH]; static unsigned prot_buffer_len = 0; struct spawn_execution_info { - avl avl; + avl_t avl; void *handle; int exit_status; @@ -106,7 +106,7 @@ static void wait_children(void *arg) { siginfo_t i; struct spawn_execution_info tmp, *exec_info; - avl *ret_avl; + avl_t *ret_avl; (void)arg; while (!server_shutdown) { @@ -133,7 +133,7 @@ static void wait_children(void *arg) #endif fatal_assert(CLD_EXITED == i.si_code); tmp.pid = (pid_t)i.si_pid; - while (NULL == (ret_avl = avl_remove_lock(&spawn_outstanding_exec_tree, (avl *)&tmp))) { + while (NULL == (ret_avl = avl_remove_lock(&spawn_outstanding_exec_tree, (avl_t *)&tmp))) { fprintf(stderr, "SPAWN: race condition detected, waiting for child process %d to be indexed.\n", (int)tmp.pid); @@ -153,7 +153,7 @@ void spawn_protocol_execute_command(void *handle, char *command_to_run, uint16_t { uv_buf_t writebuf[2]; int ret; - avl *avl_ret; + avl_t *avl_ret; struct spawn_execution_info *exec_info; struct write_context *write_ctx; @@ -174,8 +174,8 @@ void spawn_protocol_execute_command(void *handle, char *command_to_run, uint16_t exec_info = mallocz(sizeof(*exec_info)); exec_info->handle = handle; exec_info->pid = write_ctx->spawn_result.exec_pid; - avl_ret = avl_insert_lock(&spawn_outstanding_exec_tree, (avl *)exec_info); - fatal_assert(avl_ret == (avl *)exec_info); + avl_ret = avl_insert_lock(&spawn_outstanding_exec_tree, (avl_t *)exec_info); + fatal_assert(avl_ret == (avl_t *)exec_info); /* wake up the thread that blocks waiting for processes to exit */ uv_mutex_lock(&wait_children_mutex); |