]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
tools: minor cleanups.
authorVMware, Inc <>
Mon, 20 Dec 2010 22:22:16 +0000 (14:22 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 20 Dec 2010 22:22:16 +0000 (14:22 -0800)
. remove lib/conf; Conf_Load() was only used in one place for legacy reasons,
so move the code there.
. remove some unneeded files from open-vm-tools.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
14 files changed:
open-vm-tools/configure.ac
open-vm-tools/lib/Makefile.am
open-vm-tools/lib/conf/Makefile.am [deleted file]
open-vm-tools/lib/conf/conf.c [deleted file]
open-vm-tools/lib/guestApp/guestApp.c
open-vm-tools/lib/include/conf.h
open-vm-tools/lib/include/productState.h [deleted file]
open-vm-tools/lib/include/stats_user_defs.h [deleted file]
open-vm-tools/lib/include/stats_user_setup.h [deleted file]
open-vm-tools/lib/include/vcpuid.h [deleted file]
open-vm-tools/lib/panic/panic.c
open-vm-tools/libvmtools/Makefile.am
open-vm-tools/libvmtools/vmtoolsConfig.c
open-vm-tools/toolbox/Makefile.am

index f5df192aaee0a844f123a949e458d2ceb1431508..3aa11af19e69e81265b98344025553f816de6856 100644 (file)
@@ -1164,7 +1164,6 @@ AC_CONFIG_FILES([                      \
    lib/appUtil/Makefile                \
    lib/auth/Makefile                   \
    lib/backdoor/Makefile               \
-   lib/conf/Makefile                   \
    lib/dict/Makefile                   \
    lib/dynxdr/Makefile                 \
    lib/err/Makefile                    \
index f1d08fe7f76b3e1888df5cb8bbab3ffe7997efa0..1cf2cfb30aabf1cc62e29ef11693093cfec17e8e 100644 (file)
@@ -22,7 +22,6 @@ if HAVE_X11
 endif
 SUBDIRS += auth
 SUBDIRS += backdoor
-SUBDIRS += conf
 SUBDIRS += dict
 SUBDIRS += dynxdr
 SUBDIRS += err
diff --git a/open-vm-tools/lib/conf/Makefile.am b/open-vm-tools/lib/conf/Makefile.am
deleted file mode 100644 (file)
index c673b50..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-################################################################################
-### Copyright 2007 VMware, Inc.  All rights reserved.
-###
-### This program is free software; you can redistribute it and/or modify
-### it under the terms of version 2 of the GNU General Public License as
-### published by the Free Software Foundation.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-### GNU General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with this program; if not, write to the Free Software
-### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-################################################################################
-
-noinst_LTLIBRARIES = libConf.la
-
-libConf_la_SOURCES =
-libConf_la_SOURCES += conf.c
diff --git a/open-vm-tools/lib/conf/conf.c b/open-vm-tools/lib/conf/conf.c
deleted file mode 100644 (file)
index 3e6808b..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*********************************************************
- * Copyright (C) 2002 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
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * conf.c --
- *
- *    Manage the tools configuration file.
- *
- */
-
-#ifndef VMX86_DEVEL
-
-#endif
-
-
-#include <stdlib.h>
-
-#include "vm_assert.h"
-#include "guestApp.h"
-#include "util.h"
-#include "str.h"
-#include "conf.h"
-#include "eventManager.h"
-#include "debug.h"
-
-
-/*
- *----------------------------------------------------------------------
- *
- * Conf_Load --
- *
- *      Set the conf dict's default values then attempt to load the
- *      conf file into memory.
- *
- * Results:
- *      
- *      The conf dict.
- *
- * Side effects:
- *
- *      None.
- *
- *----------------------------------------------------------------------
- */
-
-GuestApp_Dict *
-Conf_Load(void)
-{
-   GuestApp_Dict *confDict;
-   char *path;
-   char *confPath = GuestApp_GetConfPath();
-   char *installPath = GuestApp_GetInstallPath();
-
-   if (confPath == NULL) {
-      Panic("Could not get path to Tools configuration file.\n");
-   }
-
-   path = Str_Asprintf(NULL, "%s%c%s", confPath, DIRSEPC, CONF_FILE);
-   ASSERT_NOT_IMPLEMENTED(path);
-   confDict = GuestApp_ConstructDict(path);
-   /* don't free path; it's used by the dict */
-
-   /* Set default conf values */
-   if (installPath != NULL) {
-      path = Str_Asprintf(NULL, "%s%c%s", installPath, DIRSEPC,
-                          CONFVAL_POWERONSCRIPT_DEFAULT);
-      ASSERT_NOT_IMPLEMENTED(path);
-      GuestApp_SetDictEntryDefault(confDict, CONFNAME_POWERONSCRIPT, path);
-      free(path);
-
-      path = Str_Asprintf(NULL, "%s%c%s", installPath, DIRSEPC,
-                          CONFVAL_POWEROFFSCRIPT_DEFAULT);
-      ASSERT_NOT_IMPLEMENTED(path);
-      GuestApp_SetDictEntryDefault(confDict, CONFNAME_POWEROFFSCRIPT, path);
-      free(path);
-
-      path = Str_Asprintf(NULL, "%s%c%s", installPath, DIRSEPC,
-                          CONFVAL_RESUMESCRIPT_DEFAULT);
-      ASSERT_NOT_IMPLEMENTED(path);
-      GuestApp_SetDictEntryDefault(confDict, CONFNAME_RESUMESCRIPT, path);
-      free(path);
-
-      path = Str_Asprintf(NULL, "%s%c%s", installPath, DIRSEPC,
-                          CONFVAL_SUSPENDSCRIPT_DEFAULT);
-      ASSERT_NOT_IMPLEMENTED(path);
-      GuestApp_SetDictEntryDefault(confDict, CONFNAME_SUSPENDSCRIPT, path);
-      free(path);
-
-      free(installPath);
-   } else {
-      Warning("Could not get path to Tools installation.\n");
-   }
-
-   GuestApp_SetDictEntryDefault(confDict, CONFNAME_MAX_WIPERSIZE,
-                                CONFVAL_MAX_WIPERSIZE_DEFAULT);
-
-   /* Load the user-configured values from the conf file if it's there */
-   GuestApp_LoadDict(confDict);
-
-   free(confPath);
-
-   return confDict;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * Conf_ReloadFile --
- *
- *      Reload the conf dict if the conf file has changed.
- *      Callers are expected to add this function to the event loop to 
- *      periodically read in configuration values.
- *
- * Results:
- *      
- *      TRUE is file was reloaded, FALSE otherwise.
- *
- * Side effects:
- *
- *          None.
- *
- *----------------------------------------------------------------------
- */
-
-Bool
-Conf_ReloadFile(GuestApp_Dict **pConfDict) // IN/OUT
-{ 
-   ASSERT(pConfDict);
-   ASSERT(*pConfDict);
-   
-   if (GuestApp_WasDictFileChanged(*pConfDict)) {
-      Debug("Conf file out of date; reloading...\n");
-
-      GuestApp_FreeDict(*pConfDict);
-      *pConfDict = Conf_Load();
-
-      return TRUE;
-   }
-   return FALSE;
-}
index 1cf36cbfcfdcd309188dd66514d40c7195a05e2e..2a0064e702f8fbaa19b135368c60a536027c45f6 100644 (file)
 #include "msg.h"
 #include "file.h"
 #include "codeset.h"
-#include "productState.h"
 #include "posix.h"
 #include "vmware/guestrpc/tclodefs.h"
 
 #ifdef _MSC_VER
 #include <windows.h>
 #include <shlobj.h>
+#include "productState.h"
 #include "winregistry.h"
 #endif
 
index a2646b7a3caea500b669f1a6eaf39d7bd4ea0c13..5be5acf50e394ff790156ad7f50eb10400baf1d4 100644 (file)
 /* Wait 5 seconds between polls to see if the conf file has changed */
 #define CONF_POLL_TIME     500
 
-GuestApp_Dict *Conf_Load(void);
-Bool Conf_ReloadFile(GuestApp_Dict **pConfDict);
-
 #endif /* __CONF_H__ */
diff --git a/open-vm-tools/lib/include/productState.h b/open-vm-tools/lib/include/productState.h
deleted file mode 100644 (file)
index 219a193..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*********************************************************
- * Copyright (C) 2006 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
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * productState.h --
- *
- *      ProductState is a runtime encapsulation of the identity of a product
- *      and product dependent characteristics.
- */
-
-
-#ifndef _PRODUCT_STATE_H_
-#define _PRODUCT_STATE_H_
-
-#include "vm_basic_types.h"
-
-
-/*
- * Public types.
- */
-
-typedef enum {
-   PRODUCT_GENERIC = 0,
-   PRODUCT_WORKSTATION = 1 << 0,
-   PRODUCT_SERVER = 1 << 1,
-   PRODUCT_ESX = 1 << 2,
-   PRODUCT_PLAYER = 1 << 3,
-   PRODUCT_TOOLS = 1 << 4,
-   PRODUCT_VDM_CLIENT = 1 << 5,
-   PRODUCT_CVP = 1 << 6,
-   PRODUCT_FUSION = 1 << 7,
-   /* etc */
-} Product;
-typedef uint64 ProductMask;
-#define PRODUCTMASK_HOSTED (PRODUCT_WORKSTATION |\
-                            PRODUCT_SERVER      |\
-                            PRODUCT_PLAYER      |\
-                            PRODUCT_CVP         |\
-                            PRODUCT_FUSION)
-
-typedef uint64 ProductCaps;
-/*
- * Define as needed.
- *
- * #define PRODUCT_CAP_FOO (1 << 0)
- */
-
-typedef enum {
-   PRODUCTSTATE_FLAG_NONE = 0,
-   PRODUCTSTATE_FLAG_PRODUCT = 1 << 0,
-   PRODUCTSTATE_FLAG_NAME = 1 << 1,
-   PRODUCTSTATE_FLAG_VERSION = 1 << 2,
-   PRODUCTSTATE_FLAG_BUILDNUMBER = 1 << 3,
-   PRODUCTSTATE_FLAG_CAPABILITIES = 1 << 4,
-   PRODUCTSTATE_FLAG_LICENSENAME = 1 << 5,
-   PRODUCTSTATE_FLAG_LICENSEVERSION = 1 << 6,
-} ProductStateSerializationFlags;
-
-/*
- * Public functions.
- *
- * PR 567850
- * ProductState_Set should only be called once. Subsequent calls will be ignored.
- */
-
-void ProductState_Set(Product product, const char *name, const char *version,
-                      unsigned int buildNumber, ProductCaps capabilities,
-                      const char *licenseName, const char *licenseVersion);
-
-Product ProductState_GetProduct(void);
-Bool ProductState_IsProduct(ProductMask product);
-const char *ProductState_GetName(void);
-const char *ProductState_GetVersion(void);
-unsigned int ProductState_GetBuildNumber(void);
-ProductCaps ProductState_GetCapabilities(void);
-const char *ProductState_GetLicenseName(void);
-const char *ProductState_GetLicenseVersion(void);
-/* etc */
-
-const char *ProductState_GetFullVersion(void);
-const char *ProductState_GetBuildNumberString(void);
-const char *ProductState_GetRegistryPath(void);
-char *ProductState_GetRegistryPathForProduct(const char *productName);
-void ProductState_GetVersionNumber(unsigned int *major, unsigned int *minor,
-                                   unsigned int *patchLevel);
-
-char *ProductState_Serialize(ProductStateSerializationFlags flags);
-ProductStateSerializationFlags ProductState_Deserialize(const char *state);
-
-
-#endif /* _PRODUCT_STATE_H_ */
diff --git a/open-vm-tools/lib/include/stats_user_defs.h b/open-vm-tools/lib/include/stats_user_defs.h
deleted file mode 100644 (file)
index e5ec9ae..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*********************************************************
- * Copyright (C) 1998 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
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * stats_user_defs.h --
- *
- *      Defines for user statcounters.  This started life as a clone of
- *      stats_defs.h, which is too monitor entangled to easily work outside
- *      of vmx code (e.g. in lib).
- */
-
-#ifndef STATS_USER_DEFS_H
-#define STATS_USER_DEFS_H
-
-#define INCLUDE_ALLOW_MODULE
-#define INCLUDE_ALLOW_USERLEVEL
-#define INCLUDE_ALLOW_VMCORE
-#include "includeCheck.h"
-
-#include "vm_atomic.h"
-
-#ifndef STATS_MODULE
-#error "stats_user_defs.h must be included with STATS_MODULE defined"
-#endif
-
-#define EXTERN_STAT_DECL(_name, _desc)
-#define STAT_DECL(_name, _desc)
-
-#define STATS_USER_MODULE_STR  XSTR(XCONC(STATS_, STATS_MODULE))
-#define STATS_USER_NAME(name)  XCONC(STAT_, XCONC(STATS_MODULE, _##name))
-#define STATS_USER_BLKVAR      XCONC(_stats_, XCONC(STATS_MODULE, _Blk))
-#define STATS_USER_LOG_FN(name)XCONC(name, _StatsLog)
-#define STATS_USER_INST_NAME(name) \
-        XCONC(STATINST_, XCONC(STATS_MODULE, _##name))
-#define STATS_USER_INIT_INST_FN(name)   XCONC(name, _InitInstance)
-#define STATS_USER_GETVAL_FN(name) XCONC(name, _StatsGetVal)
-
-typedef struct StatsUserEntry {
-   uint32 count;
-} StatsUserEntry;
-
-typedef struct StatsUserBlock {
-   const char     *name;
-   uint32          size;
-   StatsUserEntry *counters;
-   Atomic_Ptr      next;
-} StatsUserBlock;
-
-EXTERN StatsUserBlock STATS_USER_BLKVAR;
-
-#ifndef STATS_SKIP_ACCESSORS
-#define STATS_IS_INITIALIZED()     (STATS_USER_BLKVAR.counters != NULL)
-#define STAT_GET(stat) \
-        (&(STATS_USER_BLKVAR.counters[STATS_USER_NAME(stat)]))
-#define STAT_INST_GET(inst, stat) \
-        (&((inst)->counters[STATS_USER_INST_NAME(stat)]))
-
-#define STAT_SAMPLE(stat)          STAT_GET(stat)->count++
-#ifdef VMX86_STATS
-#  define STAT_INC(stat)          STAT_GET(stat)->count++
-#  define STAT_INC_BY(stat,inc)   STAT_GET(stat)->count += (inc)
-#  define STAT_DEC_BY(stat,inc)   STAT_GET(stat)->count -= (inc)
-#  define STAT_DEBUG_INC(stat)    DEBUG_ONLY(STAT_INC(stat))
-#  define STAT_INST_INC(i,s)          STAT_INST_GET((i), s)->count++
-#  define STAT_INST_INC_BY(i,s,inc)   STAT_INST_GET((i), s)->count += (inc)
-#  define STAT_INST_DEC_BY(i,s,inc)   STAT_INST_GET((i), s)->count -= (inc)
-#  define STAT_INST_DEBUG_INC(i,s)    DEBUG_ONLY(STAT_INST_INC((i), s))
-#else
-#  define STAT_INC(stat)
-#  define STAT_INC_BY(stat,inc)
-#  define STAT_DEC_BY(stat,inc)
-#  define STAT_DEBUG_INC(stat)
-#  define STAT_INST_INC(inst,stat)
-#  define STAT_INST_INC_BY(inst,stat,inc)
-#  define STAT_INST_DEC_BY(inst,stat,inc)
-#  define STAT_INST_DEBUG_INC(stat)
-#endif
-#endif /* STATS_SKIP_ACCESSORS */
-#endif /* STATS_DEFS_H */
diff --git a/open-vm-tools/lib/include/stats_user_setup.h b/open-vm-tools/lib/include/stats_user_setup.h
deleted file mode 100644 (file)
index a8f9137..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/*********************************************************
- * Copyright (C) 2003 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
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-#define INCLUDE_ALLOW_MODULE
-#define INCLUDE_ALLOW_USERLEVEL
-#define INCLUDE_ALLOW_VMCORE
-#include "includeCheck.h"
-
-/*
- * stats_user_setup.h --
- *
- *      The machinery to define statcounters for user at userlevel.  This is
- *      something of a collapsing of stats_setup.h and genstats_setup.h
- *      combined with simplifying to eliminate the monitor entanglements.
- *      The goals are to be simpler to read than the monitor statcounter
- *      code and also (relatedly) easier to use in libs.
- *
- *      Expects at least one of the following:
- *      - SETUP_DECLARE_VARS: Declares the enum for the statcounters (this
- *        is what you need in order to STAT_INC() / DEC() / etc.
- *      - SETUP_DEFINE_VARS: Declares the actual StatsUserBlock with all the
- *        information-- stat names, storage for the counters, etc.
- *
- *      Orthogonally, one can also supply:
- *      - SETUP_WANT_GETVAL: If the includer wants to also {declare, define}
- *        a function to retrieve named stat counter values.
- */
-
-/*
- * This file can be included more than once and should clean up its own
- * defines before finishing each invocation.
- */
-
-#define STAT_NAME_PREFIX STATS
-#define STAT_VAR_PREFIX stats
-
-#ifndef STATS_MODULE
-#error "stats_user_setup.h must be included with STATS_MODULE defined"
-#endif
-
-#if !defined(STATS_COUNTERS_FILE) && !defined(STATS_COUNTERS_INLINE) && \
-    !defined(STATS_COUNTERS_NONE)
-#error "stats_user_setup.h must be included with statcounters defined"
-#endif
-
-#include "vm_basic_defs.h"
-
-#ifdef SETUP_DECLARE_VARS
-   #define STAT(_name, _ignore, _explanation) STATS_USER_NAME(_name),
-   #define STAT_INST(_name, _ignore, _explanation)
-   enum {
-      #ifdef STATS_COUNTERS_FILE
-      #include STATS_COUNTERS_FILE
-      #endif
-      #ifdef STATS_COUNTERS_INLINE
-      STATS_COUNTERS_INLINE
-      #endif
-      STAT(Last, unused, "So we always know the number of counters")
-   };
-   #undef STAT
-   #undef STAT_INST
-
-   #define STAT(_name, _ignore, _explanation)
-   #define STAT_INST(_name, _ignore, _explanation) STATS_USER_INST_NAME(_name),
-   enum {
-      #ifdef STATS_COUNTERS_FILE
-      #include STATS_COUNTERS_FILE
-      #endif
-      #ifdef STATS_COUNTERS_INLINE
-      STATS_COUNTERS_INLINE
-      #endif
-      STAT_INST(Last, unused, "So we always know the number of counters")
-   };
-
-   EXTERN StatsUserBlock STATS_USER_BLKVAR;
-   EXTERN void STATS_USER_LOG_FN(STATS_MODULE)(unsigned int epoch,
-                                         void (*LogFunc)(const char *fmt, ...));
-
-   #ifdef SETUP_WANT_GETVAL
-   EXTERN Bool STATS_USER_GETVAL_FN(STATS_MODULE)(const char *name,
-                                                  uint32 *val);
-   #endif /* SETUP_WANT_GETVAL */
-
-   #undef STAT
-   #undef STAT_INST
-#endif
-
-
-#ifdef SETUP_DEFINE_VARS
-   /*
-    * Build a table of counter names so we can log them.
-    */
-   #define STAT(_name, _ignore, _explanation) XSTR(XXCONC(STATS_MODULE, XCONC(_,_name))),
-   #define STAT_INST(_name, _ignore, _explanation)
-   #define STATS_USER_STR_TABLE       XCONC(STAT_USER_VAR_PREFIX, StrTable)
-   static const char *STATS_USER_STR_TABLE[] = {
-      #ifdef STATS_COUNTERS_FILE
-      #include STATS_COUNTERS_FILE
-      #endif
-      #ifdef STATS_COUNTERS_INLINE
-      STATS_COUNTERS_INLINE
-      #endif
-      XSTR(XCONC(STATS_MODULE, _Last))
-   };
-   #undef STAT
-   #undef STAT_INST
-
-   #define STAT(_name, _ignore, _explanation)
-   #define STAT_INST(_name, _ignore, _explanation) XSTR(_name),
-   #define STATS_USER_INST_STR_TABLE       XCONC(STAT_USER_VAR_PREFIX, InstStrTable)
-   static const char *STATS_USER_INST_STR_TABLE[] = {
-      #ifdef STATS_COUNTERS_FILE
-      #include STATS_COUNTERS_FILE
-      #endif
-      #ifdef STATS_COUNTERS_INLINE
-      STATS_COUNTERS_INLINE
-      #endif
-      XSTR(XCONC(STATS_MODULE, _Last))
-   };
-   #undef STAT
-   #undef STAT_INST
-
-   /*
-    * Define the StatsUserBlock itself for this module.
-    */
-   StatsUserBlock STATS_USER_BLKVAR;
-
-
-   /*
-    *----------------------------------------------------------------------
-    *
-    * STATS_USER_LOG_FN --
-    *
-    *   For logging purposes, we auto-generate a (non-INLINE) function to
-    *   iterate over all the counters and dump them.  This seems nicer than
-    *   making all clients cookie-cutter this code or else link against an
-    *   external binary to get this functionality.
-    *
-    * Results:
-    *   void
-    *
-    * Side Effects:
-    *   Spewification
-    *----------------------------------------------------------------------
-    */
-
-   void
-   STATS_USER_LOG_FN(STATS_MODULE)(unsigned int epoch,
-                                   void (*LogFunc)(const char *fmt, ...))
-   {
-      StatsUserBlock *cur;
-      unsigned int i;
-
-      if (!STATS_IS_INITIALIZED()) {
-         return;
-      }
-
-      for (i = 0; i < STATS_USER_BLKVAR.size; i++) {
-         if (STATS_USER_BLKVAR.counters[i].count > 0) {
-            LogFunc("STAT %u %-26s %10d\n", epoch,
-                STATS_USER_STR_TABLE[i], STATS_USER_BLKVAR.counters[i].count);
-         }
-      }
-      for (cur = Atomic_ReadPtr(&STATS_USER_BLKVAR.next);
-           cur != NULL;
-           cur = Atomic_ReadPtr(&cur->next)) {
-         for (i = 0; i < cur->size; i++) {
-            if (cur->counters[i].count > 0) {
-               LogFunc("STATINST %u %s:%-20s %-15s %10d\n",
-                   epoch, XSTR(STATS_MODULE), cur->name,
-                   STATS_USER_INST_STR_TABLE[i], cur->counters[i].count);
-            }
-         }
-      }
-   }
-
-   #ifdef SETUP_WANT_GETVAL
-   /*
-    *----------------------------------------------------------------------
-    *
-    * STATS_USER_GETVAL_FN --
-    *
-    *      Retrieves the value of a named user stat counter.  Returns
-    *      TRUE iff NAME is a recognized user stat counter, and sets
-    *      *VAL to the current value of that counter.
-    *
-    *      This is an optional function.  If a library needs it, use
-    *      SETUP_WANT_GETVAL (see top of the header).
-    *
-    * Results:
-    *      See above.
-    *
-    * Side effects:
-    *      None.
-    *
-    *----------------------------------------------------------------------
-    */
-
-   Bool
-   STATS_USER_GETVAL_FN(STATS_MODULE)(const char *name,  // IN: counter name
-                                      uint32 *val)       // OUT: counter val
-   {
-      unsigned int i;
-
-      if (!STATS_IS_INITIALIZED()) {
-         return FALSE;
-      }
-
-      for (i = 0; i < STATS_USER_BLKVAR.size; i++) {
-         if (strcmp(STATS_USER_STR_TABLE[i], name) == 0) {
-            *val = STATS_USER_BLKVAR.counters[i].count;
-            return TRUE;
-         }
-      }
-      return FALSE;
-   }
-   #endif /* SETUP_WANT_GETVAL */
-
-   #undef STATS_USER_STR_TABLE
-   #undef STATS_USER_INST_STR_TABLE
-#endif
-
-#if defined(SETUP_DECLARE_VARS) || defined(SETUP_DEFINE_VARS)
-   #include "util.h"
-
-   /*
-    * Initializes Stats at user-level. The user-level variables statsCount,
-    * and statsInfoTable are defined by including "stats_user_setup.h" with
-    * the appropriate parameters.
-    */
-   #define STATS_USER_INIT_MODULE()                                        \
-   do {                                                                    \
-      STATS_USER_BLKVAR.counters =                                         \
-         Util_SafeCalloc(STATS_USER_NAME(Last), sizeof(StatsUserEntry));   \
-      STATS_USER_BLKVAR.size = STATS_USER_NAME(Last);                      \
-      STATS_USER_BLKVAR.name = XSTR(STATS_MODULE);                         \
-   } while (0)
-
-   #define STATS_USER_INIT_MODULE_ONCE()                                   \
-   do {                                                                    \
-      if (!STATS_IS_INITIALIZED()) {                                       \
-         STATS_USER_INIT_MODULE();                                         \
-      }                                                                    \
-   } while (0)
-
-   #define STATS_USER_EXIT_MODULE()                                        \
-   do {                                                                    \
-      free(STATS_USER_BLKVAR.counters);                                    \
-      STATS_USER_BLKVAR.counters = NULL;                                   \
-   } while (0)
-
-
-   #ifndef STATS_USER_INIT_INST
-   /*
-    *----------------------------------------------------------------------
-    *
-    * STATS_USER_INIT_INST --
-    *
-    *      Stats Instancing:  Some stats are by their nature per-adapter /
-    *      per-handle, etc. so we allow the code to dynamically create extra
-    *      statcounters and we return a pointer that can be used when setting
-    *      them later.  We keep all the instances in a list hanging off
-    *      STATS_USER_BLKVAR so we can enumerate all of them at logging time.
-    *
-    * Results:
-    *      The new instance of stats.
-    *
-    * Side Effects:
-    *      Some memory allocation
-    *----------------------------------------------------------------------
-    */
-
-   static INLINE StatsUserBlock *
-   STATS_USER_INIT_INST_FN(STATS_MODULE)(const char *instanceName)
-   {
-      StatsUserBlock *e;
-      StatsUserBlock *cur;
-      Atomic_Ptr *nextptr = &STATS_USER_BLKVAR.next;
-
-      while ((cur = Atomic_ReadPtr(nextptr)) != NULL) {
-         if (strcmp(instanceName, cur->name) == 0) {
-             return cur;
-         }
-         nextptr = &cur->next;
-      }
-      e = Util_SafeCalloc(1, sizeof *e);
-      e->size = STATS_USER_INST_NAME(Last);
-      e->counters = Util_SafeCalloc(e->size, sizeof(StatsUserEntry));
-      e->name = Util_SafeStrdup(instanceName);
-      while ((cur = Atomic_ReadIfEqualWritePtr(nextptr, NULL, e)) != NULL) {
-         do {
-            if (strcmp(instanceName, cur->name) == 0) {
-               free(e->counters);
-               free((char *)e->name);
-               free(e);
-               return cur;
-            }
-            nextptr = &cur->next;
-         } while ((cur = Atomic_ReadPtr(nextptr)) != NULL);
-      }
-
-      return e;
-   }
-
-   #define STATS_USER_INIT_INST(name) \
-        STATS_USER_INIT_INST_FN(STATS_MODULE)(name)
-   #endif
-#endif
-
-#undef SETUP_DECLARE_VARS
-#undef SETUP_DEFINE_VARS
-#undef STAT_NAME_PREFIX
-#undef STAT_VAR_PREFIX
diff --git a/open-vm-tools/lib/include/vcpuid.h b/open-vm-tools/lib/include/vcpuid.h
deleted file mode 100644 (file)
index 6422453..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*********************************************************
- * Copyright (C) 1998-2003 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
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- *
- * vcpuid.h --
- *
- *    Monitor's VCPU ID.
- */
-
-#ifndef _VCPUID_H_
-#define _VCPUID_H_
-
-#define INCLUDE_ALLOW_USERLEVEL
-
-#define INCLUDE_ALLOW_MODULE
-#define INCLUDE_ALLOW_VMMON
-#define INCLUDE_ALLOW_VMKERNEL
-#define INCLUDE_ALLOW_VMK_MODULE
-#define INCLUDE_ALLOW_DISTRIBUTE
-#define INCLUDE_ALLOW_VMCORE
-#include "includeCheck.h"
-
-#include "vm_basic_types.h"
-
-
-typedef uint32 Vcpuid;                 // VCPU number
-
-#define VCPUID_INVALID (~0U)
-
-#define BOOT_VCPU_ID     0
-#define IS_BOOT_VCPUID(vcpuid)  ((vcpuid) == BOOT_VCPU_ID)
-
-#define MAX_VCPUS      64
-
-#ifdef VMM
-/* In VMM, CurVcpuid() is available everywhere. */
-extern const Vcpuid curVcpuid;
-#define CurVcpuid()             (curVcpuid)
-#define IS_BOOT_VCPU()         IS_BOOT_VCPUID(CurVcpuid())
-#endif
-
-#endif // ifndef _VCPUID_H_
index 180e28c28ffcb4777b86bdadae96decad43cd4e1..937a90e60969719bf6c4ad6f75f548944c05e495 100644 (file)
@@ -34,7 +34,6 @@
 #endif // Win32 vs Posix
 
 #include "vmware.h"
-#include "productState.h"
 #include "vm_version.h"
 #include "log.h"
 #include "panic.h"
index 1aab42ea2a3115d2a5cdf544f9d0ddabef4f0a58..68cdd72122c43e2c24a0908ff2c083b0d90c6421 100644 (file)
@@ -20,7 +20,6 @@ lib_LTLIBRARIES = libvmtools.la
 libvmtools_la_LIBADD =
 libvmtools_la_LIBADD += ../lib/lock/libLock.la
 libvmtools_la_LIBADD += ../lib/backdoor/libBackdoor.la
-libvmtools_la_LIBADD += ../lib/conf/libConf.la
 libvmtools_la_LIBADD += ../lib/dict/libDict.la
 libvmtools_la_LIBADD += ../lib/dynxdr/libDynxdr.la
 libvmtools_la_LIBADD += ../lib/err/libErr.la
index e0789fe23705d3b669b38b3858d9b5f6a0e045af..16193715ab51dbc4d515ac44beba2b0bca799b70 100644 (file)
@@ -33,6 +33,8 @@
 #include "vm_assert.h"
 #include "conf.h"
 #include "guestApp.h"
+#include "str.h"
+#include "util.h"
 
 /** Data types supported for translation. */
 typedef enum {
@@ -53,6 +55,73 @@ typedef struct ConfigEntry {
 
 typedef void (*CfgCallback)(GKeyFile *cfg, const ConfigEntry *, const char *);
 
+
+/**
+ * Loads the legacy configuration file in the VMware dictionary format.
+ *
+ * @return A dictionary with the config data.
+ */
+
+static GuestApp_Dict *
+VMToolsConfigLoadLegacy(void)
+{
+   GuestApp_Dict *confDict;
+   char *path;
+   char *confPath = GuestApp_GetConfPath();
+   char *installPath = GuestApp_GetInstallPath();
+
+   if (confPath == NULL) {
+      Panic("Could not get path to Tools configuration file.\n");
+   }
+
+   path = Str_Asprintf(NULL, "%s%c%s", confPath, DIRSEPC, CONF_FILE);
+   ASSERT_NOT_IMPLEMENTED(path);
+   confDict = GuestApp_ConstructDict(path);
+   /* don't free path; it's used by the dict */
+
+   /* Set default conf values */
+   if (installPath != NULL) {
+      path = Str_Asprintf(NULL, "%s%c%s", installPath, DIRSEPC,
+                          CONFVAL_POWERONSCRIPT_DEFAULT);
+      ASSERT_NOT_IMPLEMENTED(path);
+      GuestApp_SetDictEntryDefault(confDict, CONFNAME_POWERONSCRIPT, path);
+      free(path);
+
+      path = Str_Asprintf(NULL, "%s%c%s", installPath, DIRSEPC,
+                          CONFVAL_POWEROFFSCRIPT_DEFAULT);
+      ASSERT_NOT_IMPLEMENTED(path);
+      GuestApp_SetDictEntryDefault(confDict, CONFNAME_POWEROFFSCRIPT, path);
+      free(path);
+
+      path = Str_Asprintf(NULL, "%s%c%s", installPath, DIRSEPC,
+                          CONFVAL_RESUMESCRIPT_DEFAULT);
+      ASSERT_NOT_IMPLEMENTED(path);
+      GuestApp_SetDictEntryDefault(confDict, CONFNAME_RESUMESCRIPT, path);
+      free(path);
+
+      path = Str_Asprintf(NULL, "%s%c%s", installPath, DIRSEPC,
+                          CONFVAL_SUSPENDSCRIPT_DEFAULT);
+      ASSERT_NOT_IMPLEMENTED(path);
+      GuestApp_SetDictEntryDefault(confDict, CONFNAME_SUSPENDSCRIPT, path);
+      free(path);
+
+      free(installPath);
+   } else {
+      Warning("Could not get path to Tools installation.\n");
+   }
+
+   GuestApp_SetDictEntryDefault(confDict, CONFNAME_MAX_WIPERSIZE,
+                                CONFVAL_MAX_WIPERSIZE_DEFAULT);
+
+   /* Load the user-configured values from the conf file if it's there */
+   GuestApp_LoadDict(confDict);
+
+   free(confPath);
+
+   return confDict;
+}
+
+
 /**
  * Upgrade the logging configuration.
  *
@@ -302,11 +371,11 @@ VMTools_LoadConfig(const gchar *path,
 
    /*
     * Failed to load the config file; try to upgrade if requested. But only do
-    * it if the user is using the default conf file path; the old "Conf_Load()"
-    * API doesn't allow us to provide a custom config file path.
+    * it if the user is using the default conf file path; the legacy API doesn't
+    * allow us to provide a custom config file path.
     */
    if (path == NULL) {
-      old = Conf_Load();
+      old = VMToolsConfigLoadLegacy();
       if (old == NULL) {
          g_warning("Error loading old tools config data, bailing out.\n");
          goto error;
index 662283ff42c3f4841e206769e6bd9b05260bbf81..536b21d196fff16b10654d11ec697168d6958d2c 100644 (file)
@@ -16,7 +16,6 @@
 ################################################################################
 
 COMMON =
-COMMON += ../lib/conf/libConf.la
 COMMON += ../lib/eventManager/libEventManager.la
 COMMON += ../lib/file/libFile.la
 COMMON += ../lib/hgfs/libHgfs.la