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:
Daniel P. Berrange 2012-07-18 15:49:46 +01:00
parent 4e28b322d4
commit 0e9047ced5
2 changed files with 33 additions and 37 deletions

1
cfg.mk
View File

@ -517,7 +517,6 @@ msg_gen_function += libxlError
msg_gen_function += nodeReportError msg_gen_function += nodeReportError
msg_gen_function += regerror msg_gen_function += regerror
msg_gen_function += statsError msg_gen_function += statsError
msg_gen_function += streamsReportError
msg_gen_function += vah_error msg_gen_function += vah_error
msg_gen_function += vah_warning msg_gen_function += vah_warning
msg_gen_function += virConfError msg_gen_function += virConfError

View File

@ -42,9 +42,6 @@
#include "configmake.h" #include "configmake.h"
#define VIR_FROM_THIS VIR_FROM_STREAMS #define VIR_FROM_THIS VIR_FROM_STREAMS
#define streamsReportError(code, ...) \
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
/* Tunnelled migration stream support */ /* Tunnelled migration stream support */
struct virFDStreamData { struct virFDStreamData {
@ -82,15 +79,15 @@ static int virFDStreamRemoveCallback(virStreamPtr stream)
int ret = -1; int ret = -1;
if (!fdst) { if (!fdst) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("stream is not open")); "%s", _("stream is not open"));
return -1; return -1;
} }
virMutexLock(&fdst->lock); virMutexLock(&fdst->lock);
if (fdst->watch == 0) { if (fdst->watch == 0) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("stream does not have a callback registered")); "%s", _("stream does not have a callback registered"));
goto cleanup; goto cleanup;
} }
@ -119,15 +116,15 @@ static int virFDStreamUpdateCallback(virStreamPtr stream, int events)
int ret = -1; int ret = -1;
if (!fdst) { if (!fdst) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("stream is not open")); "%s", _("stream is not open"));
return -1; return -1;
} }
virMutexLock(&fdst->lock); virMutexLock(&fdst->lock);
if (fdst->watch == 0) { if (fdst->watch == 0) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("stream does not have a callback registered")); "%s", _("stream does not have a callback registered"));
goto cleanup; goto cleanup;
} }
@ -201,15 +198,15 @@ virFDStreamAddCallback(virStreamPtr st,
int ret = -1; int ret = -1;
if (!fdst) { if (!fdst) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("stream is not open")); "%s", _("stream is not open"));
return -1; return -1;
} }
virMutexLock(&fdst->lock); virMutexLock(&fdst->lock);
if (fdst->watch != 0) { if (fdst->watch != 0) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("stream already has a callback registered")); "%s", _("stream already has a callback registered"));
goto cleanup; goto cleanup;
} }
@ -218,8 +215,8 @@ virFDStreamAddCallback(virStreamPtr st,
virFDStreamEvent, virFDStreamEvent,
st, st,
virFDStreamCallbackFree)) < 0) { virFDStreamCallbackFree)) < 0) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot register file watch on stream")); "%s", _("cannot register file watch on stream"));
goto cleanup; goto cleanup;
} }
@ -297,16 +294,16 @@ virFDStreamCloseInt(virStreamPtr st, bool streamAbort)
} else if (status != 0) { } else if (status != 0) {
if (buf[0] == '\0') { if (buf[0] == '\0') {
if (WIFEXITED(status)) { if (WIFEXITED(status)) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("I/O helper exited with status %d"), _("I/O helper exited with status %d"),
WEXITSTATUS(status)); WEXITSTATUS(status));
} else { } else {
streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("I/O helper exited abnormally")); _("I/O helper exited abnormally"));
} }
} else { } else {
streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
buf); buf);
} }
ret = -1; ret = -1;
} }
@ -363,8 +360,8 @@ static int virFDStreamWrite(virStreamPtr st, const char *bytes, size_t nbytes)
} }
if (!fdst) { if (!fdst) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("stream is not open")); "%s", _("stream is not open"));
return -1; return -1;
} }
@ -415,8 +412,8 @@ static int virFDStreamRead(virStreamPtr st, char *bytes, size_t nbytes)
} }
if (!fdst) { if (!fdst) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("stream is not open")); "%s", _("stream is not open"));
return -1; return -1;
} }
@ -489,8 +486,8 @@ static int virFDStreamOpenInternal(virStreamPtr st,
fdst->length = length; fdst->length = length;
if (virMutexInit(&fdst->lock) < 0) { if (virMutexInit(&fdst->lock) < 0) {
VIR_FREE(fdst); VIR_FREE(fdst);
streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to initialize mutex")); _("Unable to initialize mutex"));
return -1; return -1;
} }
@ -622,9 +619,9 @@ virFDStreamOpenFileInternal(virStreamPtr st,
int fds[2] = { -1, -1 }; int fds[2] = { -1, -1 };
if ((oflags & O_ACCMODE) == O_RDWR) { if ((oflags & O_ACCMODE) == O_RDWR) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: Cannot request read and write flags together"), _("%s: Cannot request read and write flags together"),
path); path);
goto error; goto error;
} }
@ -680,9 +677,9 @@ int virFDStreamOpenFile(virStreamPtr st,
int oflags) int oflags)
{ {
if (oflags & O_CREAT) { if (oflags & O_CREAT) {
streamsReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Attempt to create %s without specifying mode"), _("Attempt to create %s without specifying mode"),
path); path);
return -1; return -1;
} }
return virFDStreamOpenFileInternal(st, path, return virFDStreamOpenFileInternal(st, path,