Move debug statements after declarations

Many of our functions start with a DEBUG statement.
Move the statements after declarations to appease
our coding style.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2020-08-03 17:28:06 +02:00
parent 0a37e0695b
commit 96b4f38603
16 changed files with 57 additions and 32 deletions

View File

@ -291,8 +291,10 @@ static int lxcContainerSetupFDs(int *ttyfd,
*/ */
for (j = i + 1; j < npassFDs; j++) { for (j = i + 1; j < npassFDs; j++) {
if (passFDs[j] == wantfd) { if (passFDs[j] == wantfd) {
VIR_DEBUG("Clash %zu", j);
int newfd = dup(passFDs[j]); int newfd = dup(passFDs[j]);
VIR_DEBUG("Clash %zu", j);
if (newfd < 0) { if (newfd < 0) {
virReportSystemError(errno, virReportSystemError(errno,
_("Cannot move fd %d out of the way"), _("Cannot move fd %d out of the way"),

View File

@ -2655,8 +2655,10 @@ ebtablesRemoveSubChainsQuery(virFirewallPtr fw,
const char *chainprefixes = opaque; const char *chainprefixes = opaque;
for (i = 0; lines[i] != NULL; i++) { for (i = 0; lines[i] != NULL; i++) {
VIR_DEBUG("Considering '%s'", lines[i]);
char *tmp = strstr(lines[i], "-j "); char *tmp = strstr(lines[i], "-j ");
VIR_DEBUG("Considering '%s'", lines[i]);
if (!tmp) if (!tmp)
continue; continue;
tmp = tmp + 3; tmp = tmp + 3;
@ -2757,8 +2759,10 @@ ebtablesRenameTmpSubAndRootChainsQuery(virFirewallPtr fw,
char newchain[MAX_CHAINNAME_LENGTH]; char newchain[MAX_CHAINNAME_LENGTH];
for (i = 0; lines[i] != NULL; i++) { for (i = 0; lines[i] != NULL; i++) {
VIR_DEBUG("Considering '%s'", lines[i]);
char *tmp = strstr(lines[i], "-j "); char *tmp = strstr(lines[i], "-j ");
VIR_DEBUG("Considering '%s'", lines[i]);
if (!tmp) if (!tmp)
continue; continue;
tmp = tmp + 3; tmp = tmp + 3;

View File

@ -6308,12 +6308,14 @@ int qemuDomainLogContextWrite(qemuDomainLogContextPtr ctxt,
ssize_t qemuDomainLogContextRead(qemuDomainLogContextPtr ctxt, ssize_t qemuDomainLogContextRead(qemuDomainLogContextPtr ctxt,
char **msg) char **msg)
{ {
char *buf;
size_t buflen;
VIR_DEBUG("Context read %p manager=%p inode=%llu pos=%llu", VIR_DEBUG("Context read %p manager=%p inode=%llu pos=%llu",
ctxt, ctxt->manager, ctxt, ctxt->manager,
(unsigned long long)ctxt->inode, (unsigned long long)ctxt->inode,
(unsigned long long)ctxt->pos); (unsigned long long)ctxt->pos);
char *buf;
size_t buflen;
if (ctxt->manager) { if (ctxt->manager) {
buf = virLogManagerDomainReadLogFile(ctxt->manager, buf = virLogManagerDomainReadLogFile(ctxt->manager,
ctxt->path, ctxt->path,

View File

@ -2838,9 +2838,10 @@ qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon,
int fd, int fd,
const char *fdname) const char *fdname)
{ {
VIR_DEBUG("device=%s fd=%d fdname=%s", devicestr, fd, NULLSTR(fdname));
int ret; int ret;
VIR_DEBUG("device=%s fd=%d fdname=%s", devicestr, fd, NULLSTR(fdname));
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);
if (fd >= 0 && qemuMonitorSendFileHandle(mon, fdname, fd) < 0) if (fd >= 0 && qemuMonitorSendFileHandle(mon, fdname, fd) < 0)
@ -3458,9 +3459,10 @@ qemuMonitorOpenGraphics(qemuMonitorPtr mon,
const char *fdname, const char *fdname,
bool skipauth) bool skipauth)
{ {
int ret;
VIR_DEBUG("protocol=%s fd=%d fdname=%s skipauth=%d", VIR_DEBUG("protocol=%s fd=%d fdname=%s skipauth=%d",
protocol, fd, NULLSTR(fdname), skipauth); protocol, fd, NULLSTR(fdname), skipauth);
int ret;
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);
@ -4168,9 +4170,10 @@ int
qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon, qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon,
virHashTablePtr *info) virHashTablePtr *info)
{ {
VIR_DEBUG("info=%p", info);
int ret; int ret;
VIR_DEBUG("info=%p", info);
*info = NULL; *info = NULL;
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);

View File

@ -1620,10 +1620,10 @@ static
void remoteRelayConnectionClosedEvent(virConnectPtr conn G_GNUC_UNUSED, int reason, void *opaque) void remoteRelayConnectionClosedEvent(virConnectPtr conn G_GNUC_UNUSED, int reason, void *opaque)
{ {
virNetServerClientPtr client = opaque; virNetServerClientPtr client = opaque;
remote_connect_event_connection_closed_msg msg = { reason };
VIR_DEBUG("Relaying connection closed event, reason %d", reason); VIR_DEBUG("Relaying connection closed event, reason %d", reason);
remote_connect_event_connection_closed_msg msg = { reason };
remoteDispatchObjectEventSend(client, remoteProgram, remoteDispatchObjectEventSend(client, remoteProgram,
REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED, REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED,
(xdrproc_t)xdr_remote_connect_event_connection_closed_msg, (xdrproc_t)xdr_remote_connect_event_connection_closed_msg,

View File

@ -434,9 +434,10 @@ int daemonAddClientStream(virNetServerClientPtr client,
daemonClientStream *stream, daemonClientStream *stream,
bool transmit) bool transmit)
{ {
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
VIR_DEBUG("client=%p, proc=%d, serial=%u, st=%p, transmit=%d", VIR_DEBUG("client=%p, proc=%d, serial=%u, st=%p, transmit=%d",
client, stream->procedure, stream->serial, stream->st, transmit); client, stream->procedure, stream->serial, stream->st, transmit);
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
if (stream->filterID != -1) { if (stream->filterID != -1) {
VIR_WARN("Filter already added to client %p", client); VIR_WARN("Filter already added to client %p", client);
@ -484,12 +485,13 @@ int
daemonRemoveClientStream(virNetServerClientPtr client, daemonRemoveClientStream(virNetServerClientPtr client,
daemonClientStream *stream) daemonClientStream *stream)
{ {
VIR_DEBUG("client=%p, proc=%d, serial=%u, st=%p",
client, stream->procedure, stream->serial, stream->st);
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client); daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
daemonClientStream *curr = priv->streams; daemonClientStream *curr = priv->streams;
daemonClientStream *prev = NULL; daemonClientStream *prev = NULL;
VIR_DEBUG("client=%p, proc=%d, serial=%u, st=%p",
client, stream->procedure, stream->serial, stream->st);
if (stream->filterID != -1) { if (stream->filterID != -1) {
virNetServerClientRemoveFilter(client, virNetServerClientRemoveFilter(client,
stream->filterID); stream->filterID);
@ -648,11 +650,12 @@ daemonStreamHandleAbort(virNetServerClientPtr client,
daemonClientStream *stream, daemonClientStream *stream,
virNetMessagePtr msg) virNetMessagePtr msg)
{ {
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%u",
client, stream, msg->header.proc, msg->header.serial);
int ret; int ret;
bool raise_error = false; bool raise_error = false;
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%u",
client, stream, msg->header.proc, msg->header.serial);
stream->closed = true; stream->closed = true;
virStreamEventRemoveCallback(stream->st); virStreamEventRemoveCallback(stream->st);
ret = virStreamAbort(stream->st); ret = virStreamAbort(stream->st);

View File

@ -5691,11 +5691,12 @@ remoteStreamSend(virStreamPtr st,
const char *data, const char *data,
size_t nbytes) size_t nbytes)
{ {
VIR_DEBUG("st=%p data=%p nbytes=%zu", st, data, nbytes);
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;
VIR_DEBUG("st=%p data=%p nbytes=%zu", st, data, nbytes);
remoteDriverLock(priv); remoteDriverLock(priv);
priv->localUses++; priv->localUses++;
remoteDriverUnlock(priv); remoteDriverUnlock(priv);
@ -5719,12 +5720,13 @@ remoteStreamRecvFlags(virStreamPtr st,
size_t nbytes, size_t nbytes,
unsigned int flags) unsigned int flags)
{ {
VIR_DEBUG("st=%p data=%p nbytes=%zu flags=0x%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;
VIR_DEBUG("st=%p data=%p nbytes=%zu flags=0x%x",
st, data, nbytes, flags);
virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1); virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1);
remoteDriverLock(priv); remoteDriverLock(priv);
@ -5760,12 +5762,13 @@ remoteStreamSendHole(virStreamPtr st,
long long length, long long length,
unsigned int flags) unsigned int flags)
{ {
VIR_DEBUG("st=%p length=%lld flags=0x%x",
st, length, 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;
VIR_DEBUG("st=%p length=%lld flags=0x%x",
st, length, flags);
remoteDriverLock(priv); remoteDriverLock(priv);
priv->localUses++; priv->localUses++;
remoteDriverUnlock(priv); remoteDriverUnlock(priv);

View File

@ -1558,8 +1558,10 @@ static void
virNetClientIOEventLoopPassTheBuck(virNetClientPtr client, virNetClientIOEventLoopPassTheBuck(virNetClientPtr client,
virNetClientCallPtr thiscall) virNetClientCallPtr thiscall)
{ {
VIR_DEBUG("Giving up the buck %p", thiscall);
virNetClientCallPtr tmp = client->waitDispatch; virNetClientCallPtr tmp = client->waitDispatch;
VIR_DEBUG("Giving up the buck %p", thiscall);
/* See if someone else is still waiting /* See if someone else is still waiting
* and if so, then pass the buck ! */ * and if so, then pass the buck ! */
while (tmp) { while (tmp) {

View File

@ -673,10 +673,10 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
virStoragePoolSourceDevicePtr dev = &def->source.devices[0]; virStoragePoolSourceDevicePtr dev = &def->source.devices[0];
unsigned long long cylinderSize = (unsigned long long)dev->geometry.heads * unsigned long long cylinderSize = (unsigned long long)dev->geometry.heads *
dev->geometry.sectors * SECTOR_SIZE; dev->geometry.sectors * SECTOR_SIZE;
int partType = virStorageBackendDiskPartTypeToCreate(pool);
VIR_DEBUG("find free area: allocation %llu, cyl size %llu", allocation, VIR_DEBUG("find free area: allocation %llu, cyl size %llu", allocation,
cylinderSize); cylinderSize);
int partType = virStorageBackendDiskPartTypeToCreate(pool);
/* how many extra bytes we have since we allocate /* how many extra bytes we have since we allocate
aligned to the cylinder boundary */ aligned to the cylinder boundary */

View File

@ -51,11 +51,12 @@ struct _virStorageFileBackendFsPriv {
static void static void
virStorageFileBackendFileDeinit(virStorageSourcePtr src) virStorageFileBackendFileDeinit(virStorageSourcePtr src)
{ {
virStorageFileBackendFsPrivPtr priv = src->drv->priv;
VIR_DEBUG("deinitializing FS storage file %p (%s:%s)", src, VIR_DEBUG("deinitializing FS storage file %p (%s:%s)", src,
virStorageTypeToString(virStorageSourceGetActualType(src)), virStorageTypeToString(virStorageSourceGetActualType(src)),
src->path); src->path);
virStorageFileBackendFsPrivPtr priv = src->drv->priv;
VIR_FREE(priv->canonpath); VIR_FREE(priv->canonpath);
VIR_FREE(priv); VIR_FREE(priv);

View File

@ -862,8 +862,8 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
dbustype *x = (dbustype *)&v.member; \ dbustype *x = (dbustype *)&v.member; \
vargtype *y; \ vargtype *y; \
if (arrayref) { \ if (arrayref) { \
VIR_DEBUG("Use arrayref"); \
vargtype **xptrptr = arrayptr; \ vargtype **xptrptr = arrayptr; \
VIR_DEBUG("Use arrayref"); \
if (VIR_EXPAND_N(*xptrptr, *narrayptr, 1) < 0) \ if (VIR_EXPAND_N(*xptrptr, *narrayptr, 1) < 0) \
goto cleanup; \ goto cleanup; \
y = (*xptrptr + (*narrayptr - 1)); \ y = (*xptrptr + (*narrayptr - 1)); \

View File

@ -830,10 +830,11 @@ virFirewallApply(virFirewallPtr firewall)
VIR_DEBUG("Applying groups for %p", firewall); VIR_DEBUG("Applying groups for %p", firewall);
for (i = 0; i < firewall->ngroups; i++) { for (i = 0; i < firewall->ngroups; i++) {
if (virFirewallApplyGroup(firewall, i) < 0) { if (virFirewallApplyGroup(firewall, i) < 0) {
VIR_DEBUG("Rolling back groups up to %zu for %p", i, firewall);
size_t first = i; size_t first = i;
virErrorPtr saved_error; virErrorPtr saved_error;
VIR_DEBUG("Rolling back groups up to %zu for %p", i, firewall);
virErrorPreserveLast(&saved_error); virErrorPreserveLast(&saved_error);
/* /*

View File

@ -296,8 +296,10 @@ virNetDevIPRouteAdd(const char *ifname,
/* If we have no valid network address, then use the default one */ /* If we have no valid network address, then use the default one */
if (!addr || !VIR_SOCKET_ADDR_VALID(addr)) { if (!addr || !VIR_SOCKET_ADDR_VALID(addr)) {
VIR_DEBUG("computing default address");
int family = VIR_SOCKET_ADDR_FAMILY(gateway); int family = VIR_SOCKET_ADDR_FAMILY(gateway);
VIR_DEBUG("computing default address");
if (family == AF_INET) { if (family == AF_INET) {
if (virSocketAddrParseIPv4(&defaultAddr, VIR_SOCKET_ADDR_IPV4_ALL) < 0) if (virSocketAddrParseIPv4(&defaultAddr, VIR_SOCKET_ADDR_IPV4_ALL) < 0)
return -1; return -1;

View File

@ -315,11 +315,12 @@ virObjectRWLockableNew(virClassPtr klass)
static void vir_object_finalize(GObject *gobj) static void vir_object_finalize(GObject *gobj)
{ {
PROBE(OBJECT_DISPOSE, "obj=%p", gobj);
virObjectPtr obj = VIR_OBJECT(gobj); virObjectPtr obj = VIR_OBJECT(gobj);
virObjectPrivate *priv = vir_object_get_instance_private(obj); virObjectPrivate *priv = vir_object_get_instance_private(obj);
virClassPtr klass = priv->klass; virClassPtr klass = priv->klass;
PROBE(OBJECT_DISPOSE, "obj=%p", gobj);
while (klass) { while (klass) {
if (klass->dispose) if (klass->dispose)
klass->dispose(obj); klass->dispose(obj);

View File

@ -444,11 +444,12 @@ int virProcessKillPainfully(pid_t pid, bool force)
int virProcessSetAffinity(pid_t pid, virBitmapPtr map) int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
{ {
size_t i; size_t i;
VIR_DEBUG("Set process affinity on %lld", (long long)pid);
int numcpus = 1024; int numcpus = 1024;
size_t masklen; size_t masklen;
cpu_set_t *mask; cpu_set_t *mask;
VIR_DEBUG("Set process affinity on %lld", (long long)pid);
/* Not only may the statically allocated cpu_set_t be too small, /* Not only may the statically allocated cpu_set_t be too small,
* but there is no way to ask the kernel what size is large enough. * but there is no way to ask the kernel what size is large enough.
* So you have no option but to pick a size, try, catch EINVAL, * So you have no option but to pick a size, try, catch EINVAL,

View File

@ -5335,14 +5335,14 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
uid_t uid, gid_t gid, uid_t uid, gid_t gid,
bool report_broken) bool report_broken)
{ {
VIR_DEBUG("path=%s format=%d uid=%u gid=%u report_broken=%d",
src->path, src->format, (unsigned int)uid, (unsigned int)gid,
report_broken);
virHashTablePtr cycle = NULL; virHashTablePtr cycle = NULL;
virStorageType actualType = virStorageSourceGetActualType(src); virStorageType actualType = virStorageSourceGetActualType(src);
int ret = -1; int ret = -1;
VIR_DEBUG("path=%s format=%d uid=%u gid=%u report_broken=%d",
src->path, src->format, (unsigned int)uid, (unsigned int)gid,
report_broken);
if (!(cycle = virHashCreate(5, NULL))) if (!(cycle = virHashCreate(5, NULL)))
return -1; return -1;