Merge branch 'dev' of https://git.robbyzambito.me/robby/guestfs-inspect into dev
This commit is contained in:
@@ -11,19 +11,9 @@
|
||||
|
||||
static void *worker_task(zsock_t*, char*);
|
||||
|
||||
char *endpoint(void);
|
||||
|
||||
static int compare_key_len(const void*, const void*);
|
||||
static int count_mountpoints(char *const *argv);
|
||||
|
||||
char *endpoint() {
|
||||
// TODO: This should be based on GUESTFS_INSPECT_ENDPOINT, or XDG_RUNTIME_DIR if the former is not set, and default to a sensible path if neither are set.
|
||||
const char* ep = "ipc:///tmp/guestfs-inspect.sock";
|
||||
char *res = malloc(strlen(ep) + 1);
|
||||
strcpy(res, ep);
|
||||
return res;
|
||||
}
|
||||
|
||||
static int compare_key_len(const void *p1, const void *p2) {
|
||||
const char *key1 = *(char* const*) p1;
|
||||
const char *key2 = *(char* const*) p2;
|
||||
@@ -105,8 +95,8 @@ static void *worker_task(zsock_t *pipe, char *disk_path) {
|
||||
// ZeroMQ Opens here
|
||||
zsock_signal(pipe, 0);
|
||||
while (true) {
|
||||
zmsg_t *message = zmsg_recv(pipe);
|
||||
if (!message) {
|
||||
zmsg_t *msg = zmsg_recv(pipe);
|
||||
if (!msg) {
|
||||
break;
|
||||
}
|
||||
// Process message
|
||||
@@ -115,7 +105,7 @@ static void *worker_task(zsock_t *pipe, char *disk_path) {
|
||||
|
||||
// Sending reply
|
||||
zmsg_send(&msg, pipe);
|
||||
zmsg_destory(&msg);
|
||||
zmsg_destroy(&msg);
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -154,13 +144,18 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Find the worker with the given name.
|
||||
zactor_t *worker = NULL;
|
||||
struct guestfs_inpsect_command *cmd = (struct guestfs_inpsect_command *) zmsg_last(msg);
|
||||
for (int i = 0; i < worker_count; i++) {
|
||||
|
||||
if (STREQ(cmd->name, worker_map[i].name)) {
|
||||
worker = worker_map[i].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (worker) {
|
||||
zmsg_send(&msg, zactor_sock(worker));
|
||||
} else {
|
||||
// The name specified does not exist.
|
||||
printf("There is no drive with the name %s\n.", cmd->name);
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user