windows-server-find-by-uuid-20090614

LICENSE MIT

Add cm_FindServerByUuid().  This function is similar to cm_FindServerByIP()
but uses the server's known uuid instead which is constant across multi-
homed systems.
This commit is contained in:
Jeffrey Altman 2009-06-15 02:02:59 +00:00
parent 571dc5edbe
commit 88ef4fb720
2 changed files with 22 additions and 0 deletions

View File

@ -941,6 +941,26 @@ cm_FindServerByIP(afs_uint32 ipaddr, int type)
return tsp; return tsp;
} }
cm_server_t *
cm_FindServerByUuid(afsUUID *serverUuid, int type)
{
cm_server_t *tsp;
lock_ObtainRead(&cm_serverLock);
for (tsp = cm_allServersp; tsp; tsp = tsp->allNextp) {
if (tsp->type == type && !afs_uuid_equal(&tsp->uuid, serverUuid))
break;
}
/* bump ref count if we found the server */
if (tsp)
cm_GetServerNoLock(tsp);
lock_ReleaseRead(&cm_serverLock);
return tsp;
}
/* find a server based on its properties */ /* find a server based on its properties */
cm_server_t *cm_FindServer(struct sockaddr_in *addrp, int type) cm_server_t *cm_FindServer(struct sockaddr_in *addrp, int type)
{ {

View File

@ -128,6 +128,8 @@ extern void cm_SetServerNoInlineBulk(cm_server_t * serverp, int no);
extern cm_server_t * cm_FindServerByIP(afs_uint32 addr, int type); extern cm_server_t * cm_FindServerByIP(afs_uint32 addr, int type);
extern cm_server_t * cm_FindServerByUuid(afsUUID* uuid, int type);
extern void cm_SetLanAdapterChangeDetected(void); extern void cm_SetLanAdapterChangeDetected(void);
extern void cm_RemoveVolumeFromServer(cm_server_t * serverp, afs_uint32 volID); extern void cm_RemoveVolumeFromServer(cm_server_t * serverp, afs_uint32 volID);