From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:32 +0000 (-0700) Subject: Fix tools build X-Git-Tag: stable-10.2.0~283 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e02005e5b01e6335b233a2ab9d15f294a46a11e5;p=thirdparty%2Fopen-vm-tools.git Fix tools build For open-vm-tools there is code that strips off the "VMware Confidential" part of the msgfmt.c header. When the copyright years were updated in msgfmt.c, it broke the pattern matcher. --- diff --git a/open-vm-tools/lib/include/panic.h b/open-vm-tools/lib/include/panic.h index 69120119b..7f73fc89b 100644 --- a/open-vm-tools/lib/include/panic.h +++ b/open-vm-tools/lib/include/panic.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2003-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2003-2017 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 @@ -29,6 +29,8 @@ #define INCLUDE_ALLOW_VMCORE #include "includeCheck.h" +#include "vm_basic_types.h" + #if defined(__cplusplus) extern "C" { #endif @@ -61,11 +63,44 @@ void Panic_PostPanicMsg(const char *format, ...); * debugger stops it: */ -void Panic_SetBreakOnPanic(Bool breakOnPanic); +typedef enum { + PanicBreakAction_Never, + PanicBreakAction_IfDebuggerAttached, + PanicBreakAction_Always +} PanicBreakAction; + +void Panic_SetBreakAction(PanicBreakAction action); +PanicBreakAction Panic_GetBreakAction(void); Bool Panic_GetBreakOnPanic(void); void Panic_BreakOnPanic(void); void Panic_LoopOnPanic(void); + +/* + *----------------------------------------------------------------------------- + * + * Panic_SetBreakOnPanic -- + * + * Allow the debug breakpoint on panic to be suppressed. If passed FALSE, + * then any subsequent Panics will not attempt to attract a debugger. + * + * Results: + * void. + * + * Side effects: + * Enables/Disables break into debugger on Panic(). + * + *----------------------------------------------------------------------------- + */ + +static INLINE void +Panic_SetBreakOnPanic(Bool breakOnPanic) // IN: +{ + Panic_SetBreakAction(breakOnPanic ? PanicBreakAction_Always + : PanicBreakAction_Never); +} + + /* * On panic, dump core; Panic is also the place where various pieces of * back end stash information about the core dump. diff --git a/open-vm-tools/lib/include/vm_basic_asm_x86_common.h b/open-vm-tools/lib/include/vm_basic_asm_x86_common.h index bbcc35fce..9b97fba75 100644 --- a/open-vm-tools/lib/include/vm_basic_asm_x86_common.h +++ b/open-vm-tools/lib/include/vm_basic_asm_x86_common.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2013,2017 VMware, Inc. All rights reserved. + * Copyright (C) 2013-2017 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 @@ -350,12 +350,13 @@ RDTSC_BARRIER(void) * For the above two reasons, usage of COMPILER_*_BARRIER is now deprecated. * _Do not add new references to COMPILER_*_BARRIER._ Instead, precisely * document the intent of your code by using the - * __MEM_BARRIER family of barriers. Existing + * __BARRIER_ * references to COMPILER_*_BARRIER are being slowly but surely converted, * and when no references are left, COMPILER_*_BARRIER will be retired. * * Thanks for pasting this whole comment into every architecture header. */ + #if defined __GNUC__ # define COMPILER_READ_BARRIER() COMPILER_MEM_BARRIER() # define COMPILER_WRITE_BARRIER() COMPILER_MEM_BARRIER() @@ -368,12 +369,17 @@ RDTSC_BARRIER(void) /* - * (Compiler + CPU) memory barriers. These take the form of - * __MEM_BARRIER, where is - * either LD (load), ST (store) or LDST (any). + * Memory barriers. These take the form of + * + * __BARRIER_ + * + * where: + * is either SMP, DMA, or MMIO. + * <*_access type> is either R(load), W(store) or RW(any). * * Above every use of these memory barriers in the code, there _must_ be a * comment to justify the use, i.e. a comment which: + * * 1) Precisely identifies which memory accesses must not be re-ordered across * the memory barrier. * 2) Explains why it is important that the memory accesses not be re-ordered. @@ -390,8 +396,9 @@ RDTSC_BARRIER(void) * store-store (sfence) ordering, and they don't apply to normal memory. */ + static INLINE void -ST_LD_MEM_BARRIER(void) +SMP_W_BARRIER_R(void) { volatile long temp; @@ -410,13 +417,53 @@ ST_LD_MEM_BARRIER(void) COMPILER_MEM_BARRIER(); } -#define LD_LD_MEM_BARRIER() COMPILER_READ_BARRIER() -#define LD_ST_MEM_BARRIER() COMPILER_MEM_BARRIER() -#define LD_LDST_MEM_BARRIER() COMPILER_MEM_BARRIER() -#define ST_ST_MEM_BARRIER() COMPILER_WRITE_BARRIER() -#define ST_LDST_MEM_BARRIER() ST_LD_MEM_BARRIER() -#define LDST_LD_MEM_BARRIER() ST_LD_MEM_BARRIER() -#define LDST_ST_MEM_BARRIER() COMPILER_MEM_BARRIER() -#define LDST_LDST_MEM_BARRIER() ST_LD_MEM_BARRIER() +#define SMP_R_BARRIER_R() COMPILER_READ_BARRIER() +#define SMP_R_BARRIER_W() COMPILER_MEM_BARRIER() +#define SMP_R_BARRIER_RW() COMPILER_MEM_BARRIER() +#define SMP_W_BARRIER_W() COMPILER_WRITE_BARRIER() +#define SMP_W_BARRIER_RW() SMP_W_BARRIER_R() +#define SMP_RW_BARRIER_R() SMP_W_BARRIER_R() +#define SMP_RW_BARRIER_W() COMPILER_MEM_BARRIER() +#define SMP_RW_BARRIER_RW() SMP_W_BARRIER_R() + +/* + * Like the above, only for use with observers other than CPUs, + * i.e. DMA masters. + */ + +#define DMA_R_BARRIER_R() SMP_R_BARRIER_R() +#define DMA_R_BARRIER_W() SMP_R_BARRIER_W() +#define DMA_R_BARRIER_RW() SMP_R_BARRIER_RW() +#define DMA_W_BARRIER_R() SMP_W_BARRIER_R() +#define DMA_W_BARRIER_W() SMP_W_BARRIER_W() +#define DMA_W_BARRIER_RW() SMP_W_BARRIER_RW() +#define DMA_RW_BARRIER_R() SMP_RW_BARRIER_R() +#define DMA_RW_BARRIER_W() SMP_RW_BARRIER_W() +#define DMA_RW_BARRIER_RW() SMP_RW_BARRIER_RW() + +/* + * And finally a set for use with MMIO accesses. + */ + +#define MMIO_R_BARRIER_R() SMP_R_BARRIER_R() +#define MMIO_R_BARRIER_W() SMP_R_BARRIER_W() +#define MMIO_R_BARRIER_RW() SMP_R_BARRIER_RW() +#define MMIO_W_BARRIER_R() SMP_W_BARRIER_R() +#define MMIO_W_BARRIER_W() SMP_W_BARRIER_W() +#define MMIO_W_BARRIER_RW() SMP_W_BARRIER_RW() +#define MMIO_RW_BARRIER_R() SMP_RW_BARRIER_R() +#define MMIO_RW_BARRIER_W() SMP_RW_BARRIER_W() +#define MMIO_RW_BARRIER_RW() SMP_RW_BARRIER_RW() + +/* deprecated version -- going away soon */ +#define LD_LD_MEM_BARRIER() SMP_R_BARRIER_R() +#define LD_ST_MEM_BARRIER() SMP_R_BARRIER_W() +#define LD_LDST_MEM_BARRIER() SMP_R_BARRIER_RW() +#define ST_LD_MEM_BARRIER() SMP_W_BARRIER_R() +#define ST_ST_MEM_BARRIER() SMP_W_BARRIER_W() +#define ST_LDST_MEM_BARRIER() SMP_W_BARRIER_RW() +#define LDST_LD_MEM_BARRIER() SMP_RW_BARRIER_R() +#define LDST_ST_MEM_BARRIER() SMP_RW_BARRIER_W() +#define LDST_LDST_MEM_BARRIER() SMP_RW_BARRIER_RW() #endif // _VM_BASIC_ASM_X86_COMMON_H_ diff --git a/open-vm-tools/lib/misc/msgfmt.c b/open-vm-tools/lib/misc/msgfmt.c index 9c7d59cab..95e9e8dd8 100644 --- a/open-vm-tools/lib/misc/msgfmt.c +++ b/open-vm-tools/lib/misc/msgfmt.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (C) 2007-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2017 VMware, Inc. All rights reserved. * **********************************************************/ /* @@ -163,9 +163,10 @@ memchr(const void *s, int c, size_t n) const uint8 *p = s; const uint8 *e = p + n; while (p < e) { - if (*p++ == c) { - return p; + if (*p == c) { + return p; } + ++p; } return NULL; } diff --git a/open-vm-tools/lib/panic/panic.c b/open-vm-tools/lib/panic/panic.c index faea4704b..5895a27b1 100644 --- a/open-vm-tools/lib/panic/panic.c +++ b/open-vm-tools/lib/panic/panic.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2006-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2006-2017 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 @@ -49,18 +49,12 @@ #include "windowsu.h" #endif -typedef enum { - PanicBreakLevel_Never, - PanicBreakLevel_IfDebuggerAttached, - PanicBreakLevel_Always -} PanicBreakLevel; - static struct PanicState { Bool msgPostOnPanic; Bool coreDumpOnPanic; Bool loopOnPanic; int coreDumpFlags; /* Memorize for clients without init func */ - PanicBreakLevel breakOnPanic; /* XXX: should this be DEVEL only? */ + PanicBreakAction breakOnPanic; /* XXX: should this be DEVEL only? */ char *coreDumpFile; } panicState = { TRUE, TRUE }; /* defaults in lieu of Panic_Init() */ @@ -86,8 +80,8 @@ Panic_Init(void) { panicState.coreDumpOnPanic = Config_GetBool(TRUE, "coreDumpOnPanic"); panicState.loopOnPanic = Config_GetBool(FALSE, "panic.loopOnPanic"); - panicState.breakOnPanic = Config_GetLong(PanicBreakLevel_Never, - "panic.breakOnPanic"); + panicState.breakOnPanic = Config_GetLong(PanicBreakAction_Never, + "panic.breakOnPanic"); panicState.coreDumpFlags = Config_GetLong(0, "coreDumpFlags"); } @@ -297,9 +291,9 @@ Panic_BreakOnPanic(void) } #else // Posix switch (panicState.breakOnPanic) { - case PanicBreakLevel_Never: + case PanicBreakAction_Never: break; - case PanicBreakLevel_IfDebuggerAttached: + case PanicBreakAction_IfDebuggerAttached: { void (*handler)(int); handler = signal(SIGTRAP, SIG_IGN); @@ -313,7 +307,7 @@ Panic_BreakOnPanic(void) } break; default: - case PanicBreakLevel_Always: + case PanicBreakAction_Always: Warning("Panic: breaking into debugger\n"); # if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) __asm__ __volatile__ ("int3"); @@ -329,10 +323,9 @@ Panic_BreakOnPanic(void) /* *----------------------------------------------------------------------------- * - * Panic_SetBreakOnPanic -- + * Panic_SetBreakAction -- * - * Allow the debug breakpoint on panic to be suppressed. If passed FALSE, - * then any subsequent Panics will not attempt to attract a debugger. + * Allow the debug breakpoint on panic to be suppressed. * * Results: * void. @@ -344,10 +337,32 @@ Panic_BreakOnPanic(void) */ void -Panic_SetBreakOnPanic(Bool breakOnPanic) +Panic_SetBreakAction(PanicBreakAction action) // IN: +{ + panicState.breakOnPanic = action; +} + + +/* + *----------------------------------------------------------------------------- + * + * Panic_GetBreakAction -- + * + * Return the break action that will be taken on an eventual panic. + * + * Results: + * The current break action. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +PanicBreakAction +Panic_GetBreakAction(void) { - panicState.breakOnPanic = breakOnPanic ? PanicBreakLevel_Always - : PanicBreakLevel_Never; + return panicState.breakOnPanic; } @@ -374,9 +389,9 @@ Panic_GetBreakOnPanic(void) Bool shouldBreak = FALSE; switch (panicState.breakOnPanic) { - case PanicBreakLevel_Never: + case PanicBreakAction_Never: break; - case PanicBreakLevel_IfDebuggerAttached: + case PanicBreakAction_IfDebuggerAttached: #ifdef _WIN32 shouldBreak = IsDebuggerPresent(); #else @@ -388,7 +403,7 @@ Panic_GetBreakOnPanic(void) #endif break; default: - case PanicBreakLevel_Always: + case PanicBreakAction_Always: shouldBreak = TRUE; break; }