From 33c642ae948fced53b457f1394fa97be4c1469f2 Mon Sep 17 00:00:00 2001 From: Thorsten Alteholz Date: Sun, 3 Feb 2013 11:58:25 +0100 Subject: [PATCH] Beautify ubik_print() After lots of intermediate steps a call to ubik_print(), ubik_vprint() and ubik_dprint*() ends in vFSLog() which adds a timestamp to the output. So any call to ubik_print(), that does not contain a \n at the end, makes a mess of the logfile. The least invasive change will simply add this newline at the end of any ubik_print() call. This also prevents long lines in the log, which might appear on multi-homed hosts with lots of interfaces. FIXES 1446 Reviewed-on: http://gerrit.openafs.org/9059 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Derrick Brashear (cherry picked from commit dc32caae7768c486e610c4e56c6a78e9c918d975) Change-Id: I05892d6d9c47517208e21a3ab00bad2f30d58ba9 Reviewed-on: http://gerrit.openafs.org/9522 Reviewed-by: Andrew Deason Reviewed-by: Derrick Brashear Reviewed-by: Stephan Wiesand Tested-by: BuildBot --- src/ubik/beacon.c | 9 ++++----- src/ubik/remote.c | 17 +++++++---------- src/ubik/ubik.c | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/ubik/beacon.c b/src/ubik/beacon.c index 1d3ee6dfb..0e64b2bc4 100644 --- a/src/ubik/beacon.c +++ b/src/ubik/beacon.c @@ -556,7 +556,7 @@ verifyInterfaceAddress(afs_uint32 *ame, struct afsconf_cell *info, } if (count <= 0) { /* no address found */ - ubik_print("ubik: No network addresses found, aborting.."); + ubik_print("ubik: No network addresses found, aborting..\n"); return UBADHOST; } @@ -580,7 +580,7 @@ verifyInterfaceAddress(afs_uint32 *ame, struct afsconf_cell *info, *ame = myAddr[0]; tcount = rx_getAllAddr(myAddr2, UBIK_MAX_INTERFACE_ADDR); if (tcount <= 0) { /* no address found */ - ubik_print("ubik: No network addresses found, aborting.."); + ubik_print("ubik: No network addresses found, aborting..\n"); return UBADHOST; } @@ -707,10 +707,9 @@ updateUbikNetworkAddress(afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR]) afs_inet_ntoa_r(ts->addr[0], hoststr)); } else if (multi_error == UBADHOST) { code = UBADHOST; /* remote CellServDB inconsistency */ - ubik_print("Inconsistent Cell Info on server: "); + ubik_print("Inconsistent Cell Info on server:\n"); for (j = 0; j < UBIK_MAX_INTERFACE_ADDR && ts->addr[j]; j++) - ubik_print("%s ", afs_inet_ntoa_r(ts->addr[j], hoststr)); - ubik_print("\n"); + ubik_print("... %s\n", afs_inet_ntoa_r(ts->addr[j], hoststr)); } else { ts->up = 0; /* mark the remote server as down */ } diff --git a/src/ubik/remote.c b/src/ubik/remote.c index a669da2ea..010dfbd23 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -697,10 +697,9 @@ SDISK_UpdateInterfaceAddr(struct rx_call *rxcall, /* if (probableMatch) */ /* inconsistent addresses in CellServDB */ if (!probableMatch || found) { - ubik_print("Inconsistent Cell Info from server: "); + ubik_print("Inconsistent Cell Info from server:\n"); for (i = 0; i < UBIK_MAX_INTERFACE_ADDR && inAddr->hostAddr[i]; i++) - ubik_print("%s ", afs_inet_ntoa_r(htonl(inAddr->hostAddr[i]), hoststr)); - ubik_print("\n"); + ubik_print("... %s\n", afs_inet_ntoa_r(htonl(inAddr->hostAddr[i]), hoststr)); fflush(stdout); fflush(stderr); printServerInfo(); @@ -711,10 +710,9 @@ SDISK_UpdateInterfaceAddr(struct rx_call *rxcall, for (i = 1; i < UBIK_MAX_INTERFACE_ADDR; i++) ts->addr[i] = htonl(inAddr->hostAddr[i]); - ubik_print("ubik: A Remote Server has addresses: "); + ubik_print("ubik: A Remote Server has addresses:\n"); for (i = 0; i < UBIK_MAX_INTERFACE_ADDR && ts->addr[i]; i++) - ubik_print("%s ", afs_inet_ntoa_r(ts->addr[i], hoststr)); - ubik_print("\n"); + ubik_print("... %s\n", afs_inet_ntoa_r(ts->addr[i], hoststr)); return 0; } @@ -726,13 +724,12 @@ printServerInfo(void) int i, j = 1; char hoststr[16]; - ubik_print("Local CellServDB:"); + ubik_print("Local CellServDB:\n"); for (ts = ubik_servers; ts; ts = ts->next, j++) { - ubik_print("Server %d: ", j); + ubik_print(" Server %d:\n", j); for (i = 0; (i < UBIK_MAX_INTERFACE_ADDR) && ts->addr[i]; i++) - ubik_print("%s ", afs_inet_ntoa_r(ts->addr[i], hoststr)); + ubik_print(" ... %s\n", afs_inet_ntoa_r(ts->addr[i], hoststr)); } - ubik_print("\n"); } afs_int32 diff --git a/src/ubik/ubik.c b/src/ubik/ubik.c index cb04bf526..ce1c847a0 100644 --- a/src/ubik/ubik.c +++ b/src/ubik/ubik.c @@ -1409,7 +1409,7 @@ panic(char *format, ...) va_list ap; va_start(ap, format); - ubik_print("Ubik PANIC: "); + ubik_print("Ubik PANIC:\n"); ubik_vprint(format, ap); va_end(ap); -- 2.39.5