/* Return a pointer to, and the length of, the contiguous data available to read from a ring buffer. */
STATIC CONST VOID* XenStoreGetInputChunk(IN XENSTORE_RING_IDX Cons, IN XENSTORE_RING_IDX Prod, IN CONST CHAR8 *Buffer, OUT UINT32 *LenPtr)
/* Return a pointer to, and the length of, the contiguous data available to read from a ring buffer. */
STATIC CONST VOID* XenStoreGetInputChunk(IN XENSTORE_RING_IDX Cons, IN XENSTORE_RING_IDX Prod, IN CONST CHAR8 *Buffer, OUT UINT32 *LenPtr)
{
  UINT32  Len;
  Len = XENSTORE_RING_SIZE - MASK_XENSTORE_IDX (Cons);
  if ((Prod - Cons) < Len) {
    Len = Prod - Cons;
  }
  *LenPtr = Len;
  return (Buffer + MASK_XENSTORE_IDX (Cons));
}