From 657abfc251bfe422616dd22e5e83ef0981134461 Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Sun, 21 Apr 2002 21:54:59 +0000 Subject: [PATCH] Clean up some more ViceLog calls to consistently refer to hosts in a format like 18.239.2.102:7001, rather than memory address or hex IP. (cherry picked from commit c4ac62f829f5642b72df9e01438fc4545cda98f9) --- src/viced/host.c | 61 ++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/src/viced/host.c b/src/viced/host.c index 6f0c3f0b4..eee5d371c 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -940,6 +940,7 @@ struct host *h_GetHost_r(tcon) afs_int32 haddr; afs_int32 hport; int i, j, count; + char hoststr[16], hoststr2[16]; haddr = rxr_HostOf(tcon); hport = rxr_PortOf(tcon); @@ -960,7 +961,8 @@ retry: /* Another thread is doing initialization */ h_Unlock_r(host); if ( !held) h_Release_r(host); - ViceLog(125, ("Host %x starting h_Lookup again\n", host)); + ViceLog(125, ("Host %s:%d starting h_Lookup again\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); goto retry; } host->hostFlags &= ~ALTADDR; @@ -977,8 +979,8 @@ retry: * that we maintain some extra callback state information */ if (host->interface) { ViceLog(0, - ("Host %x used to support WhoAreYou, deleting.\n", - host)); + ("Host %s:%d used to support WhoAreYou, deleting.\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); host->hostFlags |= HOSTDELETED; h_Unlock_r(host); if (!held) h_Release_r(host); @@ -997,8 +999,8 @@ retry: if ( !host->interface || !afs_uuid_equal(&interf.uuid, &host->interface->uuid) ) { ViceLog(25, - ("Host %x has changed its identity, deleting.\n", - host)); + ("Host %s:%d has changed its identity, deleting.\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); host->hostFlags |= HOSTDELETED; h_Unlock_r(host); if (!held) h_Release_r(host); @@ -1006,7 +1008,6 @@ retry: goto retry; } } else { - char hoststr[16]; afs_inet_ntoa_r(host->host, hoststr); ViceLog(0,("CB: WhoAreYou failed for %s:%d, error %d\n", hoststr, ntohs(host->port), code)); @@ -1020,12 +1021,13 @@ retry: if ( ! (host->hostFlags & ALTADDR) ) { /* another thread is doing the initialisation */ - ViceLog(125, ("Host %x waiting for host-init to complete\n", - host)); + ViceLog(125, ("Host %s:%d waiting for host-init to complete\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); h_Lock_r(host); h_Unlock_r(host); if ( !held) h_Release_r(host); - ViceLog(125, ("Host %x starting h_Lookup again\n", host)); + ViceLog(125, ("Host %s:%d starting h_Lookup again\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); goto retry; } /* We need to check whether the identity in the host structure @@ -1040,8 +1042,8 @@ retry: host->hostFlags |= HOSTDELETED; h_Unlock_r(host); if (!held) h_Release_r(host); - ViceLog(0,("CB: new identity for host %x, deleting\n", - host->host)); + ViceLog(0, ("CB: new identity for host %s:%d, deleting\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); goto retry; } } else { @@ -1059,8 +1061,8 @@ retry: identP->valid = 0; rx_SetSpecific(tcon, rxcon_ident_key, identP); ViceLog(25, - ("Host %x does not support WhoAreYou.\n", - host->host)); + ("Host %s:%d does not support WhoAreYou.\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); code = 0; } else if (code == 0) { interfValid = 1; @@ -1068,7 +1070,8 @@ retry: identP->valid = 1; identP->uuid = interf.uuid; rx_SetSpecific(tcon, rxcon_ident_key, identP); - ViceLog(25,("WhoAreYou success on %x\n", host->host)); + ViceLog(25, ("WhoAreYou success on %s:%d\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); } } if (code == 0 && !identP->valid) { @@ -1084,8 +1087,9 @@ retry: if (!(held = h_Held_r(oldHost))) h_Hold_r(oldHost); h_Lock_r(oldHost); - ViceLog(25,("CB: new addr %x for old host %x\n", - host->host, oldHost->host)); + ViceLog(25, ("CB: new addr %s:%d for old host %s:%d\n", + afs_inet_ntoa_r(host->host, hoststr), host->port, + afs_inet_ntoa_r(oldHost->host, hoststr2), oldHost->port)); host->hostFlags |= HOSTDELETED; h_Unlock_r(host); h_Release_r(host); @@ -1099,15 +1103,14 @@ retry: &FS_HostUUID); H_LOCK if (code == 0) { - ViceLog(25,("InitCallBackState3 success on %x\n", - host->host)); + ViceLog(25, ("InitCallBackState3 success on %s:%d\n", + afs_inet_ntoa_r(host->host, hoststr), host->port)); assert(interfValid == 1); initInterfaceAddr_r(host, &interf); } } } if (code) { - char hoststr[16]; afs_inet_ntoa_r(host->host, hoststr); ViceLog(0,("CB: RCallBackConnectBack failed for %s:%d\n", hoststr, ntohs(host->port))); @@ -1390,8 +1393,11 @@ ticket name length != 64 code = pr_GetCPS(viceid, &client->CPS); H_LOCK if (code) { - ViceLog(0, ("pr_GetCPS failed(%d) for user %d, host %x.%d\n", - code, viceid, client->host->host, ntohs(client->host->port))); + char hoststr[16]; + ViceLog(0, ("pr_GetCPS failed(%d) for user %d, host %s:%d\n", + code, viceid, + afs_inet_ntoa_r(client->host->host, hoststr), + client->host->port)); /* Although ubik_Call (called by pr_GetCPS) traverses thru * all protection servers and reevaluates things if no @@ -1464,8 +1470,11 @@ int GetClient(tcon, cp) assert(client && client->tcon && rxr_CidOf(client->tcon) == client->sid); if (client && client->LastCall > client->expTime && client->expTime) { - ViceLog(1, ("Token for %s at %x.%d expired %d\n", - h_UserName(client), client->host->host, client->host->port, client->expTime)); + char hoststr[16]; + ViceLog(1, ("Token for %s at %s:%d expired %d\n", + h_UserName(client), + afs_inet_ntoa_r(client->host->host, hoststr), + client->host->port, client->expTime)); H_UNLOCK return VICETOKENDEAD; } @@ -1522,14 +1531,16 @@ static int h_PrintClient(host, held, file) int i; char tmpStr[256]; char tbuffer[32]; + char hoststr[16]; H_LOCK if (host->hostFlags & HOSTDELETED) { H_UNLOCK return held; } - sprintf(tmpStr,"Host %x.%d down = %d, LastCall %s", host->host, - host->port, (host->hostFlags & VENUSDOWN), + sprintf(tmpStr,"Host %s:%d down = %d, LastCall %s", + afs_inet_ntoa_r(host->host, hoststr), host->port, + (host->hostFlags & VENUSDOWN), afs_ctime((time_t *)&host->LastCall, tbuffer, sizeof(tbuffer))); STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file); for (client = host->FirstClient; client; client=client->next) { -- 2.39.5