Skip to content

Commit

Permalink
fix style.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloud User committed Aug 6, 2020
1 parent 39bd5d0 commit 069c7d0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
33 changes: 19 additions & 14 deletions src/utils/qemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,28 @@ int pg_util_ssh(const char *host,
}

int pg_util_spawn_qemu(const char *socket_path_0,
const char *socket_path_1,
const char *mac_0,
const char *mac_1,
const char *socket_path_1,
const char *mac_0,
const char *mac_1,
const int is_server_0,
const int is_server_1,
const char *vm_image_path,
const char *vm_key_path,
const char *hugepages_path,
struct pg_error **errp)
const char *vm_image_path,
const char *vm_key_path,
const char *hugepages_path,
struct pg_error **errp)
{
int child_pid = 0;
static uint16_t vm_id;
char **argv = NULL;
pg_autofree char *argv_qemu = NULL;
const char *argv_sock_0 = "";
const char *argv_sock_1 = "";
const char* server_params = ",server,nowait";
const char *server_params = ",server,nowait";
pg_autofree char *argv_sock_0_t = NULL;
pg_autofree char *argv_sock_1_t = NULL;
pg_autofree char *ssh_cmd = NULL;
GError *error = NULL;

if(!is_server_1)
g_assert(g_file_test(socket_path_0, G_FILE_TEST_EXISTS));
if (socket_path_1 && !is_server_1)
Expand All @@ -102,7 +103,9 @@ int pg_util_spawn_qemu(const char *socket_path_0,
" -netdev type=vhost-user,id=mynet0,",
"chardev=char0,vhostforce",
" -device virtio-net-pci,mac=%s",
",netdev=mynet0"), socket_path_0, is_server_0 ? server_params : "", mac_0);
",netdev=mynet0"), socket_path_0,
is_server_0 ? server_params : "",
mac_0);
argv_sock_0 = argv_sock_0_t;
}

Expand All @@ -112,7 +115,9 @@ int pg_util_spawn_qemu(const char *socket_path_0,
" -netdev type=vhost-user,id=mynet1,",
"chardev=char1,vhostforce",
" -device virtio-net-pci,mac=%s",
",netdev=mynet1"), socket_path_1, is_server_0 ? server_params : "", mac_1);
",netdev=mynet1"), socket_path_1,
is_server_0 ? server_params : "",
mac_1);
argv_sock_1 = argv_sock_1_t;
}

Expand All @@ -136,10 +141,10 @@ int pg_util_spawn_qemu(const char *socket_path_0,
argv = g_strsplit(argv_qemu, " ", 0);

g_assert(g_spawn_async(NULL, argv, NULL,
(GSpawnFlags) G_SPAWN_SEARCH_PATH |
G_SPAWN_DO_NOT_REAP_CHILD,
(GSpawnChildSetupFunc) NULL,
NULL, &child_pid, &error));
(GSpawnFlags) G_SPAWN_SEARCH_PATH |
G_SPAWN_DO_NOT_REAP_CHILD,
(GSpawnChildSetupFunc) NULL,
NULL, &child_pid, &error));
g_assert(!error);

ssh_cmd = g_strdup_printf(
Expand Down
14 changes: 7 additions & 7 deletions src/utils/qemu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ int pg_util_ssh(const char *host,
__attribute__((__format__(__printf__, 4, 5)));

int pg_util_spawn_qemu(const char *socket_path_0,
const char *socket_path_1,
const char *mac_0,
const char *mac_1,
const char *socket_path_1,
const char *mac_0,
const char *mac_1,
const int is_server_0,
const int is_server_1,
const char *vm_image_path,
const char *vm_ssh_key_path,
const char *hugepages_path,
struct pg_error **errp);
const char *vm_image_path,
const char *vm_ssh_key_path,
const char *hugepages_path,
struct pg_error **errp);

void pg_util_stop_qemu(int qemu_pid, int signal);

Expand Down
8 changes: 1 addition & 7 deletions src/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,8 @@ 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)
{
g_remove(path);
}
/*else
{
flags = flags | 31;
}
*/

printf("New vhost-user socket: %s, zero-copy %s\n", path,
(flags & RTE_VHOST_USER_DEQUEUE_ZERO_COPY) ?
"enable" : "disable");
Expand Down

0 comments on commit 069c7d0

Please sign in to comment.