From: VMware, Inc <> Date: Tue, 19 Oct 2010 18:52:49 +0000 (-0700) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2010.10.18-313025~68 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b419f4048dd40c913b0e7d608742bb2ee0b9bc03;p=thirdparty%2Fopen-vm-tools.git Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/log.h b/open-vm-tools/lib/include/log.h index 7ab09c105..596799d5a 100644 --- a/open-vm-tools/lib/include/log.h +++ b/open-vm-tools/lib/include/log.h @@ -82,6 +82,101 @@ #define LOG_DEBUG_09 LOG_DEBUG + 9 #define LOG_DEBUG_10 LOG_DEBUG + 10 +void LogV(int level, + const char *fmt, + va_list args); + + +/* + * Handy wrapper functions. + * + * Log -> LOG_INFO + * Warning -> LOG_WARNING + * + * TODO: even Log and Warning become wrapper functions around LogV. + */ + +static INLINE void +Log_Level(int level, + const char *fmt, + ...) +{ + va_list ap; + + va_start(ap, fmt); + LogV(level, fmt, ap); + va_end(ap); +} + + +static INLINE void +Log_String(int level, + const char *string) +{ + Log_Level(level, "%s", string); +} + + +static INLINE void +Log_Emerg(const char *fmt, + ...) +{ + va_list ap; + + va_start(ap, fmt); + LogV(LOG_EMERG, fmt, ap); + va_end(ap); +} + + +static INLINE void +Log_Alert(const char *fmt, + ...) +{ + va_list ap; + + va_start(ap, fmt); + LogV(LOG_ALERT, fmt, ap); + va_end(ap); +} + + +static INLINE void +Log_Crit(const char *fmt, + ...) +{ + va_list ap; + + va_start(ap, fmt); + LogV(LOG_CRIT, fmt, ap); + va_end(ap); +} + + +static INLINE void +Log_Err(const char *fmt, + ...) +{ + va_list ap; + + va_start(ap, fmt); + LogV(LOG_ERR, fmt, ap); + va_end(ap); +} + + +static INLINE void +Log_Notice(const char *fmt, + ...) +{ + va_list ap; + + va_start(ap, fmt); + LogV(LOG_NOTICE, fmt, ap); + va_end(ap); +} + +#if !defined(VMM) typedef void (LogBasicFunc)(const char *fmt, va_list args); @@ -145,7 +240,6 @@ void Log_UpdatePerLine(Bool perLineTimeStamps, void Log_Exit(void); void Log_SetConfigDir(const char *configDir); -void Log_WriteBytes(const char *msg); Bool Log_Outputting(void); const char *Log_GetFileName(void); @@ -171,91 +265,6 @@ size_t Log_MakeTimeString(Bool millisec, char *buf, size_t max); -void LogV(int level, - const char *fmt, - va_list args); - - -static INLINE void -Log_Level(int level, - const char *fmt, - ...) -{ - va_list ap; - - va_start(ap, fmt); - LogV(level, fmt, ap); - va_end(ap); -} - -/* - * Handy wrapper functions. - * - * Log -> LOG_INFO - * Warning -> LOG_WARNING - * - * TODO: even Log and Warning become wrapper functions around LogV. - */ - -static INLINE void -Log_Emerg(const char *fmt, - ...) -{ - va_list ap; - - va_start(ap, fmt); - LogV(LOG_EMERG, fmt, ap); - va_end(ap); -} - - -static INLINE void -Log_Alert(const char *fmt, - ...) -{ - va_list ap; - - va_start(ap, fmt); - LogV(LOG_ALERT, fmt, ap); - va_end(ap); -} - - -static INLINE void -Log_Crit(const char *fmt, - ...) -{ - va_list ap; - - va_start(ap, fmt); - LogV(LOG_CRIT, fmt, ap); - va_end(ap); -} - - -static INLINE void -Log_Err(const char *fmt, - ...) -{ - va_list ap; - - va_start(ap, fmt); - LogV(LOG_ERR, fmt, ap); - va_end(ap); -} - - -static INLINE void -Log_Notice(const char *fmt, - ...) -{ - va_list ap; - - va_start(ap, fmt); - LogV(LOG_NOTICE, fmt, ap); - va_end(ap); -} - /* Logging that uses the custom guest throttling configuration. */ void GuestLog_Init(void); @@ -306,4 +315,5 @@ void Log_Histogram(uint32 n, int *count, int limit); +#endif /* !VMM */ #endif /* VMWARE_LOG_H */