提交 65b9cd67 编写于 作者: M Michal Privoznik

Implement virStreamRecvFlags to some drivers

There are three virStreamDriver's currently supported:

 * virFDStream
 * remote driver
 * ESX driver

For now, backend virStreamRecvFlags support for only remote driver and
ESX driver is sufficient. Future patches will update virFDStream.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 a35e2836
...@@ -252,12 +252,17 @@ esxStreamSend(virStreamPtr stream, const char *data, size_t nbytes) ...@@ -252,12 +252,17 @@ esxStreamSend(virStreamPtr stream, const char *data, size_t nbytes)
} }
static int static int
esxStreamRecv(virStreamPtr stream, char *data, size_t nbytes) esxStreamRecvFlags(virStreamPtr stream,
char *data,
size_t nbytes,
unsigned int flags)
{ {
int result = -1; int result = -1;
esxStreamPrivate *priv = stream->privateData; esxStreamPrivate *priv = stream->privateData;
int status; int status;
virCheckFlags(0, -1);
if (nbytes == 0) if (nbytes == 0)
return 0; return 0;
...@@ -317,6 +322,14 @@ esxStreamRecv(virStreamPtr stream, char *data, size_t nbytes) ...@@ -317,6 +322,14 @@ esxStreamRecv(virStreamPtr stream, char *data, size_t nbytes)
return result; return result;
} }
static int
esxStreamRecv(virStreamPtr stream,
char *data,
size_t nbytes)
{
return esxStreamRecvFlags(stream, data, nbytes, 0);
}
static void static void
esxFreeStreamPrivate(esxStreamPrivate **priv) esxFreeStreamPrivate(esxStreamPrivate **priv)
{ {
...@@ -369,6 +382,7 @@ esxStreamAbort(virStreamPtr stream) ...@@ -369,6 +382,7 @@ esxStreamAbort(virStreamPtr stream)
virStreamDriver esxStreamDriver = { virStreamDriver esxStreamDriver = {
.streamSend = esxStreamSend, .streamSend = esxStreamSend,
.streamRecv = esxStreamRecv, .streamRecv = esxStreamRecv,
.streamRecvFlags = esxStreamRecvFlags,
/* FIXME: streamAddCallback missing */ /* FIXME: streamAddCallback missing */
/* FIXME: streamUpdateCallback missing */ /* FIXME: streamUpdateCallback missing */
/* FIXME: streamRemoveCallback missing */ /* FIXME: streamRemoveCallback missing */
......
...@@ -5641,15 +5641,19 @@ remoteStreamSend(virStreamPtr st, ...@@ -5641,15 +5641,19 @@ remoteStreamSend(virStreamPtr st,
static int static int
remoteStreamRecv(virStreamPtr st, remoteStreamRecvFlags(virStreamPtr st,
char *data, char *data,
size_t nbytes) size_t nbytes,
unsigned int flags)
{ {
VIR_DEBUG("st=%p data=%p nbytes=%zu", st, data, nbytes); VIR_DEBUG("st=%p data=%p nbytes=%zu flags=%x",
st, data, nbytes, flags);
struct private_data *priv = st->conn->privateData; struct private_data *priv = st->conn->privateData;
virNetClientStreamPtr privst = st->privateData; virNetClientStreamPtr privst = st->privateData;
int rv; int rv;
virCheckFlags(0, -1);
if (virNetClientStreamRaiseError(privst)) if (virNetClientStreamRaiseError(privst))
return -1; return -1;
...@@ -5671,6 +5675,14 @@ remoteStreamRecv(virStreamPtr st, ...@@ -5671,6 +5675,14 @@ remoteStreamRecv(virStreamPtr st,
return rv; return rv;
} }
static int
remoteStreamRecv(virStreamPtr st,
char *data,
size_t nbytes)
{
return remoteStreamRecvFlags(st, data, nbytes, 0);
}
struct remoteStreamCallbackData { struct remoteStreamCallbackData {
virStreamPtr st; virStreamPtr st;
virStreamEventCallback cb; virStreamEventCallback cb;
...@@ -5843,6 +5855,7 @@ remoteStreamAbort(virStreamPtr st) ...@@ -5843,6 +5855,7 @@ remoteStreamAbort(virStreamPtr st)
static virStreamDriver remoteStreamDrv = { static virStreamDriver remoteStreamDrv = {
.streamRecv = remoteStreamRecv, .streamRecv = remoteStreamRecv,
.streamRecvFlags = remoteStreamRecvFlags,
.streamSend = remoteStreamSend, .streamSend = remoteStreamSend,
.streamFinish = remoteStreamFinish, .streamFinish = remoteStreamFinish,
.streamAbort = remoteStreamAbort, .streamAbort = remoteStreamAbort,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册