Beispiel #1
0
Datei: io.c Projekt: CPFL/gxen
int libxenvchan_buffer_space(struct libxenvchan *ctrl)
{
	/* Since this value is being used outside libxenvchan, request notification
	 * when it changes
	 */
	request_notify(ctrl, VCHAN_NOTIFY_READ);
	return wr_ring_size(ctrl) - (wr_prod(ctrl) - wr_cons(ctrl));
}
Beispiel #2
0
Datei: io.c Projekt: CPFL/gxen
int libxenvchan_data_ready(struct libxenvchan *ctrl)
{
	/* Since this value is being used outside libxenvchan, request notification
	 * when it changes
	 */
	request_notify(ctrl, VCHAN_NOTIFY_WRITE);
	return rd_prod(ctrl) - rd_cons(ctrl);
}
Beispiel #3
0
int libxenvchan_buffer_space(struct libxenvchan *ctrl)
{
	/* Since this value is being used outside libxenvchan, request notification
	 * when it changes
	 */
	request_notify(ctrl, VCHAN_NOTIFY_READ);
	return raw_get_buffer_space(ctrl);
}
Beispiel #4
0
Datei: io.c Projekt: CPFL/gxen
/**
 * Get the amount of buffer space available and enable notifications if needed.
 */
static inline int fast_get_buffer_space(struct libxenvchan *ctrl, size_t request)
{
	int ready = wr_ring_size(ctrl) - (wr_prod(ctrl) - wr_cons(ctrl));
	if (ready >= request)
		return ready;
	/* We plan to fill the buffer; please tell us when you've read it */
	request_notify(ctrl, VCHAN_NOTIFY_READ);
	/*
	 * If the reader moved wr_cons after our read but before request, we
	 * will not get notified even though the actual amount of buffer space
	 * is above request. Reread wr_cons to cover this case.
	 */
	return wr_ring_size(ctrl) - (wr_prod(ctrl) - wr_cons(ctrl));
}
Beispiel #5
0
Datei: io.c Projekt: CPFL/gxen
/**
 * Get the amount of buffer space available and enable notifications if needed.
 */
static inline int fast_get_data_ready(struct libxenvchan *ctrl, size_t request)
{
	int ready = rd_prod(ctrl) - rd_cons(ctrl);
	if (ready >= request)
		return ready;
	/* We plan to consume all data; please tell us if you send more */
	request_notify(ctrl, VCHAN_NOTIFY_WRITE);
	/*
	 * If the writer moved rd_prod after our read but before request, we
	 * will not get notified even though the actual amount of data ready is
	 * above request. Reread rd_prod to cover this case.
	 */
	return rd_prod(ctrl) - rd_cons(ctrl);
}