mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Replace use of streamsReportError with virReportError
Update the streams code to use virReportError instead of the streamsReportError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
4e28b322d4
commit
0e9047ced5
1
cfg.mk
1
cfg.mk
@ -517,7 +517,6 @@ msg_gen_function += libxlError
|
||||
msg_gen_function += nodeReportError
|
||||
msg_gen_function += regerror
|
||||
msg_gen_function += statsError
|
||||
msg_gen_function += streamsReportError
|
||||
msg_gen_function += vah_error
|
||||
msg_gen_function += vah_warning
|
||||
msg_gen_function += virConfError
|
||||
|
@ -42,9 +42,6 @@
|
||||
#include "configmake.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_STREAMS
|
||||
#define streamsReportError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
/* Tunnelled migration stream support */
|
||||
struct virFDStreamData {
|
||||
@ -82,14 +79,14 @@ static int virFDStreamRemoveCallback(virStreamPtr stream)
|
||||
int ret = -1;
|
||||
|
||||
if (!fdst) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("stream is not open"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
virMutexLock(&fdst->lock);
|
||||
if (fdst->watch == 0) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("stream does not have a callback registered"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -119,14 +116,14 @@ static int virFDStreamUpdateCallback(virStreamPtr stream, int events)
|
||||
int ret = -1;
|
||||
|
||||
if (!fdst) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("stream is not open"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
virMutexLock(&fdst->lock);
|
||||
if (fdst->watch == 0) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("stream does not have a callback registered"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -201,14 +198,14 @@ virFDStreamAddCallback(virStreamPtr st,
|
||||
int ret = -1;
|
||||
|
||||
if (!fdst) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("stream is not open"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
virMutexLock(&fdst->lock);
|
||||
if (fdst->watch != 0) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("stream already has a callback registered"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -218,7 +215,7 @@ virFDStreamAddCallback(virStreamPtr st,
|
||||
virFDStreamEvent,
|
||||
st,
|
||||
virFDStreamCallbackFree)) < 0) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot register file watch on stream"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -297,15 +294,15 @@ virFDStreamCloseInt(virStreamPtr st, bool streamAbort)
|
||||
} else if (status != 0) {
|
||||
if (buf[0] == '\0') {
|
||||
if (WIFEXITED(status)) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("I/O helper exited with status %d"),
|
||||
WEXITSTATUS(status));
|
||||
} else {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("I/O helper exited abnormally"));
|
||||
}
|
||||
} else {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
buf);
|
||||
}
|
||||
ret = -1;
|
||||
@ -363,7 +360,7 @@ static int virFDStreamWrite(virStreamPtr st, const char *bytes, size_t nbytes)
|
||||
}
|
||||
|
||||
if (!fdst) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("stream is not open"));
|
||||
return -1;
|
||||
}
|
||||
@ -415,7 +412,7 @@ static int virFDStreamRead(virStreamPtr st, char *bytes, size_t nbytes)
|
||||
}
|
||||
|
||||
if (!fdst) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("stream is not open"));
|
||||
return -1;
|
||||
}
|
||||
@ -489,7 +486,7 @@ static int virFDStreamOpenInternal(virStreamPtr st,
|
||||
fdst->length = length;
|
||||
if (virMutexInit(&fdst->lock) < 0) {
|
||||
VIR_FREE(fdst);
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to initialize mutex"));
|
||||
return -1;
|
||||
}
|
||||
@ -622,7 +619,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
|
||||
int fds[2] = { -1, -1 };
|
||||
|
||||
if ((oflags & O_ACCMODE) == O_RDWR) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("%s: Cannot request read and write flags together"),
|
||||
path);
|
||||
goto error;
|
||||
@ -680,7 +677,7 @@ int virFDStreamOpenFile(virStreamPtr st,
|
||||
int oflags)
|
||||
{
|
||||
if (oflags & O_CREAT) {
|
||||
streamsReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Attempt to create %s without specifying mode"),
|
||||
path);
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user