#define ViceLog(level, str) do { if ((level) <= LogLevel) (FSLog str); } while (0)
#define vViceLog(level, str) do { if ((level) <= LogLevel) (vFSLog str); } while (0)
+#define ViceLogThenPanic(level, str) \
+ do { ViceLog(level, str); osi_Panic str; } while(0);
extern int OpenLog(const char *filename);
extern int ReOpenLog(const char *fileName);
temp = strlen(V_name(volptr)) + 1;
*name = malloc(temp);
if (!*name) {
- ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
- osi_Panic("Failed malloc in RXGetVolumeStatus\n");
+ ViceLogThenPanic(0, ("Failed malloc in RXGetVolumeStatus\n"));
}
strcpy(*name, V_name(volptr));
temp = strlen(V_offlineMessage(volptr)) + 1;
*offMsg = malloc(temp);
if (!*offMsg) {
- ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
- osi_Panic("Failed malloc in RXGetVolumeStatus\n");
+ ViceLogThenPanic(0, ("Failed malloc in RXGetVolumeStatus\n"));
}
strcpy(*offMsg, V_offlineMessage(volptr));
#if OPENAFS_VOL_STATS
*motd = malloc(1);
if (!*motd) {
- ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
- osi_Panic("Failed malloc in RXGetVolumeStatus\n");
+ ViceLogThenPanic(0, ("Failed malloc in RXGetVolumeStatus\n"));
}
strcpy(*motd, nullString);
#else
temp = strlen(V_motd(volptr)) + 1;
*motd = malloc(temp);
if (!*motd) {
- ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
- osi_Panic("Failed malloc in RXGetVolumeStatus\n");
+ ViceLogThenPanic(0, ("Failed malloc in RXGetVolumeStatus\n"));
}
strcpy(*motd, V_motd(volptr));
#endif /* FS_STATS_DETAILED */
FS_UNLOCK;
tmp = malloc(sendBufSize);
if (!tmp) {
- ViceLog(0, ("Failed malloc in AllocSendBuffer\n"));
- osi_Panic("Failed malloc in AllocSendBuffer\n");
+ ViceLogThenPanic(0, ("Failed malloc in AllocSendBuffer\n"));
}
return tmp;
}
AccessList->AFSOpaque_len = 0;
AccessList->AFSOpaque_val = malloc(AFSOPAQUEMAX);
if (!AccessList->AFSOpaque_val) {
- ViceLog(0, ("Failed malloc in SRXAFS_FetchACL\n"));
- osi_Panic("Failed malloc in SRXAFS_FetchACL\n");
+ ViceLogThenPanic(0, ("Failed malloc in SRXAFS_FetchACL\n"));
}
/*
OutStats->AFSBulkStats_val = (struct AFSFetchStatus *)
malloc(nfiles * sizeof(struct AFSFetchStatus));
if (!OutStats->AFSBulkStats_val) {
- ViceLog(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
- osi_Panic("Failed malloc in SRXAFS_BulkStatus\n");
+ ViceLogThenPanic(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
}
OutStats->AFSBulkStats_len = nfiles;
CallBacks->AFSCBs_val = (struct AFSCallBack *)
malloc(nfiles * sizeof(struct AFSCallBack));
if (!CallBacks->AFSCBs_val) {
- ViceLog(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
- osi_Panic("Failed malloc in SRXAFS_BulkStatus\n");
+ ViceLogThenPanic(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
}
CallBacks->AFSCBs_len = nfiles;
OutStats->AFSBulkStats_val = (struct AFSFetchStatus *)
malloc(nfiles * sizeof(struct AFSFetchStatus));
if (!OutStats->AFSBulkStats_val) {
- ViceLog(0, ("Failed malloc in SRXAFS_FetchStatus\n"));
- osi_Panic("Failed malloc in SRXAFS_FetchStatus\n");
+ ViceLogThenPanic(0, ("Failed malloc in SRXAFS_FetchStatus\n"));
}
OutStats->AFSBulkStats_len = nfiles;
CallBacks->AFSCBs_val = (struct AFSCallBack *)
malloc(nfiles * sizeof(struct AFSCallBack));
if (!CallBacks->AFSCBs_val) {
- ViceLog(0, ("Failed malloc in SRXAFS_FetchStatus\n"));
- osi_Panic("Failed malloc in SRXAFS_FetchStatus\n");
+ ViceLogThenPanic(0, ("Failed malloc in SRXAFS_FetchStatus\n"));
}
CallBacks->AFSCBs_len = nfiles;
for (safety = 0, cbp = &fe->firstcb; *cbp && *cbp != cbi;
cbp = &itocb(*cbp)->cnext, safety++) {
if (safety > cbstuff.nblks + 10) {
- osi_Panic("CDel: Internal Error -- shutting down: wanted %d from %d, now at %d\n",
- cbi, fe->firstcb, *cbp);
- ViceLog(0,
- ("CDel: Internal Error -- shutting down: wanted %d from %d, now at %d\n",
- cbi, fe->firstcb, *cbp));
+ ViceLogThenPanic(0, ("CDel: Internal Error -- shutting down: "
+ "wanted %d from %d, now at %d\n",
+ cbi, fe->firstcb, *cbp));
DumpCallBackState_r();
ShutDownAndCore(PANIC);
}
* FE[0] and CB[0] are not used--and not allocated */
FE = ((struct FileEntry *)(calloc(nblks, sizeof(struct FileEntry))));
if (!FE) {
- ViceLog(0, ("Failed malloc in InitCallBack\n"));
- osi_Panic("Failed malloc in InitCallBack\n");
+ ViceLogThenPanic(0, ("Failed malloc in InitCallBack\n"));
}
FE--; /* FE[0] is supposed to point to junk */
cbstuff.nFEs = nblks;
FreeFE(&FE[cbstuff.nFEs]); /* This is correct */
CB = ((struct CallBack *)(calloc(nblks, sizeof(struct CallBack))));
if (!CB) {
- ViceLog(0, ("Failed malloc in InitCallBack\n"));
- osi_Panic("Failed malloc in InitCallBack\n");
+ ViceLogThenPanic(0, ("Failed malloc in InitCallBack\n"));
}
CB--; /* CB[0] is supposed to point to junk */
cbstuff.nCBs = nblks;
interfaces = calloc(i, sizeof(struct AddrPort));
conns = calloc(i, sizeof(struct rx_connection *));
if (!interfaces || !conns) {
- ViceLog(0,
- ("Failed malloc in MultiBreakCallBackAlternateAddress_r\n"));
- osi_Panic("Failed malloc in MultiBreakCallBackAlternateAddress_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in "
+ "MultiBreakCallBackAlternateAddress_r\n"));
}
/* initialize alternate rx connections */
interfaces = calloc(i, sizeof(struct AddrPort));
conns = calloc(i, sizeof(struct rx_connection *));
if (!interfaces || !conns) {
- ViceLog(0, ("Failed malloc in MultiProbeAlternateAddress_r\n"));
- osi_Panic("Failed malloc in MultiProbeAlternateAddress_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in "
+ "MultiProbeAlternateAddress_r\n"));
}
/* initialize alternate rx connections */
}
list = (struct host **)malloc(hostCount * sizeof(struct host *));
if (!list) {
- ViceLog(0, ("Failed malloc in h_Enumerate (list)\n"));
- osi_Panic("Failed malloc in h_Enumerate (list)\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_Enumerate (list)\n"));
}
flags = (int *)malloc(hostCount * sizeof(int));
if (!flags) {
- ViceLog(0, ("Failed malloc in h_Enumerate (flags)\n"));
- osi_Panic("Failed malloc in h_Enumerate (flags)\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_Enumerate (flags)\n"));
}
for (totalCount = count = 0, host = hostList;
host && totalCount < hostCount;
/* insert into beginning of list for this bucket */
chain = (struct h_UuidHashChain *)malloc(sizeof(struct h_UuidHashChain));
if (!chain) {
- ViceLog(0, ("Failed malloc in h_AddHostToUuidHashTable_r\n"));
- osi_Panic("Failed malloc in h_AddHostToUuidHashTable_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_AddHostToUuidHashTable_r\n"));
}
chain->hostPtr = host;
chain->next = hostUuidHashTable[index];
/* insert into beginning of list for this bucket */
chain = (struct h_AddrHashChain *)malloc(sizeof(struct h_AddrHashChain));
if (!chain) {
- ViceLog(0, ("Failed malloc in h_AddHostToAddrHashTable_r\n"));
- osi_Panic("Failed malloc in h_AddHostToAddrHashTable_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_AddHostToAddrHashTable_r\n"));
}
chain->hostPtr = host;
chain->next = hostAddrHashTable[index];
interface = (struct Interface *)
malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * number));
if (!interface) {
- ViceLog(0, ("Failed malloc in addInterfaceAddr_r\n"));
- osi_Panic("Failed malloc in addInterfaceAddr_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in addInterfaceAddr_r\n"));
}
interface->numberOfInterfaces = number + 1;
interface->uuid = host->interface->uuid;
((code == 0) && (afs_uuid_equal(&interf.uuid, &nulluuid)))) {
identP = (struct Identity *)malloc(sizeof(struct Identity));
if (!identP) {
- ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
- osi_Panic("Failed malloc in h_GetHost_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_GetHost_r\n"));
}
identP->valid = 0;
rx_SetSpecific(tcon, rxcon_ident_key, identP);
interfValid = 1;
identP = (struct Identity *)malloc(sizeof(struct Identity));
if (!identP) {
- ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
- osi_Panic("Failed malloc in h_GetHost_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_GetHost_r\n"));
}
identP->valid = 1;
identP->uuid = interf.uuid;
pident = 1;
if (!identP) {
- ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
- osi_Panic("Failed malloc in h_GetHost_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_GetHost_r\n"));
}
identP->valid = 0;
if (!pident)
pident = 1;
if (!identP) {
- ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
- osi_Panic("Failed malloc in h_GetHost_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_GetHost_r\n"));
}
identP->valid = 1;
interfValid = 1;
foreign = 1; /* attempt cross-cell authentication */
tname = (char *)malloc(PR_MAXNAMELEN);
if (!tname) {
- ViceLog(0, ("Failed malloc in MapName_r\n"));
- osi_Panic("Failed malloc in MapName_r\n");
+ ViceLogThenPanic(0, ("Failed malloc in MapName_r\n"));
}
strcpy(tname, aname);
tname[anamelen] = '@';
lids.idlist_len = 1;
lids.idlist_val = (afs_int32 *) malloc(1 * sizeof(afs_int32));
if (!lids.idlist_val) {
- ViceLog(0, ("Failed malloc in h_UserName\n"));
- osi_Panic("Failed malloc in h_UserName\n");
+ ViceLogThenPanic(0, ("Failed malloc in h_UserName\n"));
}
lnames.namelist_len = 0;
lnames.namelist_val = (prname *) 0;
malloc(sizeof(struct Interface) +
(sizeof(struct AddrPort) * (count - 1)));
if (!interface) {
- ViceLog(0, ("Failed malloc in initInterfaceAddr_r 1\n"));
- osi_Panic("Failed malloc in initInterfaceAddr_r 1\n");
+ ViceLogThenPanic(0, ("Failed malloc in initInterfaceAddr_r 1\n"));
}
interface->numberOfInterfaces = count;
} else {
interface = (struct Interface *)
malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * count));
if (!interface) {
- ViceLog(0, ("Failed malloc in initInterfaceAddr_r 2\n"));
- osi_Panic("Failed malloc in initInterfaceAddr_r 2\n");
+ ViceLogThenPanic(0, ("Failed malloc in initInterfaceAddr_r 2\n"));
}
interface->numberOfInterfaces = count + 1;
interface->interface[count].addr = myAddr;
ShutdownWatchdogLWP(void *unused)
{
sleep(panic_timeout);
- ViceLog(0, ("ShutdownWatchdogLWP: Failed to shutdown and panic "
- "within %d seconds; forcing panic\n", panic_timeout));
- osi_Panic("ShutdownWatchdogLWP: Failed to shutdown and panic "
- "within %d seconds; forcing panic\n", panic_timeout);
+ ViceLogThenPanic(0, ("ShutdownWatchdogLWP: Failed to shutdown and panic "
+ "within %d seconds; forcing panic\n",
+ panic_timeout));
return NULL;
}
void
Die(char *msg)
{
- ViceLog(0, ("%s\n", msg));
- osi_Panic("%s\n", msg);
+ ViceLogThenPanic(0, ("%s\n", msg));
} /*Die */