static void wait_for_nfs_reply(struct nfs_context *nfs, struct sync_cb_data *cb_data) { struct pollfd pfd; while (!cb_data->is_finished) { pfd.fd = nfs_get_fd(nfs); pfd.events = nfs_which_events(nfs); if (poll(&pfd, 1, -1) < 0) { nfs_set_error(nfs, "Poll failed"); cb_data->status = -EIO; break; } if (nfs_service(nfs, pfd.revents) < 0) { nfs_set_error(nfs, "nfs_service failed"); cb_data->status = -EIO; break; } } }
static void wait_for_reply(struct nfs_context *nfs, struct sync_cb_data *cb_data) { struct pollfd pfd; for (;;) { if (cb_data->is_finished) { break; } pfd.fd = nfs_get_fd(nfs); pfd.events = nfs_which_events(nfs); if (poll(&pfd, 1, -1) < 0) { printf("Poll failed"); cb_data->status = -EIO; break; } if (nfs_service(nfs, pfd.revents) < 0) { printf("nfs_service failed\n"); cb_data->status = -EIO; break; } } }
static void nfs_process_write(void *arg) { NFSClient *client = arg; nfs_service(client->context, POLLOUT); nfs_set_events(client); }
static void nfs_process_read(void *arg) { NFSClient *client = arg; nfs_service(client->context, POLLIN); nfs_set_events(client); }