infra: extend cmds with 2 strings

This commit is contained in:
Thomas Schoebel-Theuer 2020-07-17 09:40:34 +02:00 committed by Thomas Schoebel-Theuer
parent 8946873739
commit 8d9ac84b46
7 changed files with 12 additions and 6 deletions

View File

@ -673,6 +673,7 @@ int receiver_thread(void *data)
}
done:
brick_string_free(cmd.cmd_str1);
brick_string_free(cmd.cmd_str2);
if (unlikely(status < 0)) {
if (!ch->recv_error) {
MARS_DBG("signalling recv_error = %d\n", status);

View File

@ -1194,6 +1194,7 @@ const struct meta mars_cmd_meta[] = {
META_INI(cmd_compr_len, struct mars_cmd, FIELD_INT),
META_INI(cmd_int1, struct mars_cmd, FIELD_INT),
META_INI(cmd_str1, struct mars_cmd, FIELD_STRING),
META_INI(cmd_str2, struct mars_cmd, FIELD_STRING),
{}
};

View File

@ -131,8 +131,8 @@ struct mars_cmd {
int cmd_int1;
//int cmd_int2;
//int cmd_int3;
char *cmd_str1;
//char *cmd_str2;
const char *cmd_str1;
const char *cmd_str2;
//char *cmd_str3;
};

View File

@ -479,7 +479,7 @@ int handler_thread(void *data)
}
case CMD_GETENTS:
{
char *path = cmd.cmd_str1 ? cmd.cmd_str1 : "/mars";
const char *path = cmd.cmd_str1 ? cmd.cmd_str1 : "/mars";
int max_retry = dent_retry;
while (down_trylock(&dent_limit_sem)) {
@ -593,6 +593,7 @@ int handler_thread(void *data)
up(&handler_limit_sem);
clean:
brick_string_free(cmd.cmd_str1);
brick_string_free(cmd.cmd_str2);
if (unlikely(status < 0)) {
mars_shutdown_socket(sock);
brick_msleep(1000);

View File

@ -2516,6 +2516,7 @@ int peer_actions(struct mars_global *tmp_global,
done:
brick_string_free(inter_cmd.cmd_str1);
brick_string_free(inter_cmd.cmd_str2);
return status;
}
@ -2679,6 +2680,7 @@ int peer_thread(void *data)
}
brick_string_free(cmd.cmd_str1);
brick_string_free(cmd.cmd_str2);
brick_msleep(100);
if (!peer->to_terminate && !brick_thread_should_stop()) {
bool old_additional = peer->do_additional;
@ -2705,6 +2707,7 @@ int peer_thread(void *data)
free_and_restart:
brick_string_free(cmd.cmd_str1);
brick_string_free(cmd.cmd_str2);
/* additional threads should give up immediately */
if (peer->do_additional && !peer->do_communicate)
break;

View File

@ -159,7 +159,7 @@ extern int mars_dent_work(struct mars_global *global,
int maxdepth,
bool use_subtree);
extern int mars_get_dent_list(struct mars_global *global,
char *path_list,
const char *path_list,
int allocsize,
mars_dent_checker_fn checker,
int maxdepth);

View File

@ -1745,7 +1745,7 @@ const char *subtree_prefix(const char *path)
static
int _op_scan(struct say_channel **say_channel,
struct mars_global *global,
char *path_list,
const char *path_list,
int allocsize,
mars_dent_checker_fn checker,
int maxdepth,
@ -1951,7 +1951,7 @@ void _op_remove(struct say_channel **say_channel,
/* Stripped-down version for peer metadata exchange
*/
int mars_get_dent_list(struct mars_global *global,
char *path_list,
const char *path_list,
int allocsize,
mars_dent_checker_fn checker,
int maxdepth)