Example #1
0
File: nfs.c Project: AmesianX/panda
static void nfs_set_events(NFSClient *client)
{
    int ev = nfs_which_events(client->context);
    if (ev != client->events) {
        aio_set_fd_handler(client->aio_context, nfs_get_fd(client->context),
                           false,
                           (ev & POLLIN) ? nfs_process_read : NULL,
                           (ev & POLLOUT) ? nfs_process_write : NULL, client);

    }
    client->events = ev;
}
Example #2
0
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;
		}
	}
}
Example #3
0
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;
        }
    }
}