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.
This commit is contained in:
@@ -16,7 +16,7 @@ int main(int argc, char **argv) {
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ep = endpoint();
|
char *ep = guestfs_inspect_endpoint();
|
||||||
zsock_t *daemon = zsock_new_req(ep);
|
zsock_t *daemon = zsock_new_req(ep);
|
||||||
free(ep);
|
free(ep);
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ int main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
zmsg_t *msg = command_to_zmsg(command);
|
zmsg_t *msg = guestfs_inspect_command_to_zmsg(command);
|
||||||
zmsg_send(&msg, daemon);
|
zmsg_send(&msg, daemon);
|
||||||
zmsg_t *rep = zmsg_recv(daemon);
|
zmsg_t *rep = zmsg_recv(daemon);
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ int main(int argc, char **argv) {
|
|||||||
zmsg_destroy(&msg);
|
zmsg_destroy(&msg);
|
||||||
zmsg_destroy(&rep);
|
zmsg_destroy(&rep);
|
||||||
zsock_destroy(&daemon);
|
zsock_destroy(&daemon);
|
||||||
command_destroy(&command);
|
guestfs_inspect_command_destroy(&command);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ static void *worker_task(zsock_t *pipe, char *disk_path) {
|
|||||||
printf("Received a message in the worker\n");
|
printf("Received a message in the worker\n");
|
||||||
|
|
||||||
printf("Size: %zu\tContent size: %zu\n", zmsg_size(msg), zmsg_content_size(msg));
|
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)));
|
printf("Size OF:: %zu\n", (sizeof(struct guestfs_inpsect_command)));
|
||||||
zmsg_t *reply = zmsg_new();
|
zmsg_t *reply = zmsg_new();
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
@@ -132,7 +132,7 @@ static void *worker_task(zsock_t *pipe, char *disk_path) {
|
|||||||
// Sending reply
|
// Sending reply
|
||||||
zmsg_send(&reply, pipe);
|
zmsg_send(&reply, pipe);
|
||||||
|
|
||||||
command_destroy(&command);
|
guestfs_inspect_command_destroy(&command);
|
||||||
zmsg_destroy(&msg);
|
zmsg_destroy(&msg);
|
||||||
zmsg_destroy(&reply);
|
zmsg_destroy(&reply);
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ int main(int argc, char **argv) {
|
|||||||
char *name = strtok(NULL, ":");
|
char *name = strtok(NULL, ":");
|
||||||
printf("name: '%s'\n", name);
|
printf("name: '%s'\n", name);
|
||||||
|
|
||||||
char *ep = endpoint();
|
char *ep = guestfs_inspect_endpoint();
|
||||||
printf("ep: %s\n", ep);
|
printf("ep: %s\n", ep);
|
||||||
zsock_t *worker = zsock_new_rep(ep);
|
zsock_t *worker = zsock_new_rep(ep);
|
||||||
free(ep);
|
free(ep);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ struct guestfs_inpsect_command {
|
|||||||
} args;
|
} args;
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *endpoint() {
|
char *guestfs_inspect_endpoint() {
|
||||||
const char *guestfs_inspect_endpoint = getenv("GUESTFS_INSPECT_ENDPOINT");
|
const char *guestfs_inspect_endpoint = getenv("GUESTFS_INSPECT_ENDPOINT");
|
||||||
const char *socket_file_name = "/guestfs-inspect.sock";
|
const char *socket_file_name = "/guestfs-inspect.sock";
|
||||||
char *res = NULL;
|
char *res = NULL;
|
||||||
@@ -53,7 +53,7 @@ static char *endpoint() {
|
|||||||
return res;
|
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_t *res = zmsg_new();
|
||||||
|
|
||||||
zmsg_addstr(res, command->name);
|
zmsg_addstr(res, command->name);
|
||||||
@@ -79,7 +79,7 @@ static zmsg_t *command_to_zmsg(struct guestfs_inpsect_command *command) {
|
|||||||
return res;
|
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));
|
struct guestfs_inpsect_command *res = malloc(sizeof(struct guestfs_inpsect_command));
|
||||||
|
|
||||||
res->name = zmsg_popstr(msg);
|
res->name = zmsg_popstr(msg);
|
||||||
@@ -114,7 +114,7 @@ static struct guestfs_inpsect_command *zmsg_to_command(zmsg_t *msg) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void command_destroy(struct guestfs_inpsect_command **c) {
|
void guestfs_inspect_command_destroy(struct guestfs_inpsect_command **c) {
|
||||||
free((*c)->name);
|
free((*c)->name);
|
||||||
switch ((*c)->command) {
|
switch ((*c)->command) {
|
||||||
case GUESTFS_COMMAND_LS:
|
case GUESTFS_COMMAND_LS:
|
||||||
|
|||||||
Reference in New Issue
Block a user