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
virBlkioDeviceArrayClear(virBlkioDeviceWeightPtr deviceWeights,
virBlkioDeviceArrayClear(virBlkioDevicePtr devices,
int ndevices)
{
size_t 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>
* </device>
*
* and fills a virBlkioDeviceWeight struct.
* and fills a virBlkioDeviceTune struct.
*/
static int
virDomainBlkioDeviceParseXML(xmlNodePtr root,
virBlkioDeviceWeightPtr dw)
virBlkioDevicePtr dev)
{
char *c;
xmlNodePtr node;
@ -913,16 +913,16 @@ virDomainBlkioDeviceParseXML(xmlNodePtr root,
node = root->children;
while (node) {
if (node->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(node->name, BAD_CAST "path") && !dw->path) {
dw->path = (char *)xmlNodeGetContent(node);
if (xmlStrEqual(node->name, BAD_CAST "path") && !dev->path) {
dev->path = (char *)xmlNodeGetContent(node);
} else if (xmlStrEqual(node->name, BAD_CAST "weight")) {
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,
_("could not parse weight %s"),
c);
VIR_FREE(c);
VIR_FREE(dw->path);
VIR_FREE(dev->path);
return -1;
}
VIR_FREE(c);
@ -930,7 +930,7 @@ virDomainBlkioDeviceParseXML(xmlNodePtr root,
}
node = node->next;
}
if (!dw->path) {
if (!dev->path) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("missing per-device path"));
return -1;

View File

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

View File

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

View File

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

View File

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