rename virBlkioDeviceWeightPtr to virBlkioDevicePtr

The throttle blkio cgroup will reuse this struct.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
This commit is contained in:
Gao feng 2013-12-11 16:29:48 +08:00 committed by Daniel P. Berrange
parent b4710669c3
commit b9ce5d388f
5 changed files with 30 additions and 30 deletions

View File

@ -882,13 +882,13 @@ virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
void void
virBlkioDeviceArrayClear(virBlkioDeviceWeightPtr deviceWeights, virBlkioDeviceArrayClear(virBlkioDevicePtr devices,
int ndevices) int ndevices)
{ {
size_t i; size_t i;
for (i = 0; i < ndevices; i++) for (i = 0; i < ndevices; i++)
VIR_FREE(deviceWeights[i].path); VIR_FREE(devices[i].path);
} }
/** /**
@ -901,11 +901,11 @@ virBlkioDeviceArrayClear(virBlkioDeviceWeightPtr deviceWeights,
* <weight>weight</weight> * <weight>weight</weight>
* </device> * </device>
* *
* and fills a virBlkioDeviceWeight struct. * and fills a virBlkioDeviceTune struct.
*/ */
static int static int
virDomainBlkioDeviceParseXML(xmlNodePtr root, virDomainBlkioDeviceParseXML(xmlNodePtr root,
virBlkioDeviceWeightPtr dw) virBlkioDevicePtr dev)
{ {
char *c; char *c;
xmlNodePtr node; xmlNodePtr node;
@ -913,16 +913,16 @@ virDomainBlkioDeviceParseXML(xmlNodePtr root,
node = root->children; node = root->children;
while (node) { while (node) {
if (node->type == XML_ELEMENT_NODE) { if (node->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(node->name, BAD_CAST "path") && !dw->path) { if (xmlStrEqual(node->name, BAD_CAST "path") && !dev->path) {
dw->path = (char *)xmlNodeGetContent(node); dev->path = (char *)xmlNodeGetContent(node);
} else if (xmlStrEqual(node->name, BAD_CAST "weight")) { } else if (xmlStrEqual(node->name, BAD_CAST "weight")) {
c = (char *)xmlNodeGetContent(node); c = (char *)xmlNodeGetContent(node);
if (virStrToLong_ui(c, NULL, 10, &dw->weight) < 0) { if (virStrToLong_ui(c, NULL, 10, &dev->weight) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("could not parse weight %s"), _("could not parse weight %s"),
c); c);
VIR_FREE(c); VIR_FREE(c);
VIR_FREE(dw->path); VIR_FREE(dev->path);
return -1; return -1;
} }
VIR_FREE(c); VIR_FREE(c);
@ -930,7 +930,7 @@ virDomainBlkioDeviceParseXML(xmlNodePtr root,
} }
node = node->next; node = node->next;
} }
if (!dw->path) { if (!dev->path) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("missing per-device path")); _("missing per-device path"));
return -1; return -1;

View File

@ -1860,9 +1860,9 @@ virDomainVcpuPinDefPtr virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
int nvcpupin, int nvcpupin,
int vcpu); int vcpu);
typedef struct _virBlkioDeviceWeight virBlkioDeviceWeight; typedef struct _virBlkioDevice virBlkioDevice;
typedef virBlkioDeviceWeight *virBlkioDeviceWeightPtr; typedef virBlkioDevice *virBlkioDevicePtr;
struct _virBlkioDeviceWeight { struct _virBlkioDevice {
char *path; char *path;
unsigned int weight; unsigned int weight;
}; };
@ -1911,7 +1911,7 @@ struct _virDomainIdMapDef {
}; };
void virBlkioDeviceArrayClear(virBlkioDeviceWeightPtr deviceWeights, void virBlkioDeviceArrayClear(virBlkioDevicePtr deviceWeights,
int ndevices); int ndevices);
typedef struct _virDomainResourceDef virDomainResourceDef; typedef struct _virDomainResourceDef virDomainResourceDef;
@ -1940,7 +1940,7 @@ struct _virDomainDef {
unsigned int weight; unsigned int weight;
size_t ndevices; size_t ndevices;
virBlkioDeviceWeightPtr devices; virBlkioDevicePtr devices;
} blkio; } blkio;
struct { struct {

View File

@ -112,10 +112,10 @@ static int virLXCCgroupSetupBlkioTune(virDomainDefPtr def,
if (def->blkio.ndevices) { if (def->blkio.ndevices) {
for (i = 0; i < def->blkio.ndevices; i++) { for (i = 0; i < def->blkio.ndevices; i++) {
virBlkioDeviceWeightPtr dw = &def->blkio.devices[i]; virBlkioDevicePtr dev = &def->blkio.devices[i];
if (!dw->weight) if (!dev->weight)
continue; continue;
if (virCgroupSetBlkioDeviceWeight(cgroup, dw->path, dw->weight) < 0) if (virCgroupSetBlkioDeviceWeight(cgroup, dev->path, dev->weight) < 0)
return -1; return -1;
} }
} }

View File

@ -399,11 +399,11 @@ qemuSetupBlkioCgroup(virDomainObjPtr vm)
if (vm->def->blkio.ndevices) { if (vm->def->blkio.ndevices) {
for (i = 0; i < vm->def->blkio.ndevices; i++) { for (i = 0; i < vm->def->blkio.ndevices; i++) {
virBlkioDeviceWeightPtr dw = &vm->def->blkio.devices[i]; virBlkioDevicePtr dev = &vm->def->blkio.devices[i];
if (!dw->weight) if (!dev->weight)
continue; continue;
if (virCgroupSetBlkioDeviceWeight(priv->cgroup, dw->path, if (virCgroupSetBlkioDeviceWeight(priv->cgroup, dev->path,
dw->weight) < 0) dev->weight) < 0)
return -1; return -1;
} }
} }

View File

@ -7432,15 +7432,15 @@ cleanup:
*/ */
static int static int
qemuDomainParseDeviceWeightStr(char *deviceWeightStr, qemuDomainParseDeviceWeightStr(char *deviceWeightStr,
virBlkioDeviceWeightPtr *dw, size_t *size) virBlkioDevicePtr *dev, size_t *size)
{ {
char *temp; char *temp;
int ndevices = 0; int ndevices = 0;
int nsep = 0; int nsep = 0;
size_t i; size_t i;
virBlkioDeviceWeightPtr result = NULL; virBlkioDevicePtr result = NULL;
*dw = NULL; *dev = NULL;
*size = 0; *size = 0;
if (STREQ(deviceWeightStr, "")) if (STREQ(deviceWeightStr, ""))
@ -7496,7 +7496,7 @@ qemuDomainParseDeviceWeightStr(char *deviceWeightStr,
if (!i) if (!i)
VIR_FREE(result); VIR_FREE(result);
*dw = result; *dev = result;
*size = i; *size = i;
return 0; return 0;
@ -7513,13 +7513,13 @@ cleanup:
/* Modify dest_array to reflect all device weight changes described in /* Modify dest_array to reflect all device weight changes described in
* src_array. */ * src_array. */
static int static int
qemuDomainMergeDeviceWeights(virBlkioDeviceWeightPtr *dest_array, qemuDomainMergeDeviceWeights(virBlkioDevicePtr *dest_array,
size_t *dest_size, size_t *dest_size,
virBlkioDeviceWeightPtr src_array, virBlkioDevicePtr src_array,
size_t src_size) size_t src_size)
{ {
size_t i, j; size_t i, j;
virBlkioDeviceWeightPtr dest, src; virBlkioDevicePtr dest, src;
for (i = 0; i < src_size; i++) { for (i = 0; i < src_size; i++) {
bool found = false; bool found = false;
@ -7614,7 +7614,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
ret = -1; ret = -1;
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) { } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) {
size_t ndevices; size_t ndevices;
virBlkioDeviceWeightPtr devices = NULL; virBlkioDevicePtr devices = NULL;
size_t j; size_t j;
if (qemuDomainParseDeviceWeightStr(params[i].value.s, if (qemuDomainParseDeviceWeightStr(params[i].value.s,
@ -7660,7 +7660,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
persistentDef->blkio.weight = params[i].value.ui; persistentDef->blkio.weight = params[i].value.ui;
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) { } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) {
virBlkioDeviceWeightPtr devices = NULL; virBlkioDevicePtr devices = NULL;
size_t ndevices; size_t ndevices;
if (qemuDomainParseDeviceWeightStr(params[i].value.s, if (qemuDomainParseDeviceWeightStr(params[i].value.s,