Skip to content

Commit

Permalink
Apply changes requesteds by outscale-toa.
Browse files Browse the repository at this point in the history
  • Loading branch information
outscale-fne committed Nov 9, 2020
1 parent fce41b9 commit ae855eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/utils/qemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int pg_util_spawn_qemu(const char *socket_path_0,
pg_autofree char *ssh_cmd = NULL;
GError *error = NULL;

if(!is_client_1)
if (!is_client_1)
g_assert(g_file_test(socket_path_0, G_FILE_TEST_EXISTS));
if (socket_path_1 && !is_client_1)
g_assert(g_file_test(socket_path_1, G_FILE_TEST_EXISTS));
Expand Down
13 changes: 9 additions & 4 deletions src/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,13 @@ static struct pg_brick_config *vhost_config_new(const char *name,
return pg_brick_config_init(config, name, 1, 1, PG_MONOPOLE);
}

/* To know if a vhost brick is server or not. */
/* If the brick is server, return 0 else return 1. */
/**
* This function tell whether the targeted brick is
* acting as vhost server or not.
*
* @param brick the brick vhost brick targeted.
* @return 0 if acting as server else 1.
*/
static int pg_vhost_is_server(struct pg_brick *brick)
{
struct pg_vhost_state *state =
Expand Down Expand Up @@ -289,7 +294,7 @@ static void vhost_create_socket(struct pg_vhost_state *state, uint64_t flags,

path = g_strdup_printf("%s/qemu-%s", sockets_path, state->brick.name);
/* If the socket is CLIENT do NOT destroy the socket. */
if((flags & 1) == 0)
if (flags & 1 == 0)
g_remove(path);

printf("New vhost-user socket: %s, zero-copy %s\n", path,
Expand Down Expand Up @@ -366,7 +371,7 @@ static void vhost_destroy(struct pg_brick *brick, struct pg_error **errp)
pthread_mutex_lock(&mutex);

/* If the socket is client, do NOT destroy the existing socket. */
if(pg_vhost_is_server(brick) == 0)
if (pg_vhost_is_server(brick) == 0)
g_remove(state->socket->path);

LIST_REMOVE(state->socket, socket_list);
Expand Down

0 comments on commit ae855eb

Please sign in to comment.