conf: use a unique data type for PF array in virDomainNetDef

This array was originally defined using the existing
virNetworkForwardIfDef, but that struct has a UsageCount field that
isn't used in the case of PFs. This patch just copies that struct and
removes UsageCount. It ends up being a struct with a single field, but
I left it as a struct in case we need to add other fields to it in the
future.
This commit is contained in:
Laine Stump 2012-08-05 02:32:49 -04:00
parent c606671aaa
commit 95ae4e7fa3
2 changed files with 14 additions and 3 deletions

View File

@ -97,6 +97,12 @@ virNetworkForwardIfDefClear(virNetworkForwardIfDefPtr def)
VIR_FREE(def->dev);
}
static void
virNetworkForwardPfDefClear(virNetworkForwardPfDefPtr def)
{
VIR_FREE(def->dev);
}
static void virNetworkIpDefClear(virNetworkIpDefPtr def)
{
int ii;
@ -157,7 +163,7 @@ void virNetworkDefFree(virNetworkDefPtr def)
VIR_FREE(def->domain);
for (ii = 0 ; ii < def->nForwardPfs && def->forwardPfs ; ii++) {
virNetworkForwardIfDefClear(&def->forwardPfs[ii]);
virNetworkForwardPfDefClear(&def->forwardPfs[ii]);
}
VIR_FREE(def->forwardPfs);
@ -1113,7 +1119,6 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error;
}
def->forwardPfs->usageCount = 0;
def->forwardPfs->dev = forwardDev;
forwardDev = NULL;
def->nForwardPfs++;

View File

@ -135,6 +135,12 @@ struct _virNetworkForwardIfDef {
int usageCount; /* how many guest interfaces are bound to this device? */
};
typedef struct _virNetworkForwardPfDef virNetworkForwardPfDef;
typedef virNetworkForwardPfDef *virNetworkForwardPfDefPtr;
struct _virNetworkForwardPfDef {
char *dev; /* name of device */
};
typedef struct _virPortGroupDef virPortGroupDef;
typedef virPortGroupDef *virPortGroupDefPtr;
struct _virPortGroupDef {
@ -164,7 +170,7 @@ struct _virNetworkDef {
* interfaces), they will be listed here.
*/
size_t nForwardPfs;
virNetworkForwardIfDefPtr forwardPfs;
virNetworkForwardPfDefPtr forwardPfs;
size_t nForwardIfs;
virNetworkForwardIfDefPtr forwardIfs;