提交 d6089632 编写于 作者: D Daniel P. Berrangé

nwfilter: remove virNWFilterHashTable typedefs entirely

All the code now just uses the virHashTablePtr type directly.
Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 1cf16d75
......@@ -10869,7 +10869,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
char *vhostuser_type = NULL;
char *trustGuestRxFilters = NULL;
char *vhost_path = NULL;
virNWFilterHashTablePtr filterparams = NULL;
virHashTablePtr filterparams = NULL;
virDomainActualNetDefPtr actual = NULL;
xmlNodePtr oldnode = ctxt->node;
virDomainChrSourceReconnectDef reconnect = {0};
......
......@@ -1054,7 +1054,7 @@ struct _virDomainNetDef {
virNetDevIPInfo guestIP;
virDomainDeviceInfo info;
char *filter;
virNWFilterHashTablePtr filterparams;
virHashTablePtr filterparams;
virNetDevBandwidthPtr bandwidth;
virNetDevVlan vlan;
int trustGuestRxFilters; /* enum virTristateBool */
......
......@@ -501,7 +501,7 @@ typedef struct _virNWFilterIncludeDef virNWFilterIncludeDef;
typedef virNWFilterIncludeDef *virNWFilterIncludeDefPtr;
struct _virNWFilterIncludeDef {
char *filterref;
virNWFilterHashTablePtr params;
virHashTablePtr params;
};
......
......@@ -36,7 +36,7 @@
#define VIR_FROM_THIS VIR_FROM_NWFILTER
static virMutex ipAddressMapLock = VIR_MUTEX_INITIALIZER;
static virNWFilterHashTablePtr ipAddressMap;
static virHashTablePtr ipAddressMap;
/* Add an IP address to the list of IP addresses an interface is
......
......@@ -348,7 +348,7 @@ virNWFilterVarCombIterEntryInit(virNWFilterVarCombIterEntryPtr cie,
static int
virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
virNWFilterHashTablePtr hash,
virHashTablePtr hash,
const virNWFilterVarAccess *varAccess)
{
virNWFilterVarValuePtr varValue;
......@@ -415,7 +415,7 @@ virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
*/
static bool
virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
virNWFilterHashTablePtr hash)
virHashTablePtr hash)
{
size_t i, j;
virNWFilterVarValuePtr varValue, tmp;
......@@ -473,7 +473,7 @@ virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
* be created.
*/
virNWFilterVarCombIterPtr
virNWFilterVarCombIterCreate(virNWFilterHashTablePtr hash,
virNWFilterVarCombIterCreate(virHashTablePtr hash,
virNWFilterVarAccessPtr *varAccess,
size_t nVarAccess)
{
......@@ -631,14 +631,14 @@ hashDataFree(void *payload, const void *name ATTRIBUTE_UNUSED)
}
virNWFilterHashTablePtr
virHashTablePtr
virNWFilterHashTableCreate(int n)
{
return virHashCreate(n, hashDataFree);
}
struct addToTableStruct {
virNWFilterHashTablePtr target;
virHashTablePtr target;
int errOccurred;
};
......@@ -668,8 +668,8 @@ addToTable(void *payload, const void *name, void *data)
int
virNWFilterHashTablePutAll(virNWFilterHashTablePtr src,
virNWFilterHashTablePtr dest)
virNWFilterHashTablePutAll(virHashTablePtr src,
virHashTablePtr dest)
{
struct addToTableStruct atts = {
.target = dest,
......@@ -698,8 +698,8 @@ virNWFilterVarValueCompare(const void *a, const void *b)
}
bool
virNWFilterHashTableEqual(virNWFilterHashTablePtr a,
virNWFilterHashTablePtr b)
virNWFilterHashTableEqual(virHashTablePtr a,
virHashTablePtr b)
{
return virHashEqual(a, b, virNWFilterVarValueCompare);
}
......@@ -723,13 +723,13 @@ virNWFilterParseVarValue(const char *val)
return virNWFilterVarValueCreateSimpleCopyValue(val);
}
virNWFilterHashTablePtr
virHashTablePtr
virNWFilterParseParamAttributes(xmlNodePtr cur)
{
char *nam, *val;
virNWFilterVarValuePtr value;
virNWFilterHashTablePtr table = virNWFilterHashTableCreate(0);
virHashTablePtr table = virNWFilterHashTableCreate(0);
if (!table)
return NULL;
......@@ -791,7 +791,7 @@ virNWFilterFormatParameterNameSorter(const virHashKeyValuePair *a,
int
virNWFilterFormatParamAttributes(virBufferPtr buf,
virNWFilterHashTablePtr table,
virHashTablePtr table,
const char *filterref)
{
virHashKeyValuePairPtr items;
......@@ -1023,7 +1023,7 @@ virNWFilterVarAccessGetIntIterId(const virNWFilterVarAccess *vap)
bool
virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *varAccess,
const virNWFilterHashTable *hash)
const virHashTable *hash)
{
const char *varName = virNWFilterVarAccessGetVarName(varAccess);
const char *res;
......
......@@ -63,19 +63,16 @@ int virNWFilterVarValueAddValue(virNWFilterVarValuePtr val, char *value);
int virNWFilterVarValueAddValueCopy(virNWFilterVarValuePtr val, const char *value);
int virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value);
typedef virHashTable virNWFilterHashTable;
typedef virHashTable *virNWFilterHashTablePtr;
virNWFilterHashTablePtr virNWFilterParseParamAttributes(xmlNodePtr cur);
virHashTablePtr virNWFilterParseParamAttributes(xmlNodePtr cur);
int virNWFilterFormatParamAttributes(virBufferPtr buf,
virNWFilterHashTablePtr table,
virHashTablePtr table,
const char *filterref);
virNWFilterHashTablePtr virNWFilterHashTableCreate(int n);
int virNWFilterHashTablePutAll(virNWFilterHashTablePtr src,
virNWFilterHashTablePtr dest);
bool virNWFilterHashTableEqual(virNWFilterHashTablePtr a,
virNWFilterHashTablePtr b);
virHashTablePtr virNWFilterHashTableCreate(int n);
int virNWFilterHashTablePutAll(virHashTablePtr src,
virHashTablePtr dest);
bool virNWFilterHashTableEqual(virHashTablePtr a,
virHashTablePtr b);
# define VALID_VARNAME \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
......@@ -123,7 +120,7 @@ virNWFilterVarAccessType virNWFilterVarAccessGetType(
unsigned int virNWFilterVarAccessGetIterId(const virNWFilterVarAccess *vap);
unsigned int virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap);
bool virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *vap,
const virNWFilterHashTable *hash);
const virHashTable *hash);
typedef struct _virNWFilterVarCombIterEntry virNWFilterVarCombIterEntry;
typedef virNWFilterVarCombIterEntry *virNWFilterVarCombIterEntryPtr;
......@@ -139,12 +136,12 @@ struct _virNWFilterVarCombIterEntry {
typedef struct _virNWFilterVarCombIter virNWFilterVarCombIter;
typedef virNWFilterVarCombIter *virNWFilterVarCombIterPtr;
struct _virNWFilterVarCombIter {
virNWFilterHashTablePtr hashTable;
virHashTablePtr hashTable;
size_t nIter;
virNWFilterVarCombIterEntry iter[0];
};
virNWFilterVarCombIterPtr virNWFilterVarCombIterCreate(
virNWFilterHashTablePtr hash,
virHashTablePtr hash,
virNWFilterVarAccessPtr *vars,
size_t nVars);
......
......@@ -141,7 +141,7 @@ struct _virNWFilterSnoopReq {
char ifkey[VIR_IFKEY_LEN];
virMacAddr macaddr;
char *filtername;
virNWFilterHashTablePtr vars;
virHashTablePtr vars;
virNWFilterDriverStatePtr driver;
/* start and end of lease list, ordered by lease time */
virNWFilterSnoopIPLeasePtr start;
......@@ -1611,7 +1611,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
const unsigned char *vmuuid,
const virMacAddr *macaddr,
const char *filtername,
virNWFilterHashTablePtr filterparams,
virHashTablePtr filterparams,
virNWFilterDriverStatePtr driver)
{
virNWFilterSnoopReqPtr req;
......@@ -2255,7 +2255,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
const unsigned char *vmuuid ATTRIBUTE_UNUSED,
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
const char *filtername ATTRIBUTE_UNUSED,
virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
virHashTablePtr filterparams ATTRIBUTE_UNUSED,
virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR,
......
......@@ -35,7 +35,7 @@ int virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
const unsigned char *vmuuid,
const virMacAddr *macaddr,
const char *filtername,
virNWFilterHashTablePtr filterparams,
virHashTablePtr filterparams,
virNWFilterDriverStatePtr driver);
void virNWFilterDHCPSnoopEnd(const char *ifname);
#endif /* __NWFILTER_DHCPSNOOP_H */
......@@ -142,7 +142,7 @@ virNWFilterRuleInstFree(virNWFilterRuleInstPtr inst)
* Adds a couple of standard keys (MAC, IP) to the hash table.
*/
static int
virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
virNWFilterVarHashmapAddStdValues(virHashTablePtr table,
char *macaddr,
const virNWFilterVarValue *ipaddr)
{
......@@ -191,11 +191,11 @@ virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
*
* Returns pointer to hashmap, NULL if an error occurred.
*/
virNWFilterHashTablePtr
virHashTablePtr
virNWFilterCreateVarHashmap(char *macaddr,
const virNWFilterVarValue *ipaddr)
{
virNWFilterHashTablePtr table = virNWFilterHashTableCreate(0);
virHashTablePtr table = virNWFilterHashTableCreate(0);
if (!table)
return NULL;
......@@ -208,7 +208,7 @@ virNWFilterCreateVarHashmap(char *macaddr,
/**
* Convert a virNWFilterHashTable into a string of comma-separated
* Convert a virHashTable into a string of comma-separated
* variable names.
*/
struct printString
......@@ -278,11 +278,11 @@ virNWFilterPrintVars(virHashTablePtr vars,
* Creates a new hash table with contents of var1 and var2 added where
* contents of var2 will overwrite those of var1.
*/
static virNWFilterHashTablePtr
virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
virNWFilterHashTablePtr vars2)
static virHashTablePtr
virNWFilterCreateVarsFrom(virHashTablePtr vars1,
virHashTablePtr vars2)
{
virNWFilterHashTablePtr res = virNWFilterHashTableCreate(0);
virHashTablePtr res = virNWFilterHashTableCreate(0);
if (!res)
return NULL;
......@@ -330,7 +330,7 @@ virNWFilterInstReset(virNWFilterInstPtr inst)
static int
virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
virNWFilterDefPtr def,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
enum instCase useNewFilter,
bool *foundNewFilter,
virNWFilterInstPtr inst);
......@@ -338,7 +338,7 @@ virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
static int
virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
virNWFilterRuleDefPtr rule,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
virNWFilterInstPtr inst)
{
virNWFilterRuleInstPtr ruleinst;
......@@ -371,13 +371,13 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
static int
virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
virNWFilterIncludeDefPtr inc,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
enum instCase useNewFilter,
bool *foundNewFilter,
virNWFilterInstPtr inst)
{
virNWFilterObjPtr obj;
virNWFilterHashTablePtr tmpvars = NULL;
virHashTablePtr tmpvars = NULL;
virNWFilterDefPtr childdef;
virNWFilterDefPtr newChilddef;
int ret = -1;
......@@ -452,7 +452,7 @@ virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
static int
virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
virNWFilterDefPtr def,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
enum instCase useNewFilter,
bool *foundNewFilter,
virNWFilterInstPtr inst)
......@@ -487,8 +487,8 @@ virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
static int
virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
virNWFilterHashTablePtr vars,
virNWFilterHashTablePtr missing_vars,
virHashTablePtr vars,
virHashTablePtr missing_vars,
int useNewFilter,
virNWFilterDriverStatePtr driver)
{
......@@ -498,7 +498,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
virNWFilterDefPtr next_filter;
virNWFilterDefPtr newNext_filter;
virNWFilterVarValuePtr val;
virNWFilterHashTablePtr tmpvars;
virHashTablePtr tmpvars;
for (i = 0; i < filter->nentries; i++) {
virNWFilterRuleDefPtr rule = filter->filterEntries[i]->rule;
......@@ -600,7 +600,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
const char *ifname,
int ifindex,
const char *linkdev,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
enum instCase useNewFilter,
bool *foundNewFilter,
bool teardownOld,
......@@ -616,7 +616,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
const char *learning;
bool reportIP = false;
virNWFilterHashTablePtr missing_vars = virNWFilterHashTableCreate(0);
virHashTablePtr missing_vars = virNWFilterHashTableCreate(0);
memset(&inst, 0, sizeof(inst));
......@@ -754,7 +754,7 @@ virNWFilterInstantiateFilterUpdate(virNWFilterDriverStatePtr driver,
const char *linkdev,
const virMacAddr *macaddr,
const char *filtername,
virNWFilterHashTablePtr filterparams,
virHashTablePtr filterparams,
enum instCase useNewFilter,
bool forceWithPendingReq,
bool *foundNewFilter)
......@@ -763,7 +763,7 @@ virNWFilterInstantiateFilterUpdate(virNWFilterDriverStatePtr driver,
const char *drvname = EBIPTABLES_DRIVER_ID;
virNWFilterTechDriverPtr techdriver;
virNWFilterObjPtr obj;
virNWFilterHashTablePtr vars, vars1;
virHashTablePtr vars, vars1;
virNWFilterDefPtr filter;
virNWFilterDefPtr newFilter;
char vmmacaddr[VIR_MAC_STRING_BUFLEN] = {0};
......@@ -896,7 +896,7 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
const char *linkdev,
const virMacAddr *macaddr,
const char *filtername,
virNWFilterHashTablePtr filterparams)
virHashTablePtr filterparams)
{
int rc;
bool foundNewFilter = false;
......
......@@ -53,12 +53,12 @@ int virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
const char *linkdev,
const virMacAddr *macaddr,
const char *filtername,
virNWFilterHashTablePtr filterparams);
virHashTablePtr filterparams);
int virNWFilterTeardownFilter(const virDomainNetDef *net);
virNWFilterHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
const virNWFilterVarValue *value);
virHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
const virNWFilterVarValue *value);
int virNWFilterDomainFWUpdateCB(virDomainObjPtr vm,
void *data);
......
......@@ -692,14 +692,14 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
const char *linkdev,
const virMacAddr *macaddr,
const char *filtername,
virNWFilterHashTablePtr filterparams,
virHashTablePtr filterparams,
virNWFilterDriverStatePtr driver,
enum howDetect howDetect)
{
int rc;
virThread thread;
virNWFilterIPAddrLearnReqPtr req = NULL;
virNWFilterHashTablePtr ht = NULL;
virHashTablePtr ht = NULL;
if (howDetect == 0)
return -1;
......@@ -781,7 +781,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
const char *linkdev ATTRIBUTE_UNUSED,
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
const char *filtername ATTRIBUTE_UNUSED,
virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
virHashTablePtr filterparams ATTRIBUTE_UNUSED,
virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED,
enum howDetect howDetect ATTRIBUTE_UNUSED)
{
......
......@@ -44,7 +44,7 @@ struct _virNWFilterIPAddrLearnReq {
char linkdev[IF_NAMESIZE];
virMacAddr macaddr;
char *filtername;
virNWFilterHashTablePtr filterparams;
virHashTablePtr filterparams;
virNWFilterDriverStatePtr driver;
enum howDetect howDetect;
......@@ -58,7 +58,7 @@ int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
const char *linkdev,
const virMacAddr *macaddr,
const char *filtername,
virNWFilterHashTablePtr filterparams,
virHashTablePtr filterparams,
virNWFilterDriverStatePtr driver,
enum howDetect howDetect);
......
......@@ -39,7 +39,7 @@ struct _virNWFilterRuleInst {
virNWFilterChainPriority chainPriority;
virNWFilterRuleDefPtr def;
virNWFilterRulePriority priority;
virNWFilterHashTablePtr vars;
virHashTablePtr vars;
};
......
......@@ -147,11 +147,11 @@ static const char *commonRules[] = {
};
static virNWFilterHashTablePtr
virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
virNWFilterHashTablePtr vars2)
static virHashTablePtr
virNWFilterCreateVarsFrom(virHashTablePtr vars1,
virHashTablePtr vars2)
{
virNWFilterHashTablePtr res = virNWFilterHashTableCreate(0);
virHashTablePtr res = virNWFilterHashTableCreate(0);
if (!res)
return NULL;
......@@ -199,13 +199,13 @@ virNWFilterInstReset(virNWFilterInstPtr inst)
static int
virNWFilterDefToInst(const char *xml,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
virNWFilterInstPtr inst);
static int
virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
virNWFilterRuleDefPtr rule,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
virNWFilterInstPtr inst)
{
virNWFilterRuleInstPtr ruleinst;
......@@ -238,10 +238,10 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
static int
virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDefPtr inc,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
virNWFilterInstPtr inst)
{
virNWFilterHashTablePtr tmpvars = NULL;
virHashTablePtr tmpvars = NULL;
int ret = -1;
char *xml;
......@@ -270,7 +270,7 @@ virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDefPtr inc,
static int
virNWFilterDefToInst(const char *xml,
virNWFilterHashTablePtr vars,
virHashTablePtr vars,
virNWFilterInstPtr inst)
{
size_t i;
......@@ -326,7 +326,7 @@ static void testRemoveCommonRules(char *rules)
}
static int testSetOneParameter(virNWFilterHashTablePtr vars,
static int testSetOneParameter(virHashTablePtr vars,
const char *name,
const char *value)
{
......@@ -350,7 +350,7 @@ static int testSetOneParameter(virNWFilterHashTablePtr vars,
return ret;
}
static int testSetDefaultParameters(virNWFilterHashTablePtr vars)
static int testSetDefaultParameters(virHashTablePtr vars)
{
if (testSetOneParameter(vars, "IPSETNAME", "tck_test") < 0 ||
testSetOneParameter(vars, "A", "1.1.1.1") ||
......@@ -374,7 +374,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
{
char *actualargv = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
virNWFilterHashTablePtr vars = virNWFilterHashTableCreate(0);
virHashTablePtr vars = virNWFilterHashTableCreate(0);
virNWFilterInst inst;
int ret = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册