From: Katy Feng Date: Fri, 23 Dec 2022 00:25:51 +0000 (-0800) Subject: lib/panic: Remove Panic_GetCoreFileName and Panic_SetCoreFileName. X-Git-Tag: stable-12.2.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91e8725d65565b4b3452085a2e9db6e3f0bb1dcf;p=thirdparty%2Fopen-vm-tools.git lib/panic: Remove Panic_GetCoreFileName and Panic_SetCoreFileName. Panic_[GS]etCoreFileName have been dead code for a very long time. This change removes them, along with the underlying panicState.coreDumpFile field. Also, do some reformatting and tidy a few comments. --- diff --git a/open-vm-tools/lib/include/panic.h b/open-vm-tools/lib/include/panic.h index 7f73fc89b..b6c9284cc 100644 --- a/open-vm-tools/lib/include/panic.h +++ b/open-vm-tools/lib/include/panic.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2003-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2003-2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -108,7 +108,6 @@ Panic_SetBreakOnPanic(Bool breakOnPanic) // IN: void Panic_SetCoreDumpOnPanic(Bool dumpCore); Bool Panic_GetCoreDumpOnPanic(void); -void Panic_SetCoreDumpFileName(const char *fileName); int Panic_GetCoreDumpFlags(void); void Panic_SetCoreDumpFlags(int flags); diff --git a/open-vm-tools/lib/panic/panic.c b/open-vm-tools/lib/panic/panic.c index b5d2310f2..d1ab5d880 100644 --- a/open-vm-tools/lib/panic/panic.c +++ b/open-vm-tools/lib/panic/panic.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2006-2019 VMware, Inc. All rights reserved. + * Copyright (C) 2006-2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -19,7 +19,7 @@ /* * panic.c -- * - * Module to encapsulate common Panic behaviors. + * Module to encapsulate common Panic behaviors. */ #include @@ -60,7 +60,6 @@ static struct PanicState { Bool loopOnPanic; int coreDumpFlags; /* Memorize for clients without init func */ PanicBreakAction breakOnPanic; /* XXX: should this be DEVEL only? */ - char *coreDumpFile; } panicState = { TRUE, TRUE }; /* defaults in lieu of Panic_Init() */ @@ -96,15 +95,15 @@ Panic_Init(void) * * Panic_SetPanicMsgPost -- * - * Allow the Msg_Post() on panic to be suppressed. If passed FALSE, - * then any subsequent Panics will refrain from posting the "VMWARE - * Panic:" message. + * Allow the Msg_Post() on panic to be suppressed. If passed FALSE, + * then any subsequent Panics will refrain from posting the Panic + * message. * * Results: - * void. + * None. * * Side effects: - * Enables/Disables Msg_Post on Panic(). + * None. * *---------------------------------------------------------------------- */ @@ -120,12 +119,14 @@ Panic_SetPanicMsgPost(Bool postMsg) *---------------------------------------------------------------------- * * Panic_GetPanicMsgPost -- - * Returns panicState.msgPostOnPanic + * + * Determines whether to post a message during Panic. * * Results: + * TRUE iff it's OK to post messages during Panic. * * Side effects: - * None. + * None. * *---------------------------------------------------------------------- */ @@ -442,65 +443,6 @@ Panic_GetBreakOnPanic(void) } -/* - *----------------------------------------------------------------------------- - * - * Panic_SetCoreDumpFileName -- - * - * Record the filename of a core dump file so that a subsequent - * Panic_PostPanicMsg can mention it by name. - * - * Pass NULL to say there's no core file; pass the empty string to - * say there's a core file but you don't know where; pass the name - * of the core file if you know it. - * - * Results: - * void - * - * Side effects: - * malloc; overwrites panicState.coreDumpFile - * - *----------------------------------------------------------------------------- - */ - -void -Panic_SetCoreDumpFileName(const char *fileName) -{ - if (panicState.coreDumpFile) { - free(panicState.coreDumpFile); - } - - if (fileName) { - panicState.coreDumpFile = strdup(fileName); - } else { - panicState.coreDumpFile = NULL; - } -} - - -/* - *----------------------------------------------------------------------------- - * - * Panic_GetCoreDumpFileName -- - * - * Returns the core dump filename if set. - * - * Results: - * coredump filename if set, NULL otherwise. - * - * Side effects: - * None - * - *----------------------------------------------------------------------------- - */ - -const char * -Panic_GetCoreDumpFileName(void) -{ - return panicState.coreDumpFile; -} - - /* *----------------------------------------------------------------------------- * @@ -517,7 +459,7 @@ Panic_GetCoreDumpFileName(void) * None. * * Side effects: - * Death. + * Death. * *----------------------------------------------------------------------------- */ @@ -557,9 +499,9 @@ Panic_Panic(const char *format, /* * Panic loop detection: - * first time - do the whole report and shutdown sequence - * second time - log and exit - * beyond second time - just exit + * first time - do the whole report and shutdown sequence + * second time - log and exit + * beyond second time - just exit */ switch (count++) { // Try HARD to not put code in here!