]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/panic: Remove Panic_GetCoreFileName and Panic_SetCoreFileName.
authorKaty Feng <fkaty@vmware.com>
Fri, 23 Dec 2022 00:25:51 +0000 (16:25 -0800)
committerKaty Feng <fkaty@vmware.com>
Fri, 23 Dec 2022 00:25:51 +0000 (16:25 -0800)
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.

open-vm-tools/lib/include/panic.h
open-vm-tools/lib/panic/panic.c

index 7f73fc89b263190bbd594c8c8e9951980ede142a..b6c9284ccc874092c499b438aa7a096d590adee3 100644 (file)
@@ -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);
 
index b5d2310f2d04e1dde3aa7dad553bdf1c347e594f..d1ab5d8809e40764feb74cf7a36fd8f4cec5663d 100644 (file)
@@ -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 <stdio.h>
@@ -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!