提交 0a5befc4 编写于 作者: M Matthias Bolte

Remove conn parameter from Linux stats functions

It was used for error reporting only.
上级 fe46a7e6
......@@ -61,6 +61,7 @@ src/util/json.c
src/util/logging.c
src/util/pci.c
src/util/processinfo.c
src/util/stats_linux.c
src/util/storage_file.c
src/util/util.c
src/util/uuid.c
......
......@@ -2048,7 +2048,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
}
if (ret == 0)
ret = linuxDomainInterfaceStats(dom->conn, path, stats);
ret = linuxDomainInterfaceStats(path, stats);
else
lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
_("Invalid path, '%s' is not a known interface"), path);
......
......@@ -6845,7 +6845,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
}
if (ret == 0)
ret = linuxDomainInterfaceStats (dom->conn, path, stats);
ret = linuxDomainInterfaceStats(path, stats);
else
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
_("invalid path, '%s' is not a known interface"), path);
......
......@@ -28,35 +28,9 @@
#define VIR_FROM_THIS VIR_FROM_STATS_LINUX
/**
* statsErrorFunc:
* @conn: the connection
* @error: the error number
* @func: the function failing
* @info: extra information string
* @value: extra information number
*
* Handle a stats error.
*/
static void
statsErrorFunc (virConnectPtr conn,
virErrorNumber error, const char *func, const char *info,
int value)
{
char fullinfo[1000];
const char *errmsg;
errmsg = virErrorMsg(error, info);
if (func != NULL) {
snprintf(fullinfo, sizeof (fullinfo) - 1, "%s: %s", func, info);
fullinfo[sizeof (fullinfo) - 1] = 0;
info = fullinfo;
}
virRaiseError(conn, NULL, NULL, VIR_FROM_STATS_LINUX, error,
VIR_ERR_ERROR,
errmsg, info, NULL, value, 0, errmsg, info,
value);
}
#define virStatsError(code, fmt...) \
virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, fmt)
/*-------------------- interface stats --------------------*/
......@@ -66,7 +40,7 @@ statsErrorFunc (virConnectPtr conn,
*/
int
linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
linuxDomainInterfaceStats(const char *path,
struct _virDomainInterfaceStats *stats)
{
int path_len;
......@@ -75,8 +49,8 @@ linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
fp = fopen ("/proc/net/dev", "r");
if (!fp) {
statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"/proc/net/dev", errno);
virReportSystemError(errno, "%s",
_("Could not open /proc/net/dev"));
return -1;
}
......@@ -131,8 +105,8 @@ linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
}
fclose (fp);
statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"/proc/net/dev: Interface not found", 0);
virStatsError(VIR_ERR_INTERNAL_ERROR,
"/proc/net/dev: Interface not found");
return -1;
}
......
......@@ -15,7 +15,7 @@
#include "internal.h"
extern int linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
extern int linuxDomainInterfaceStats(const char *path,
struct _virDomainInterfaceStats *stats);
#endif /* __linux__ */
......
......@@ -1477,7 +1477,7 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom,
return -1;
}
return linuxDomainInterfaceStats (dom->conn, path, stats);
return linuxDomainInterfaceStats(path, stats);
#else
virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
"/proc/net/dev: Interface not found", 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册