mirror of https://gitee.com/openkylin/libvirt.git
maint: print flags in hex during debug
Continuation of commit 313ac7fd
, and enforce things with a syntax
check.
Technically, virNetServerClientCalculateHandleMode is not printing
a mode_t, but rather a collection of VIR_EVENT_HANDLE_* bits;
however, these bits are < 8, so there is no different in the
output, and that was the easiest way to silence the new syntax check.
* cfg.mk (sc_flags_debug): New syntax check.
(exclude_file_name_regexp--sc_flags_debug): Add exemptions.
* src/fdstream.c (virFDStreamOpenFileInternal): Print flags in
hex, mode_t in octal.
* src/libvirt-qemu.c (virDomainQemuMonitorCommand)
(virDomainQemuAttach): Likewise.
* src/locking/lock_driver_nop.c (virLockManagerNopInit): Likewise.
* src/locking/lock_driver_sanlock.c (virLockManagerSanlockInit):
Likewise.
* src/locking/lock_manager.c: Likewise.
* src/qemu/qemu_migration.c: Likewise.
* src/qemu/qemu_monitor.c: Likewise.
* src/rpc/virnetserverclient.c
(virNetServerClientCalculateHandleMode): Print mode with %o.
This commit is contained in:
parent
017b840525
commit
06dbfa6d21
11
cfg.mk
11
cfg.mk
|
@ -269,6 +269,15 @@ sc_avoid_write:
|
|||
halt='consider using safewrite instead of write' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# In debug statements, print flags as bitmask and mode_t as octal.
|
||||
sc_flags_debug:
|
||||
@prohibit='\<mode=%[0-9.]*[diux]' \
|
||||
halt='debug mode_t values with %o' \
|
||||
$(_sc_search_regexp)
|
||||
@prohibit='\<flags=%[0-9.]*l*[diou]' \
|
||||
halt='debug flag values with %x' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Avoid functions that can lead to double-close bugs.
|
||||
sc_prohibit_close:
|
||||
@prohibit='([^>.]|^)\<[fp]?close *\(' \
|
||||
|
@ -627,6 +636,8 @@ exclude_file_name_regexp--sc_avoid_write = \
|
|||
|
||||
exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
|
||||
|
||||
exclude_file_name_regexp--sc_flags_debug = ^docs/
|
||||
|
||||
exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
|
||||
^src/rpc/gendispatch\.pl$$
|
||||
|
||||
|
|
|
@ -516,7 +516,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
|
|||
int errfd = -1;
|
||||
pid_t pid = 0;
|
||||
|
||||
VIR_DEBUG("st=%p path=%s flags=%d offset=%llu length=%llu mode=%d delete=%d",
|
||||
VIR_DEBUG("st=%p path=%s flags=%x offset=%llu length=%llu mode=%o delete=%d",
|
||||
st, path, flags, offset, length, mode, delete);
|
||||
|
||||
if (flags & O_CREAT)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* libvirt-qemu.c: Interfaces for the libvirt library to handle qemu-specific
|
||||
* APIs.
|
||||
*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -42,7 +42,8 @@ virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
|
|||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DEBUG("domain=%p, cmd=%s, result=%p, flags=%u", domain, cmd, result, flags);
|
||||
VIR_DEBUG("domain=%p, cmd=%s, result=%p, flags=%x",
|
||||
domain, cmd, result, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
|
@ -113,7 +114,7 @@ virDomainQemuAttach(virConnectPtr conn,
|
|||
unsigned pid,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("conn=%p, pid=%u, flags=%u", conn, pid, flags);
|
||||
VIR_DEBUG("conn=%p, pid=%u, flags=%x", conn, pid, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ static int virLockManagerNopInit(unsigned int version,
|
|||
const char *configFile,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("version=%u configFile=%s flags=%u", version, NULLSTR(configFile), flags);
|
||||
VIR_DEBUG("version=%u configFile=%s flags=%x",
|
||||
version, NULLSTR(configFile), flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -265,7 +265,8 @@ static int virLockManagerSanlockInit(unsigned int version,
|
|||
const char *configFile,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("version=%u configFile=%s flags=%u", version, NULLSTR(configFile), flags);
|
||||
VIR_DEBUG("version=%u configFile=%s flags=%x",
|
||||
version, NULLSTR(configFile), flags);
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (driver)
|
||||
|
|
|
@ -286,7 +286,7 @@ virLockManagerPtr virLockManagerNew(virLockManagerPluginPtr plugin,
|
|||
unsigned int flags)
|
||||
{
|
||||
virLockManagerPtr lock;
|
||||
VIR_DEBUG("plugin=%p type=%u nparams=%zu params=%p flags=%u",
|
||||
VIR_DEBUG("plugin=%p type=%u nparams=%zu params=%p flags=%x",
|
||||
plugin, type, nparams, params, flags);
|
||||
virLockManagerLogParams(nparams, params);
|
||||
|
||||
|
@ -315,7 +315,7 @@ int virLockManagerAddResource(virLockManagerPtr lock,
|
|||
virLockManagerParamPtr params,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("lock=%p type=%u name=%s nparams=%zu params=%p flags=%u",
|
||||
VIR_DEBUG("lock=%p type=%u name=%s nparams=%zu params=%p flags=%x",
|
||||
lock, type, name, nparams, params, flags);
|
||||
virLockManagerLogParams(nparams, params);
|
||||
|
||||
|
@ -332,7 +332,8 @@ int virLockManagerAcquire(virLockManagerPtr lock,
|
|||
unsigned int flags,
|
||||
int *fd)
|
||||
{
|
||||
VIR_DEBUG("lock=%p state='%s' flags=%u fd=%p", lock, NULLSTR(state), flags, fd);
|
||||
VIR_DEBUG("lock=%p state='%s' flags=%x fd=%p",
|
||||
lock, NULLSTR(state), flags, fd);
|
||||
|
||||
CHECK_MANAGER(drvAcquire, -1);
|
||||
|
||||
|
@ -347,7 +348,7 @@ int virLockManagerRelease(virLockManagerPtr lock,
|
|||
char **state,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("lock=%p state=%p flags=%u", lock, state, flags);
|
||||
VIR_DEBUG("lock=%p state=%p flags=%x", lock, state, flags);
|
||||
|
||||
CHECK_MANAGER(drvRelease, -1);
|
||||
|
||||
|
@ -359,7 +360,7 @@ int virLockManagerInquire(virLockManagerPtr lock,
|
|||
char **state,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("lock=%p state=%p flags=%u", lock, state, flags);
|
||||
VIR_DEBUG("lock=%p state=%p flags=%x", lock, state, flags);
|
||||
|
||||
CHECK_MANAGER(drvInquire, -1);
|
||||
|
||||
|
|
|
@ -1380,7 +1380,7 @@ static int doNativeMigrate(struct qemud_driver *driver,
|
|||
unsigned int background_flags = QEMU_MONITOR_MIGRATE_BACKGROUND;
|
||||
qemuMigrationCookiePtr mig = NULL;
|
||||
VIR_DEBUG("driver=%p, vm=%p, uri=%s, cookiein=%s, cookieinlen=%d, "
|
||||
"cookieout=%p, cookieoutlen=%p, flags=%u, dname=%s, resource=%lu",
|
||||
"cookieout=%p, cookieoutlen=%p, flags=%x, dname=%s, resource=%lu",
|
||||
driver, vm, uri, NULLSTR(cookiein), cookieinlen,
|
||||
cookieout, cookieoutlen, flags, NULLSTR(dname), resource);
|
||||
|
||||
|
@ -1600,7 +1600,7 @@ static int doTunnelMigrate(struct qemud_driver *driver,
|
|||
qemuMigrationCookiePtr mig = NULL;
|
||||
qemuMigrationIOThreadPtr iothread = NULL;
|
||||
VIR_DEBUG("driver=%p, vm=%p, st=%p, cookiein=%s, cookieinlen=%d, "
|
||||
"cookieout=%p, cookieoutlen=%p, flags=%lu, resource=%lu",
|
||||
"cookieout=%p, cookieoutlen=%p, flags=%lx, resource=%lu",
|
||||
driver, vm, st, NULLSTR(cookiein), cookieinlen,
|
||||
cookieout, cookieoutlen, flags, resource);
|
||||
|
||||
|
@ -1829,7 +1829,7 @@ static int doPeer2PeerMigrate2(struct qemud_driver *driver,
|
|||
int cancelled;
|
||||
virStreamPtr st = NULL;
|
||||
VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
|
||||
"flags=%lu, dname=%s, resource=%lu",
|
||||
"flags=%lx, dname=%s, resource=%lu",
|
||||
driver, sconn, dconn, vm, NULLSTR(dconnuri),
|
||||
flags, NULLSTR(dname), resource);
|
||||
|
||||
|
@ -1972,7 +1972,7 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver,
|
|||
int cancelled;
|
||||
virStreamPtr st = NULL;
|
||||
VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, xmlin=%s, "
|
||||
"dconnuri=%s, uri=%s, flags=%lu, dname=%s, resource=%lu",
|
||||
"dconnuri=%s, uri=%s, flags=%lx, dname=%s, resource=%lu",
|
||||
driver, sconn, dconn, vm, NULLSTR(xmlin),
|
||||
NULLSTR(dconnuri), NULLSTR(uri), flags,
|
||||
NULLSTR(dname), resource);
|
||||
|
@ -2142,7 +2142,7 @@ static int doPeer2PeerMigrate(struct qemud_driver *driver,
|
|||
virConnectPtr dconn = NULL;
|
||||
bool p2p;
|
||||
VIR_DEBUG("driver=%p, sconn=%p, vm=%p, xmlin=%s, dconnuri=%s, "
|
||||
"uri=%s, flags=%lu, dname=%s, resource=%lu",
|
||||
"uri=%s, flags=%lx, dname=%s, resource=%lu",
|
||||
driver, sconn, vm, NULLSTR(xmlin), NULLSTR(dconnuri),
|
||||
NULLSTR(uri), flags, NULLSTR(dname), resource);
|
||||
|
||||
|
@ -2221,7 +2221,7 @@ int qemuMigrationPerform(struct qemud_driver *driver,
|
|||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_DEBUG("driver=%p, conn=%p, vm=%p, xmlin=%s, dconnuri=%s, "
|
||||
"uri=%s, cookiein=%s, cookieinlen=%d, cookieout=%p, "
|
||||
"cookieoutlen=%p, flags=%lu, dname=%s, resource=%lu, v3proto=%d",
|
||||
"cookieoutlen=%p, flags=%lx, dname=%s, resource=%lu, v3proto=%d",
|
||||
driver, conn, vm, NULLSTR(xmlin), NULLSTR(dconnuri),
|
||||
NULLSTR(uri), NULLSTR(cookiein), cookieinlen,
|
||||
cookieout, cookieoutlen, flags, NULLSTR(dname),
|
||||
|
@ -2387,7 +2387,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
|
|||
qemuDomainObjPrivatePtr priv = NULL;
|
||||
qemuMigrationCookiePtr mig = NULL;
|
||||
VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
|
||||
"cookieout=%p, cookieoutlen=%p, flags=%lu, retcode=%d",
|
||||
"cookieout=%p, cookieoutlen=%p, flags=%lx, retcode=%d",
|
||||
driver, dconn, vm, NULLSTR(cookiein), cookieinlen,
|
||||
cookieout, cookieoutlen, flags, retcode);
|
||||
virErrorPtr orig_err = NULL;
|
||||
|
@ -2571,7 +2571,7 @@ int qemuMigrationConfirm(struct qemud_driver *driver,
|
|||
virDomainEventPtr event = NULL;
|
||||
int rv = -1;
|
||||
VIR_DEBUG("driver=%p, conn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
|
||||
"flags=%u, retcode=%d",
|
||||
"flags=%x, retcode=%d",
|
||||
driver, conn, vm, NULLSTR(cookiein), cookieinlen,
|
||||
flags, retcode);
|
||||
|
||||
|
|
|
@ -1534,7 +1534,7 @@ int qemuMonitorMigrateToFd(qemuMonitorPtr mon,
|
|||
int fd)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p fd=%d flags=%u",
|
||||
VIR_DEBUG("mon=%p fd=%d flags=%x",
|
||||
mon, fd, flags);
|
||||
|
||||
if (!mon) {
|
||||
|
@ -1567,7 +1567,7 @@ int qemuMonitorMigrateToHost(qemuMonitorPtr mon,
|
|||
{
|
||||
int ret;
|
||||
char *uri = NULL;
|
||||
VIR_DEBUG("mon=%p hostname=%s port=%d flags=%u",
|
||||
VIR_DEBUG("mon=%p hostname=%s port=%d flags=%x",
|
||||
mon, hostname, port, flags);
|
||||
|
||||
if (!mon) {
|
||||
|
@ -1599,7 +1599,7 @@ int qemuMonitorMigrateToCommand(qemuMonitorPtr mon,
|
|||
char *argstr;
|
||||
char *dest = NULL;
|
||||
int ret = -1;
|
||||
VIR_DEBUG("mon=%p argv=%p flags=%u",
|
||||
VIR_DEBUG("mon=%p argv=%p flags=%x",
|
||||
mon, argv, flags);
|
||||
|
||||
if (!mon) {
|
||||
|
@ -1640,7 +1640,7 @@ int qemuMonitorMigrateToFile(qemuMonitorPtr mon,
|
|||
char *dest = NULL;
|
||||
int ret = -1;
|
||||
char *safe_target = NULL;
|
||||
VIR_DEBUG("mon=%p argv=%p target=%s offset=%llu flags=%u",
|
||||
VIR_DEBUG("mon=%p argv=%p target=%s offset=%llu flags=%x",
|
||||
mon, argv, target, offset, flags);
|
||||
|
||||
if (!mon) {
|
||||
|
@ -1703,7 +1703,7 @@ int qemuMonitorMigrateToUnix(qemuMonitorPtr mon,
|
|||
{
|
||||
char *dest = NULL;
|
||||
int ret = -1;
|
||||
VIR_DEBUG("mon=%p, unixfile=%s flags=%u",
|
||||
VIR_DEBUG("mon=%p, unixfile=%s flags=%x",
|
||||
mon, unixfile, flags);
|
||||
|
||||
if (!mon) {
|
||||
|
|
|
@ -156,7 +156,7 @@ virNetServerClientCalculateHandleMode(virNetServerClientPtr client) {
|
|||
if (client->tx)
|
||||
mode |= VIR_EVENT_HANDLE_WRITABLE;
|
||||
}
|
||||
VIR_DEBUG("mode=%d", mode);
|
||||
VIR_DEBUG("mode=%o", mode);
|
||||
return mode;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue