[libvirt] [PATCH] Add node prefix to virNodeGet(CPU|Memory)Stats structs and defines

Matthias Bolte matthias.bolte at googlemail.com
Wed Jun 15 13:40:55 UTC 2011


---
 daemon/remote.c              |    4 +-
 include/libvirt/libvirt.h.in |   99 ++++++++++++++++++++----------------------
 src/driver.h                 |    4 +-
 src/libvirt.c                |   38 ++++++++--------
 src/nodeinfo.c               |   40 ++++++++--------
 src/nodeinfo.h               |    4 +-
 src/remote/remote_driver.c   |    4 +-
 tools/virsh.c                |   18 ++++----
 8 files changed, 103 insertions(+), 108 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 1914b25..180fefa 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1557,7 +1557,7 @@ remoteDispatchNodeGetCPUStats (struct qemud_server *server ATTRIBUTE_UNUSED,
                                remote_node_get_cpu_stats_args *args,
                                remote_node_get_cpu_stats_ret *ret)
 {
-    virCPUStatsPtr params = NULL;
+    virNodeCPUStatsPtr params = NULL;
     int i;
     int cpuNum = args->cpuNum;
     int nparams = args->nparams;
@@ -1634,7 +1634,7 @@ remoteDispatchNodeGetMemoryStats (struct qemud_server *server ATTRIBUTE_UNUSED,
                                   remote_node_get_memory_stats_args *args,
                                   remote_node_get_memory_stats_ret *ret)
 {
-    virMemoryStatsPtr params = NULL;
+    virNodeMemoryStatsPtr params = NULL;
     int i;
     int cellNum = args->cellNum;
     int nparams = args->nparams;
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index cf1a682..f029d69 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -302,135 +302,130 @@ struct _virNodeInfo {
 };
 
 /**
- * VIR_CPU_STATS_FIELD_LENGTH:
+ * VIR_NODE_CPU_STATS_FIELD_LENGTH:
  *
  * Macro providing the field length of virNodeCPUStats
  */
-#define VIR_CPU_STATS_FIELD_LENGTH 80
+#define VIR_NODE_CPU_STATS_FIELD_LENGTH 80
 
 /**
- * VIR_CPU_STATS_ALL_CPUS:
+ * VIR_NODE_CPU_STATS_ALL_CPUS:
  *
  * Macro for the total CPU time/utilization
  */
-#define VIR_CPU_STATS_ALL_CPUS (-1)
+#define VIR_NODE_CPU_STATS_ALL_CPUS (-1)
 
 /**
- * VIR_CPU_STATS_KERNEL:
+ * VIR_NODE_CPU_STATS_KERNEL:
  *
  * Macro for the cumulative CPU time which was spend by kernel,
  * since the node booting up (in nanoseconds).
  */
-#define VIR_CPU_STATS_KERNEL "kernel"
+#define VIR_NODE_CPU_STATS_KERNEL "kernel"
 
 /**
- * VIR_CPU_STATS_USER:
+ * VIR_NODE_CPU_STATS_USER:
  *
  * The cumulative CPU time which was spend by user processes,
  * since the node booting up (in nanoseconds).
  */
-#define VIR_CPU_STATS_USER "user"
+#define VIR_NODE_CPU_STATS_USER "user"
 
 /**
- * VIR_CPU_STATS_IDLE:
+ * VIR_NODE_CPU_STATS_IDLE:
  *
  * The cumulative idle CPU time,
  * since the node booting up (in nanoseconds).
  */
-#define VIR_CPU_STATS_IDLE "idle"
+#define VIR_NODE_CPU_STATS_IDLE "idle"
 
 /**
- * VIR_CPU_STATS_IOWAIT:
+ * VIR_NODE_CPU_STATS_IOWAIT:
  *
  * The cumulative I/O wait CPU time,
  * since the node booting up (in nanoseconds).
  */
-#define VIR_CPU_STATS_IOWAIT "iowait"
+#define VIR_NODE_CPU_STATS_IOWAIT "iowait"
 
 /**
- * VIR_CPU_STATS_UTILIZATION:
+ * VIR_NODE_CPU_STATS_UTILIZATION:
  *
  * The CPU utilization of a node.
  * The usage value is in percent and 100% represents all CPUs of
  * the node.
  */
-#define VIR_CPU_STATS_UTILIZATION "utilization"
+#define VIR_NODE_CPU_STATS_UTILIZATION "utilization"
 
 /**
- * virCPUStats:
+ * virNodeCPUStats:
  *
  * a virNodeCPUStats is a structure filled by virNodeGetCPUStats()
  * providing information about the CPU stats of the node.
  */
-typedef struct _virCPUStats virCPUStats;
+typedef struct _virNodeCPUStats virNodeCPUStats;
 
-struct _virCPUStats {
-    char field[VIR_CPU_STATS_FIELD_LENGTH];
+struct _virNodeCPUStats {
+    char field[VIR_NODE_CPU_STATS_FIELD_LENGTH];
     unsigned long long value;
 };
 
 /**
- * VIR_MEMORY_STATS_FIELD_LENGTH:
+ * VIR_NODE_MEMORY_STATS_FIELD_LENGTH:
  *
- * Macro providing the field length of virMemoryStats
+ * Macro providing the field length of virNodeMemoryStats
  */
-#define VIR_MEMORY_STATS_FIELD_LENGTH 80
+#define VIR_NODE_MEMORY_STATS_FIELD_LENGTH 80
 
 /**
- * VIR_MEMORY_STATS_ALL_CELLS:
+ * VIR_NODE_MEMORY_STATS_ALL_CELLS:
  *
  * Macro for the total memory of all cells.
  */
-#define VIR_MEMORY_STATS_ALL_CELLS (-1)
+#define VIR_NODE_MEMORY_STATS_ALL_CELLS (-1)
 
 /**
- * VIR_MEMORY_STATS_TOTAL:
+ * VIR_NODE_MEMORY_STATS_TOTAL:
  *
  * Macro for the total memory of specified cell:
  * it represents the maximum memory.
  */
-
-#define VIR_MEMORY_STATS_TOTAL "total"
+#define VIR_NODE_MEMORY_STATS_TOTAL "total"
 
 /**
- * VIR_MEMORY_STATS_FREE:
+ * VIR_NODE_MEMORY_STATS_FREE:
  *
  * Macro for the free memory of specified cell:
  * On Linux, it includes buffer and cached memory, in case of
- * VIR_MEMORY_STATS_ALL_CELLS.
+ * VIR_NODE_MEMORY_STATS_ALL_CELLS.
  */
-
-#define VIR_MEMORY_STATS_FREE "free"
+#define VIR_NODE_MEMORY_STATS_FREE "free"
 
 /**
- * VIR_MEMORY_STATS_BUFFERS:
+ * VIR_NODE_MEMORY_STATS_BUFFERS:
  *
  * Macro for the buffer memory: On Linux, it is only returned in case of
- * VIR_MEMORY_STATS_ALL_CELLS.
+ * VIR_NODE_MEMORY_STATS_ALL_CELLS.
  */
-
-#define VIR_MEMORY_STATS_BUFFERS "buffers"
+#define VIR_NODE_MEMORY_STATS_BUFFERS "buffers"
 
 /**
- * VIR_MEMORY_STATS_CACHED:
+ * VIR_NODE_MEMORY_STATS_CACHED:
  *
  * Macro for the cached memory: On Linux, it is only returned in case of
- * VIR_MEMORY_STATS_ALL_CELLS.
+ * VIR_NODE_MEMORY_STATS_ALL_CELLS.
  */
-
-#define VIR_MEMORY_STATS_CACHED "cached"
+#define VIR_NODE_MEMORY_STATS_CACHED "cached"
 
 /**
- * virMemoryStats:
+ * virNodeMemoryStats:
  *
- * a virMemoryStats is a structure filled by virNodeGetMemoryStats()
+ * a virNodeMemoryStats is a structure filled by virNodeGetMemoryStats()
  * providing information about the memory of the node.
  */
+typedef struct _virNodeMemoryStats virNodeMemoryStats;
 
-typedef struct _virMemoryStats virMemoryStats;
-
-struct _virMemoryStats {
-    char field[VIR_MEMORY_STATS_FIELD_LENGTH];
+struct _virNodeMemoryStats {
+    char field[VIR_NODE_MEMORY_STATS_FIELD_LENGTH];
     unsigned long long value;
 };
 
@@ -693,20 +688,20 @@ int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
 typedef virNodeInfo *virNodeInfoPtr;
 
 /**
- * virCPUStatsPtr:
+ * virNodeCPUStatsPtr:
  *
- * a virCPUStatsPtr is a pointer to a virCPUStats structure.
+ * a virNodeCPUStatsPtr is a pointer to a virNodeCPUStats structure.
  */
 
-typedef virCPUStats *virCPUStatsPtr;
+typedef virNodeCPUStats *virNodeCPUStatsPtr;
 
 /**
- * virMemoryStatsPtr:
+ * virNodeMemoryStatsPtr:
  *
- * a virMemoryStatsPtr is a pointer to a virMemoryStats structure.
+ * a virNodeMemoryStatsPtr is a pointer to a virNodeMemoryStats structure.
  */
 
-typedef virMemoryStats *virMemoryStatsPtr;
+typedef virNodeMemoryStats *virNodeMemoryStatsPtr;
 
 /**
  * virConnectFlags
@@ -844,13 +839,13 @@ char *                  virConnectGetCapabilities (virConnectPtr conn);
 
 int                     virNodeGetCPUStats (virConnectPtr conn,
                                             int cpuNum,
-                                            virCPUStatsPtr params,
+                                            virNodeCPUStatsPtr params,
                                             int *nparams,
                                             unsigned int flags);
 
 int                     virNodeGetMemoryStats (virConnectPtr conn,
                                                int cellNum,
-                                               virMemoryStatsPtr params,
+                                               virNodeMemoryStatsPtr params,
                                                int *nparams,
                                                unsigned int flags);
 
diff --git a/src/driver.h b/src/driver.h
index d45575a..5fd2433 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -380,7 +380,7 @@ typedef int
     (*virDrvNodeGetCPUStats)
                     (virConnectPtr conn,
                      int cpuNum,
-                     virCPUStatsPtr params,
+                     virNodeCPUStatsPtr params,
                      int *nparams,
                      unsigned int flags);
 
@@ -388,7 +388,7 @@ typedef int
     (*virDrvNodeGetMemoryStats)
                     (virConnectPtr conn,
                      int cellNum,
-                     virMemoryStatsPtr params,
+                     virNodeMemoryStatsPtr params,
                      int *nparams,
                      unsigned int flags);
 
diff --git a/src/libvirt.c b/src/libvirt.c
index 36a90d1..1f4730d 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5287,7 +5287,7 @@ error:
 /**
  * virNodeGetCPUStats:
  * @conn: pointer to the hypervisor connection.
- * @cpuNum: number of node cpu. (VIR_CPU_STATS_ALL_CPUS means total cpu
+ * @cpuNum: number of node cpu. (VIR_NODE_CPU_STATS_ALL_CPUS means total cpu
  *          statistics)
  * @params: pointer to node cpu time parameter objects
  * @nparams: number of node cpu time parameter (this value should be same or
@@ -5296,23 +5296,23 @@ error:
  *
  * This function provides individual cpu statistics of the node.
  * If you want to get total cpu statistics of the node, you must specify
- * VIR_CPU_STATS_ALL_CPUS to @cpuNum.
+ * VIR_NODE_CPU_STATS_ALL_CPUS to @cpuNum.
  * The @params array will be filled with the values equal to the number of
  * parameters suggested by @nparams
  *
  * As the value of @nparams is dynamic, call the API setting @nparams to 0 and
  * @params as NULL, the API returns the number of parameters supported by the
  * HV by updating @nparams on SUCCESS. The caller should then allocate @params
- * array, i.e. (sizeof(@virCPUStats) * @nparams) bytes and call
+ * array, i.e. (sizeof(@virNodeCPUStats) * @nparams) bytes and call
  * the API again.
  *
  * Here is a sample code snippet:
  *
  * if ((virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0) &&
  *     (nparams != 0)) {
- *     if ((params = malloc(sizeof(virCPUStats) * nparams)) == NULL)
+ *     if ((params = malloc(sizeof(virNodeCPUStats) * nparams)) == NULL)
  *         goto error;
- *     memset(params, 0, sizeof(virCPUStats) * nparams);
+ *     memset(params, 0, sizeof(virNodeCPUStats) * nparams);
  *     if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0))
  *         goto error;
  * }
@@ -5340,7 +5340,7 @@ error:
  */
 int virNodeGetCPUStats (virConnectPtr conn,
                         int cpuNum,
-                        virCPUStatsPtr params,
+                        virNodeCPUStatsPtr params,
                         int *nparams, unsigned int flags)
 {
     VIR_DEBUG("conn=%p, cpuNum=%d, params=%p, nparams=%d, flags=%u",
@@ -5355,7 +5355,7 @@ int virNodeGetCPUStats (virConnectPtr conn,
     }
 
     if ((nparams == NULL) || (*nparams < 0) ||
-        ((cpuNum < 0) && (cpuNum != VIR_CPU_STATS_ALL_CPUS))) {
+        ((cpuNum < 0) && (cpuNum != VIR_NODE_CPU_STATS_ALL_CPUS))) {
         virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         goto error;
     }
@@ -5377,8 +5377,8 @@ error:
 /**
  * virNodeGetMemoryStats:
  * @conn: pointer to the hypervisor connection.
- * @cellNum: number of node cell. (VIR_MEMORY_STATS_ALL_CELLS means total cell
- *           statistics)
+ * @cellNum: number of node cell. (VIR_NODE_MEMORY_STATS_ALL_CELLS means total
+ *           cell statistics)
  * @params: pointer to node memory stats objects
  * @nparams: number of node memory stats (this value should be same or
  *          less than the number of stats supported)
@@ -5386,23 +5386,23 @@ error:
  *
  * This function provides memory stats of the node.
  * If you want to get total cpu statistics of the node, you must specify
- * VIR_MEMORY_STATS_ALL_CELLS to @cellNum.
+ * VIR_NODE_MEMORY_STATS_ALL_CELLS to @cellNum.
  * The @params array will be filled with the values equal to the number of
  * stats suggested by @nparams
  *
  * As the value of @nparams is dynamic, call the API setting @nparams to 0 and
  * @params as NULL, the API returns the number of parameters supported by the
  * HV by updating @nparams on SUCCESS. The caller should then allocate @params
- * array, i.e. (sizeof(@virMemoryStats) * @nparams) bytes and call
+ * array, i.e. (sizeof(@virNodeMemoryStats) * @nparams) bytes and call
  * the API again.
  *
  * Here is the sample code snippet:
  *
  * if ((virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0) &&
  *     (nparams != 0)) {
- *     if ((params = malloc(sizeof(virMemoryStats) * nparams)) == NULL)
+ *     if ((params = malloc(sizeof(virNodeMemoryStats) * nparams)) == NULL)
  *         goto error;
- *     memset(params, cellNum, 0, sizeof(virMemoryStats) * nparams);
+ *     memset(params, cellNum, 0, sizeof(virNodeMemoryStats) * nparams);
  *     if (virNodeGetMemoryStats(conn, params, &nparams, 0))
  *         goto error;
  * }
@@ -5412,21 +5412,21 @@ error:
  *
  * Memory Stats:
  *
- * VIR_MEMORY_STATS_TOTAL:
+ * VIR_NODE_MEMORY_STATS_TOTAL:
  *     The total memory usage.(KB)
- * VIR_MEMORY_STATS_FREE:
+ * VIR_NODE_MEMORY_STATS_FREE:
  *     The free memory usage.(KB)
  *     On linux, this usage includes buffers and cached.
- * VIR_MEMORY_STATS_BUFFERS:
+ * VIR_NODE_MEMORY_STATS_BUFFERS:
  *     The buffers memory usage.(KB)
- * VIR_MEMORY_STATS_CACHED:
+ * VIR_NODE_MEMORY_STATS_CACHED:
  *     The cached memory usage.(KB)
  *
  * Returns -1 in case of error, 0 in case of success.
  */
 int virNodeGetMemoryStats (virConnectPtr conn,
                            int cellNum,
-                           virMemoryStatsPtr params,
+                           virNodeMemoryStatsPtr params,
                            int *nparams, unsigned int flags)
 {
     VIR_DEBUG("conn=%p, cellNum=%d, params=%p, nparams=%d, flags=%u",
@@ -5441,7 +5441,7 @@ int virNodeGetMemoryStats (virConnectPtr conn,
     }
 
     if ((nparams == NULL) || (*nparams < 0) ||
-        ((cellNum < 0) && (cellNum != VIR_MEMORY_STATS_ALL_CELLS))) {
+        ((cellNum < 0) && (cellNum != VIR_NODE_MEMORY_STATS_ALL_CELLS))) {
         virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         goto error;
     }
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index cb2f805..4620d93 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -72,11 +72,11 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
 
 static int linuxNodeGetCPUStats(FILE *procstat,
                                 int cpuNum,
-                                virCPUStatsPtr params,
+                                virNodeCPUStatsPtr params,
                                 int *nparams);
 static int linuxNodeGetMemoryStats(FILE *meminfo,
                                    int cellNum,
-                                   virMemoryStatsPtr params,
+                                   virNodeMemoryStatsPtr params,
                                    int *nparams);
 
 /* Return the positive decimal contents of the given
@@ -396,7 +396,7 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
 
 int linuxNodeGetCPUStats(FILE *procstat,
                          int cpuNum,
-                         virCPUStatsPtr params,
+                         virNodeCPUStatsPtr params,
                          int *nparams)
 {
     int ret = -1;
@@ -418,7 +418,7 @@ int linuxNodeGetCPUStats(FILE *procstat,
         goto cleanup;
     }
 
-    if (cpuNum == VIR_CPU_STATS_ALL_CPUS) {
+    if (cpuNum == VIR_NODE_CPU_STATS_ALL_CPUS) {
         strcpy(cpu_header, "cpu");
     } else {
         snprintf(cpu_header, sizeof(cpu_header), "cpu%d", cpuNum);
@@ -439,11 +439,11 @@ int linuxNodeGetCPUStats(FILE *procstat,
             }
 
             for (i = 0; i < *nparams; i++) {
-                virCPUStatsPtr param = &params[i];
+                virNodeCPUStatsPtr param = &params[i];
 
                 switch (i) {
                 case 0: /* fill kernel cpu time here */
-                    if (virStrcpyStatic(param->field, VIR_CPU_STATS_KERNEL) == NULL) {
+                    if (virStrcpyStatic(param->field, VIR_NODE_CPU_STATS_KERNEL) == NULL) {
                         nodeReportError(VIR_ERR_INTERNAL_ERROR,
                                         "%s", _("Field kernel cpu time too long for destination"));
                         goto cleanup;
@@ -452,7 +452,7 @@ int linuxNodeGetCPUStats(FILE *procstat,
                     break;
 
                 case 1: /* fill user cpu time here */
-                    if (virStrcpyStatic(param->field, VIR_CPU_STATS_USER) == NULL) {
+                    if (virStrcpyStatic(param->field, VIR_NODE_CPU_STATS_USER) == NULL) {
                         nodeReportError(VIR_ERR_INTERNAL_ERROR,
                                         "%s", _("Field kernel cpu time too long for destination"));
                         goto cleanup;
@@ -461,7 +461,7 @@ int linuxNodeGetCPUStats(FILE *procstat,
                     break;
 
                 case 2: /* fill idle cpu time here */
-                    if (virStrcpyStatic(param->field, VIR_CPU_STATS_IDLE) == NULL) {
+                    if (virStrcpyStatic(param->field, VIR_NODE_CPU_STATS_IDLE) == NULL) {
                         nodeReportError(VIR_ERR_INTERNAL_ERROR,
                                         "%s", _("Field kernel cpu time too long for destination"));
                         goto cleanup;
@@ -470,7 +470,7 @@ int linuxNodeGetCPUStats(FILE *procstat,
                     break;
 
                 case 3: /* fill iowait cpu time here */
-                    if (virStrcpyStatic(param->field, VIR_CPU_STATS_IOWAIT) == NULL) {
+                    if (virStrcpyStatic(param->field, VIR_NODE_CPU_STATS_IOWAIT) == NULL) {
                         nodeReportError(VIR_ERR_INTERNAL_ERROR,
                                         "%s", _("Field kernel cpu time too long for destination"));
                         goto cleanup;
@@ -496,7 +496,7 @@ cleanup:
 
 int linuxNodeGetMemoryStats(FILE *meminfo,
                             int cellNum,
-                            virMemoryStatsPtr params,
+                            virNodeMemoryStatsPtr params,
                             int *nparams)
 {
     int ret = -1;
@@ -504,20 +504,20 @@ int linuxNodeGetMemoryStats(FILE *meminfo,
     int found = 0;
     int nr_param;
     char line[1024];
-    char meminfo_hdr[VIR_MEMORY_STATS_FIELD_LENGTH];
+    char meminfo_hdr[VIR_NODE_MEMORY_STATS_FIELD_LENGTH];
     unsigned long val;
     struct field_conv {
         const char *meminfo_hdr;  // meminfo header
         const char *field;        // MemoryStats field name
     } field_conv[] = {
-        {"MemTotal:", VIR_MEMORY_STATS_TOTAL},
-        {"MemFree:",  VIR_MEMORY_STATS_FREE},
-        {"Buffers:",  VIR_MEMORY_STATS_BUFFERS},
-        {"Cached:",   VIR_MEMORY_STATS_CACHED},
+        {"MemTotal:", VIR_NODE_MEMORY_STATS_TOTAL},
+        {"MemFree:",  VIR_NODE_MEMORY_STATS_FREE},
+        {"Buffers:",  VIR_NODE_MEMORY_STATS_BUFFERS},
+        {"Cached:",   VIR_NODE_MEMORY_STATS_CACHED},
         {NULL,        NULL}
     };
 
-    if (cellNum == VIR_MEMORY_STATS_ALL_CELLS) {
+    if (cellNum == VIR_NODE_MEMORY_STATS_ALL_CELLS) {
         nr_param = LINUX_NB_MEMORY_STATS_ALL;
     } else {
         nr_param = LINUX_NB_MEMORY_STATS_CELL;
@@ -570,7 +570,7 @@ int linuxNodeGetMemoryStats(FILE *meminfo,
             struct field_conv *convp = &field_conv[j];
 
             if (STREQ(meminfo_hdr, convp->meminfo_hdr)) {
-                virMemoryStatsPtr param = &params[k++];
+                virNodeMemoryStatsPtr param = &params[k++];
 
                 if (virStrcpyStatic(param->field, convp->field) == NULL) {
                     nodeReportError(VIR_ERR_INTERNAL_ERROR,
@@ -637,7 +637,7 @@ int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
 
 int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
                     int cpuNum,
-                    virCPUStatsPtr params,
+                    virNodeCPUStatsPtr params,
                     int *nparams,
                     unsigned int flags)
 {
@@ -666,7 +666,7 @@ int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
 
 int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
                        int cellNum,
-                       virMemoryStatsPtr params,
+                       virNodeMemoryStatsPtr params,
                        int *nparams,
                        unsigned int flags)
 {
@@ -678,7 +678,7 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
         char *meminfo_path = NULL;
         FILE *meminfo;
 
-        if (cellNum == VIR_MEMORY_STATS_ALL_CELLS) {
+        if (cellNum == VIR_NODE_MEMORY_STATS_ALL_CELLS) {
             meminfo_path = strdup(MEMINFO_PATH);
             if (!meminfo_path) {
                 virReportOOMError();
diff --git a/src/nodeinfo.h b/src/nodeinfo.h
index 1ebcdb1..9b2658f 100644
--- a/src/nodeinfo.h
+++ b/src/nodeinfo.h
@@ -32,12 +32,12 @@ int nodeCapsInitNUMA(virCapsPtr caps);
 
 int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
                     int cpuNum,
-                    virCPUStatsPtr params,
+                    virNodeCPUStatsPtr params,
                     int *nparams,
                     unsigned int flags ATTRIBUTE_UNUSED);
 int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
                        int cellNum,
-                       virMemoryStatsPtr params,
+                       virNodeMemoryStatsPtr params,
                        int *nparams,
                        unsigned int flags ATTRIBUTE_UNUSED);
 int nodeGetCellsFreeMemory(virConnectPtr conn,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index f4b43e0..6b74bb5 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1699,7 +1699,7 @@ done:
 static int
 remoteNodeGetCPUStats (virConnectPtr conn,
                        int cpuNum,
-                       virCPUStatsPtr params, int *nparams,
+                       virNodeCPUStatsPtr params, int *nparams,
                        unsigned int flags)
 {
     int rv = -1;
@@ -1765,7 +1765,7 @@ done:
 static int
 remoteNodeGetMemoryStats (virConnectPtr conn,
                           int cellNum,
-                          virMemoryStatsPtr params, int *nparams,
+                          virNodeMemoryStatsPtr params, int *nparams,
                           unsigned int flags)
 {
     int rv = -1;
diff --git a/tools/virsh.c b/tools/virsh.c
index 19db058..43b4bd3 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3734,8 +3734,8 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
     int i, j;
     bool flag_utilization = false;
     bool flag_percent = vshCommandOptBool(cmd, "percent");
-    int cpuNum = VIR_CPU_STATS_ALL_CPUS;
-    virCPUStatsPtr params;
+    int cpuNum = VIR_NODE_CPU_STATS_ALL_CPUS;
+    virNodeCPUStatsPtr params;
     int nparams = 0;
     bool ret = false;
     struct cpu_stats {
@@ -3779,15 +3779,15 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
         for (j = 0; j < nparams; j++) {
             unsigned long long value = params[j].value;
 
-            if (STREQ(params[j].field, VIR_CPU_STATS_KERNEL)) {
+            if (STREQ(params[j].field, VIR_NODE_CPU_STATS_KERNEL)) {
                 cpu_stats[i].sys = value;
-            } else if (STREQ(params[j].field, VIR_CPU_STATS_USER)) {
+            } else if (STREQ(params[j].field, VIR_NODE_CPU_STATS_USER)) {
                 cpu_stats[i].user = value;
-            } else if (STREQ(params[j].field, VIR_CPU_STATS_IDLE)) {
+            } else if (STREQ(params[j].field, VIR_NODE_CPU_STATS_IDLE)) {
                 cpu_stats[i].idle = value;
-            } else if (STREQ(params[j].field, VIR_CPU_STATS_IOWAIT)) {
+            } else if (STREQ(params[j].field, VIR_NODE_CPU_STATS_IOWAIT)) {
                 cpu_stats[i].iowait = value;
-            } else if (STREQ(params[j].field, VIR_CPU_STATS_UTILIZATION)) {
+            } else if (STREQ(params[j].field, VIR_NODE_CPU_STATS_UTILIZATION)) {
                 cpu_stats[i].util = value;
                 flag_utilization = true;
             }
@@ -3861,8 +3861,8 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd)
 {
     int nparams = 0;
     unsigned int i = 0;
-    int cellNum = VIR_MEMORY_STATS_ALL_CELLS;
-    virMemoryStatsPtr params = NULL;
+    int cellNum = VIR_NODE_MEMORY_STATS_ALL_CELLS;
+    virNodeMemoryStatsPtr params = NULL;
     bool ret = false;
 
     if (!vshConnectionUsability(ctl, ctl->conn))
-- 
1.7.0.4




More information about the libvir-list mailing list