Ejemplo n.º 1
0
void handle_peek(struct cfw_message *msg)
{
	ll_storage_peek_req_msg_t * req = (ll_storage_peek_req_msg_t *) msg;
	ll_storage_peek_rsp_msg_t * resp =
		(ll_storage_peek_rsp_msg_t *) cfw_alloc_rsp_msg(msg,
		MSG_ID_LL_PEEK_RSP, sizeof(*resp));
	DRIVER_API_RC ret = DRV_RC_FAIL;
	int err;

	resp->buffer = balloc(req->size, NULL);
	err = cir_storage_peek((cir_storage_t *)req->storage, req->offset, resp->buffer, req->size);
	if (err == CBUFFER_STORAGE_SUCCESS) {
		ret = DRV_RC_OK;
	} else if (err == CBUFFER_STORAGE_EMPTY_ERROR) {
		ret = DRV_RC_OUT_OF_MEM;
	}

	resp->rsp_header.status = ret;
	cfw_send_message(resp);
}
Ejemplo n.º 2
0
void handle_peek(struct cfw_message *msg)
{
	circular_storage_peek_req_msg_t *req =
		(circular_storage_peek_req_msg_t *)msg;
	circular_storage_service_peek_rsp_msg_t *resp =
		(circular_storage_service_peek_rsp_msg_t *)cfw_alloc_rsp_msg(
			msg,
			MSG_ID_CIRCULAR_STORAGE_SERVICE_PEEK_RSP,
			sizeof(*resp));
	DRIVER_API_RC ret = DRV_RC_FAIL;
	int err;

	resp->buffer = balloc(((cir_storage_t *)req->storage)->elt_size, NULL);
	err = cir_storage_peek((cir_storage_t *)req->storage, resp->buffer);
	if (err == CBUFFER_STORAGE_SUCCESS) {
		ret = DRV_RC_OK;
	} else if (err == CBUFFER_STORAGE_EMPTY_ERROR) {
		ret = DRV_RC_OUT_OF_MEM;
	}

	resp->status = ret;
	cfw_send_message(resp);
}