format
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
#define STREQ(a, b) (strcmp((a), (b)) == 0)
|
||||
|
||||
static void *worker_task(char*);
|
||||
static void *worker_task(zsock_t*, char*);
|
||||
|
||||
char *endpoint(void);
|
||||
|
||||
@@ -36,7 +36,7 @@ static int count_mountpoints(char *const *argv) {
|
||||
return c;
|
||||
}
|
||||
|
||||
static void *worker_task(char *disk_path) {
|
||||
static void *worker_task(zsock_t *pipe, char *disk_path) {
|
||||
guestfs_h *g;
|
||||
char **roots, **mountpoints;
|
||||
char *root;
|
||||
@@ -52,9 +52,7 @@ static void *worker_task(char *disk_path) {
|
||||
}
|
||||
|
||||
// Adding disk_path to connection handle
|
||||
if (guestfs_add_drive_opts(g, disk_path,
|
||||
GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
|
||||
-1) == -1) {
|
||||
if (guestfs_add_drive_opts(g, disk_path, GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, -1) == -1) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -88,8 +86,21 @@ static void *worker_task(char *disk_path) {
|
||||
}
|
||||
|
||||
// ZeroMQ Opens here
|
||||
for (;;) {
|
||||
zsock_signal(pipe, 0);
|
||||
while (true) {
|
||||
zmsg_t *message = zmsg_recv(pipe);
|
||||
if (message == NULL) {
|
||||
break;
|
||||
}
|
||||
// Process message
|
||||
|
||||
// do something here
|
||||
|
||||
// Sending reply
|
||||
zmsg_t *reply = zmsg_new();
|
||||
zmsg_addstr(reply, "Reply from worker");
|
||||
zmsg_send(&reply, pipe);
|
||||
zmsg_destroy(&message);
|
||||
}
|
||||
/*if (guestfs_is_file_opts(g, file_path, GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) {
|
||||
printf("--- %s ---\n", file_path);
|
||||
|
||||
Reference in New Issue
Block a user