From 5f98d369fad9b8769282a345385f77e8b0026bc2 Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Wed, 6 Mar 2024 20:15:40 -0500 Subject: [PATCH] Prefix libguestfs-inspect functions with guestfs_inspect_. The functions are also made non-static. This is in preparation to moving the header function implementations to a .c file. --- guestfs-inspect.c | 6 +++--- guestfs-inspectd.c | 6 +++--- libguestfs-inspect.h | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/guestfs-inspect.c b/guestfs-inspect.c index 7ca0c55..6bbeb66 100644 --- a/guestfs-inspect.c +++ b/guestfs-inspect.c @@ -16,7 +16,7 @@ int main(int argc, char **argv) { return EXIT_SUCCESS; } - char *ep = endpoint(); + char *ep = guestfs_inspect_endpoint(); zsock_t *daemon = zsock_new_req(ep); free(ep); @@ -40,7 +40,7 @@ int main(int argc, char **argv) { break; } - zmsg_t *msg = command_to_zmsg(command); + zmsg_t *msg = guestfs_inspect_command_to_zmsg(command); zmsg_send(&msg, daemon); zmsg_t *rep = zmsg_recv(daemon); @@ -62,7 +62,7 @@ int main(int argc, char **argv) { zmsg_destroy(&msg); zmsg_destroy(&rep); zsock_destroy(&daemon); - command_destroy(&command); + guestfs_inspect_command_destroy(&command); return EXIT_SUCCESS; } diff --git a/guestfs-inspectd.c b/guestfs-inspectd.c index aca4b16..638591e 100644 --- a/guestfs-inspectd.c +++ b/guestfs-inspectd.c @@ -106,7 +106,7 @@ static void *worker_task(zsock_t *pipe, char *disk_path) { printf("Received a message in the worker\n"); printf("Size: %zu\tContent size: %zu\n", zmsg_size(msg), zmsg_content_size(msg)); - struct guestfs_inpsect_command *command = zmsg_to_command(msg); + struct guestfs_inpsect_command *command = guestfs_inspect_zmsg_to_command(msg); printf("Size OF:: %zu\n", (sizeof(struct guestfs_inpsect_command))); zmsg_t *reply = zmsg_new(); if (!reply) { @@ -132,7 +132,7 @@ static void *worker_task(zsock_t *pipe, char *disk_path) { // Sending reply zmsg_send(&reply, pipe); - command_destroy(&command); + guestfs_inspect_command_destroy(&command); zmsg_destroy(&msg); zmsg_destroy(&reply); } @@ -151,7 +151,7 @@ int main(int argc, char **argv) { char *name = strtok(NULL, ":"); printf("name: '%s'\n", name); - char *ep = endpoint(); + char *ep = guestfs_inspect_endpoint(); printf("ep: %s\n", ep); zsock_t *worker = zsock_new_rep(ep); free(ep); diff --git a/libguestfs-inspect.h b/libguestfs-inspect.h index d052c27..d9cb4b7 100644 --- a/libguestfs-inspect.h +++ b/libguestfs-inspect.h @@ -28,7 +28,7 @@ struct guestfs_inpsect_command { } args; }; -static char *endpoint() { +char *guestfs_inspect_endpoint() { const char *guestfs_inspect_endpoint = getenv("GUESTFS_INSPECT_ENDPOINT"); const char *socket_file_name = "/guestfs-inspect.sock"; char *res = NULL; @@ -53,7 +53,7 @@ static char *endpoint() { return res; } -static zmsg_t *command_to_zmsg(struct guestfs_inpsect_command *command) { +zmsg_t *guestfs_inspect_command_to_zmsg(struct guestfs_inpsect_command *command) { zmsg_t *res = zmsg_new(); zmsg_addstr(res, command->name); @@ -79,7 +79,7 @@ static zmsg_t *command_to_zmsg(struct guestfs_inpsect_command *command) { return res; } -static struct guestfs_inpsect_command *zmsg_to_command(zmsg_t *msg) { +struct guestfs_inpsect_command *guestfs_inspect_zmsg_to_command(zmsg_t *msg) { struct guestfs_inpsect_command *res = malloc(sizeof(struct guestfs_inpsect_command)); res->name = zmsg_popstr(msg); @@ -114,7 +114,7 @@ static struct guestfs_inpsect_command *zmsg_to_command(zmsg_t *msg) { return res; } -static void command_destroy(struct guestfs_inpsect_command **c) { +void guestfs_inspect_command_destroy(struct guestfs_inpsect_command **c) { free((*c)->name); switch ((*c)->command) { case GUESTFS_COMMAND_LS: