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++) {
if (passFDs[j] == wantfd) {
VIR_DEBUG("Clash %zu", j);
int newfd = dup(passFDs[j]);
VIR_DEBUG("Clash %zu", j);
if (newfd < 0) {
virReportSystemError(errno,
_("Cannot move fd %d out of the way"),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -830,10 +830,11 @@ virFirewallApply(virFirewallPtr firewall)
VIR_DEBUG("Applying groups for %p", firewall);
for (i = 0; i < firewall->ngroups; i++) {
if (virFirewallApplyGroup(firewall, i) < 0) {
VIR_DEBUG("Rolling back groups up to %zu for %p", i, firewall);
size_t first = i;
virErrorPtr saved_error;
VIR_DEBUG("Rolling back groups up to %zu for %p", i, firewall);
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 (!addr || !VIR_SOCKET_ADDR_VALID(addr)) {
VIR_DEBUG("computing default address");
int family = VIR_SOCKET_ADDR_FAMILY(gateway);
VIR_DEBUG("computing default address");
if (family == AF_INET) {
if (virSocketAddrParseIPv4(&defaultAddr, VIR_SOCKET_ADDR_IPV4_ALL) < 0)
return -1;

View File

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

View File

@ -444,11 +444,12 @@ int virProcessKillPainfully(pid_t pid, bool force)
int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
{
size_t i;
VIR_DEBUG("Set process affinity on %lld", (long long)pid);
int numcpus = 1024;
size_t masklen;
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,
* 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,

View File

@ -5335,14 +5335,14 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
uid_t uid, gid_t gid,
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;
virStorageType actualType = virStorageSourceGetActualType(src);
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)))
return -1;