提交 c4410852 编写于 作者: P Peter Krempa

qemu: monitor: Refactor and fix monitor checking

Among all the monitor APIs some where checking if mon is NULL and some
were not. Since it's possible to have mon equal to NULL in case a second
call is attempted once entered the monitor. This requires that every
single API checks for the monitor.

This patch adds a macro that helps checking the state of the monitor and
either refactors existing checking code to use the macro or adds it in
case it was missing.
上级 0c68ec7d
此差异已折叠。
...@@ -712,7 +712,7 @@ int qemuMonitorDiskSnapshot(qemuMonitorPtr mon, ...@@ -712,7 +712,7 @@ int qemuMonitorDiskSnapshot(qemuMonitorPtr mon,
const char *format, const char *format,
bool reuse); bool reuse);
int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions) int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(2);
int qemuMonitorDriveMirror(qemuMonitorPtr mon, int qemuMonitorDriveMirror(qemuMonitorPtr mon,
const char *device, const char *device,
const char *file, const char *file,
...@@ -721,10 +721,10 @@ int qemuMonitorDriveMirror(qemuMonitorPtr mon, ...@@ -721,10 +721,10 @@ int qemuMonitorDriveMirror(qemuMonitorPtr mon,
unsigned int granularity, unsigned int granularity,
unsigned long long buf_size, unsigned long long buf_size,
unsigned int flags) unsigned int flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int qemuMonitorDrivePivot(qemuMonitorPtr mon, int qemuMonitorDrivePivot(qemuMonitorPtr mon,
const char *device) const char *device)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(2);
int qemuMonitorBlockCommit(qemuMonitorPtr mon, int qemuMonitorBlockCommit(qemuMonitorPtr mon,
const char *device, const char *device,
...@@ -732,15 +732,13 @@ int qemuMonitorBlockCommit(qemuMonitorPtr mon, ...@@ -732,15 +732,13 @@ int qemuMonitorBlockCommit(qemuMonitorPtr mon,
const char *base, const char *base,
const char *backingName, const char *backingName,
unsigned long long bandwidth) unsigned long long bandwidth)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
ATTRIBUTE_NONNULL(4);
bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon); bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon);
char *qemuMonitorDiskNameLookup(qemuMonitorPtr mon, char *qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
const char *device, const char *device,
virStorageSourcePtr top, virStorageSourcePtr top,
virStorageSourcePtr target) virStorageSourcePtr target)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
ATTRIBUTE_NONNULL(4);
int qemuMonitorArbitraryCommand(qemuMonitorPtr mon, int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
const char *cmd, const char *cmd,
...@@ -763,12 +761,12 @@ int qemuMonitorBlockStream(qemuMonitorPtr mon, ...@@ -763,12 +761,12 @@ int qemuMonitorBlockStream(qemuMonitorPtr mon,
const char *backingName, const char *backingName,
unsigned long long bandwidth, unsigned long long bandwidth,
bool modern) bool modern)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(2);
int qemuMonitorBlockJobCancel(qemuMonitorPtr mon, int qemuMonitorBlockJobCancel(qemuMonitorPtr mon,
const char *device, const char *device,
bool modern) bool modern)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(2);
int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon, int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon,
const char *device, const char *device,
...@@ -779,7 +777,7 @@ int qemuMonitorBlockJobInfo(qemuMonitorPtr mon, ...@@ -779,7 +777,7 @@ int qemuMonitorBlockJobInfo(qemuMonitorPtr mon,
const char *device, const char *device,
virDomainBlockJobInfoPtr info, virDomainBlockJobInfoPtr info,
unsigned long long *bandwidth) unsigned long long *bandwidth)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int qemuMonitorOpenGraphics(qemuMonitorPtr mon, int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
const char *protocol, const char *protocol,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册