Пример #1
0
static int do_ncp_rpc_call(struct ncp_server *server, int size,
		unsigned char* reply_buf, int max_reply_size)
{
	int result;
	struct ncp_request_reply *req;

	req = ncp_alloc_req();
	if (!req)
		return -ENOMEM;

	req->reply_buf = reply_buf;
	req->datalen = max_reply_size;
	req->tx_iov[1].iov_base = server->packet;
	req->tx_iov[1].iov_len = size;
	req->tx_iovlen = 1;
	req->tx_totallen = size;
	req->tx_type = *(u_int16_t*)server->packet;

	result = ncp_add_request(server, req);
	if (result < 0)
		goto out;

	if (wait_event_interruptible(req->wq, req->status == RQ_DONE)) {
		ncp_abort_request(server, req, -EINTR);
		result = -EINTR;
		goto out;
	}

	result = req->result;

out:
	ncp_req_put(req);

	return result;
}
Пример #2
0
static int do_ncp_rpc_call(struct ncp_server *server, int size,
                           struct ncp_reply_header* reply_buf, int max_reply_size)
{
    int result;
    struct ncp_request_reply req;

    ncp_init_req(&req);
    req.reply_buf = reply_buf;
    req.datalen = max_reply_size;
    req.tx_iov[1].iov_base = (void *) server->packet;
    req.tx_iov[1].iov_len = size;
    req.tx_iovlen = 1;
    req.tx_totallen = size;
    req.tx_type = *(u_int16_t*)server->packet;

    result = ncp_add_request(server, &req);
    if (result < 0) {
        return result;
    }
    if (wait_event_interruptible(req.wq, req.status == RQ_DONE)) {
        ncp_abort_request(server, &req, -EIO);
    }
    return req.result;
}