conf: Use consistent function name prefixes for virinterfaceobj

Use "virInterfaceObj" as a prefix for any external API in virinterfaceobj
This commit is contained in:
John Ferlan 2017-03-02 11:56:43 -05:00
parent 7e702a862d
commit e858232e4d
4 changed files with 35 additions and 40 deletions

View File

@ -64,9 +64,9 @@ virInterfaceObjFree(virInterfaceObjPtr iface)
/* virInterfaceObjList manipulation */ /* virInterfaceObjList manipulation */
int int
virInterfaceFindByMACString(virInterfaceObjListPtr interfaces, virInterfaceObjFindByMACString(virInterfaceObjListPtr interfaces,
const char *mac, const char *mac,
virInterfaceObjPtr *matches, int maxmatches) virInterfaceObjPtr *matches, int maxmatches)
{ {
size_t i; size_t i;
unsigned int matchct = 0; unsigned int matchct = 0;
@ -91,8 +91,8 @@ virInterfaceFindByMACString(virInterfaceObjListPtr interfaces,
virInterfaceObjPtr virInterfaceObjPtr
virInterfaceFindByName(virInterfaceObjListPtr interfaces, virInterfaceObjFindByName(virInterfaceObjListPtr interfaces,
const char *name) const char *name)
{ {
size_t i; size_t i;
@ -148,9 +148,9 @@ virInterfaceObjListClone(virInterfaceObjListPtr src,
} }
VIR_FREE(xml); VIR_FREE(xml);
if ((iface = virInterfaceAssignDef(dest, backup)) == NULL) if ((iface = virInterfaceObjAssignDef(dest, backup)) == NULL)
goto cleanup; goto cleanup;
virInterfaceObjUnlock(iface); /* was locked by virInterfaceAssignDef */ virInterfaceObjUnlock(iface); /* locked by virInterfaceObjAssignDef */
} }
ret = cnt; ret = cnt;
@ -162,12 +162,12 @@ virInterfaceObjListClone(virInterfaceObjListPtr src,
virInterfaceObjPtr virInterfaceObjPtr
virInterfaceAssignDef(virInterfaceObjListPtr interfaces, virInterfaceObjAssignDef(virInterfaceObjListPtr interfaces,
virInterfaceDefPtr def) virInterfaceDefPtr def)
{ {
virInterfaceObjPtr iface; virInterfaceObjPtr iface;
if ((iface = virInterfaceFindByName(interfaces, def->name))) { if ((iface = virInterfaceObjFindByName(interfaces, def->name))) {
virInterfaceDefFree(iface->def); virInterfaceDefFree(iface->def);
iface->def = def; iface->def = def;
@ -197,8 +197,8 @@ virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
void void
virInterfaceRemove(virInterfaceObjListPtr interfaces, virInterfaceObjRemove(virInterfaceObjListPtr interfaces,
virInterfaceObjPtr iface) virInterfaceObjPtr iface)
{ {
size_t i; size_t i;

View File

@ -44,11 +44,11 @@ virInterfaceObjIsActive(const virInterfaceObj *iface)
return iface->active; return iface->active;
} }
int virInterfaceFindByMACString(virInterfaceObjListPtr interfaces, int virInterfaceObjFindByMACString(virInterfaceObjListPtr interfaces,
const char *mac, const char *mac,
virInterfaceObjPtr *matches, int maxmatches); virInterfaceObjPtr *matches, int maxmatches);
virInterfaceObjPtr virInterfaceFindByName(virInterfaceObjListPtr interfaces, virInterfaceObjPtr virInterfaceObjFindByName(virInterfaceObjListPtr interfaces,
const char *name); const char *name);
void virInterfaceObjFree(virInterfaceObjPtr iface); void virInterfaceObjFree(virInterfaceObjPtr iface);
@ -57,10 +57,10 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src,
virInterfaceObjListPtr dest); virInterfaceObjListPtr dest);
virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces, virInterfaceObjPtr virInterfaceObjAssignDef(virInterfaceObjListPtr interfaces,
virInterfaceDefPtr def); virInterfaceDefPtr def);
void virInterfaceRemove(virInterfaceObjListPtr interfaces, void virInterfaceObjRemove(virInterfaceObjListPtr interfaces,
virInterfaceObjPtr iface); virInterfaceObjPtr iface);
void virInterfaceObjLock(virInterfaceObjPtr obj); void virInterfaceObjLock(virInterfaceObjPtr obj);
void virInterfaceObjUnlock(virInterfaceObjPtr obj); void virInterfaceObjUnlock(virInterfaceObjPtr obj);

View File

@ -941,14 +941,14 @@ virDomainObjListRename;
# conf/virinterfaceobj.h # conf/virinterfaceobj.h
virInterfaceAssignDef; virInterfaceObjAssignDef;
virInterfaceFindByMACString; virInterfaceObjFindByMACString;
virInterfaceFindByName; virInterfaceObjFindByName;
virInterfaceObjListClone; virInterfaceObjListClone;
virInterfaceObjListFree; virInterfaceObjListFree;
virInterfaceObjLock; virInterfaceObjLock;
virInterfaceObjRemove;
virInterfaceObjUnlock; virInterfaceObjUnlock;
virInterfaceRemove;
# conf/virnodedeviceobj.h # conf/virnodedeviceobj.h

View File

@ -1019,7 +1019,7 @@ testParseInterfaces(testDriverPtr privconn,
if (!def) if (!def)
goto error; goto error;
if (!(obj = virInterfaceAssignDef(&privconn->ifaces, def))) { if (!(obj = virInterfaceObjAssignDef(&privconn->ifaces, def))) {
virInterfaceDefFree(def); virInterfaceDefFree(def);
goto error; goto error;
} }
@ -3738,7 +3738,7 @@ static virInterfacePtr testInterfaceLookupByName(virConnectPtr conn,
virInterfacePtr ret = NULL; virInterfacePtr ret = NULL;
testDriverLock(privconn); testDriverLock(privconn);
iface = virInterfaceFindByName(&privconn->ifaces, name); iface = virInterfaceObjFindByName(&privconn->ifaces, name);
testDriverUnlock(privconn); testDriverUnlock(privconn);
if (iface == NULL) { if (iface == NULL) {
@ -3763,7 +3763,7 @@ static virInterfacePtr testInterfaceLookupByMACString(virConnectPtr conn,
virInterfacePtr ret = NULL; virInterfacePtr ret = NULL;
testDriverLock(privconn); testDriverLock(privconn);
ifacect = virInterfaceFindByMACString(&privconn->ifaces, mac, &iface, 1); ifacect = virInterfaceObjFindByMACString(&privconn->ifaces, mac, &iface, 1);
testDriverUnlock(privconn); testDriverUnlock(privconn);
if (ifacect == 0) { if (ifacect == 0) {
@ -3791,7 +3791,7 @@ static int testInterfaceIsActive(virInterfacePtr iface)
int ret = -1; int ret = -1;
testDriverLock(privconn); testDriverLock(privconn);
obj = virInterfaceFindByName(&privconn->ifaces, iface->name); obj = virInterfaceObjFindByName(&privconn->ifaces, iface->name);
testDriverUnlock(privconn); testDriverUnlock(privconn);
if (!obj) { if (!obj) {
virReportError(VIR_ERR_NO_INTERFACE, NULL); virReportError(VIR_ERR_NO_INTERFACE, NULL);
@ -3902,8 +3902,7 @@ static char *testInterfaceGetXMLDesc(virInterfacePtr iface,
virCheckFlags(0, NULL); virCheckFlags(0, NULL);
testDriverLock(privconn); testDriverLock(privconn);
privinterface = virInterfaceFindByName(&privconn->ifaces, privinterface = virInterfaceObjFindByName(&privconn->ifaces, iface->name);
iface->name);
testDriverUnlock(privconn); testDriverUnlock(privconn);
if (privinterface == NULL) { if (privinterface == NULL) {
@ -3934,7 +3933,7 @@ static virInterfacePtr testInterfaceDefineXML(virConnectPtr conn, const char *xm
if ((def = virInterfaceDefParseString(xmlStr)) == NULL) if ((def = virInterfaceDefParseString(xmlStr)) == NULL)
goto cleanup; goto cleanup;
if ((iface = virInterfaceAssignDef(&privconn->ifaces, def)) == NULL) if ((iface = virInterfaceObjAssignDef(&privconn->ifaces, def)) == NULL)
goto cleanup; goto cleanup;
def = NULL; def = NULL;
@ -3955,16 +3954,14 @@ static int testInterfaceUndefine(virInterfacePtr iface)
int ret = -1; int ret = -1;
testDriverLock(privconn); testDriverLock(privconn);
privinterface = virInterfaceFindByName(&privconn->ifaces, privinterface = virInterfaceObjFindByName(&privconn->ifaces, iface->name);
iface->name);
if (privinterface == NULL) { if (privinterface == NULL) {
virReportError(VIR_ERR_NO_INTERFACE, NULL); virReportError(VIR_ERR_NO_INTERFACE, NULL);
goto cleanup; goto cleanup;
} }
virInterfaceRemove(&privconn->ifaces, virInterfaceObjRemove(&privconn->ifaces, privinterface);
privinterface);
ret = 0; ret = 0;
cleanup: cleanup:
@ -3982,8 +3979,7 @@ static int testInterfaceCreate(virInterfacePtr iface,
virCheckFlags(0, -1); virCheckFlags(0, -1);
testDriverLock(privconn); testDriverLock(privconn);
privinterface = virInterfaceFindByName(&privconn->ifaces, privinterface = virInterfaceObjFindByName(&privconn->ifaces, iface->name);
iface->name);
if (privinterface == NULL) { if (privinterface == NULL) {
virReportError(VIR_ERR_NO_INTERFACE, NULL); virReportError(VIR_ERR_NO_INTERFACE, NULL);
@ -4015,8 +4011,7 @@ static int testInterfaceDestroy(virInterfacePtr iface,
virCheckFlags(0, -1); virCheckFlags(0, -1);
testDriverLock(privconn); testDriverLock(privconn);
privinterface = virInterfaceFindByName(&privconn->ifaces, privinterface = virInterfaceObjFindByName(&privconn->ifaces, iface->name);
iface->name);
if (privinterface == NULL) { if (privinterface == NULL) {
virReportError(VIR_ERR_NO_INTERFACE, NULL); virReportError(VIR_ERR_NO_INTERFACE, NULL);