Guest VMCI Interface: Every request will pass meta Packet as contiguous buffer and data packet
as set of struct pages. This is linux guest only. Note that even contiguous buffer will be sliced
down into many pages when passed to the host.
Use req->bufferSize instead of HGFS_PACKET_MAX so that each transport can allocate packet
of variable size.
Part-2: Hgfs VMCI Interface for linux host.
Implement new interfaces for communication between hgfsServer
and transport layer. Earlier hgfsUtil.c was implemented which
was thought to be too complicated. Now a less(?) complicated
version hgfsServerPacketUtil.c has been added.
Removed memcpy from backdoor, tools code. Write reply directly
into guest memory.
I thought about reference counting but realized that it is not
required. It would have been useful if the system could hold onto
memory for long time but we are guaranteed to release all the
memory at packet Send, so I am not too worried about it.
Support legacy freeze / thaw scripts in the vmbackup plugin.
The old "sync driver path" used by hostd manually invoked these
scripts during a quiesced snapshot. Since that code is being removed
from hostd, add code in Tools to at least cover the default case.
(hostd allowed the paths to be configured, but we can't read
that from inside the guest).
VMware, Inc [Mon, 22 Mar 2010 22:19:01 +0000 (15:19 -0700)]
VSOCK: fix compile warnings on recent kernels
During 2.6.33 merge window net_proto_ops->create() method was
changed - a new 'kern' field, signalling whether socket is being
created by kernel or userspace application, was added to it.
During 2.6.34 merge window type optsize of argument to
proto_ops->setsockopt() method was changed from 'int' to
'unsigned int'. Here we are trying to cope with the changes.
VMware, Inc [Mon, 22 Mar 2010 22:17:57 +0000 (15:17 -0700)]
VMXNET: Fix compilation on kernel 2.6.34-rc1+
change_mtu() method was removed from netdevice and moved into
net_device_ops. HAVE_CHANGE_MTU was removed as well which
caused vmxnet_change_mtu to be omitted but it is still needed.
VMware, Inc [Mon, 22 Mar 2010 22:17:37 +0000 (15:17 -0700)]
Rework the "disksFrozen" hack to be more generic.
CS 1010838 added a hack to work around an issue with the Win32 sync driver.
The hack is simpler than the more generic solution, which is fine for
the release branch it was targeted at, but changing the public plugin
API for such things is in general a bad idea.
This change implements it so that the current (i.e. before that patch)
public API is maintained but the same functionality can be achieved. It
requires a little bit more code, though, since it requires creating a
new gobject signal to notify of the state change.
VMware, Inc [Mon, 22 Mar 2010 22:16:29 +0000 (15:16 -0700)]
Pass VMX86_{DEVEL,DEBUG} to FreeBSD kernel drivers
Pass VMX86_* flags down to the FreeBSD drivers using DEBUG_FLAGS.
To get things to build I had to add some #ifdef around Mac OS X
specific code, change some %lld to FMT64, then due to that
fix uint64 definition in vm_basic_types.h (anyone knows why
it was 'unsigned long long' for 64bit FreeBSD? Should I
change FMT64 for FreeBSD instead?)
VMware, Inc [Mon, 22 Mar 2010 22:16:09 +0000 (15:16 -0700)]
Add initial host side support for request/confirm/ack unity operation.
Add RPC names and XDR definitions for requesting, confirming and acknowledging
unity operations via the host. A limited number if operation types are defined,
we currently only care about 'minimize'.
VMware, Inc [Mon, 22 Mar 2010 22:12:59 +0000 (15:12 -0700)]
Simple multi-threading fix for wcrtomb
Our printf and msg code uses wcrtomb, but on Windows wcrtomb is
#defined to wctomb, which is not thread-safe. The call sites
think they are getting wcrtomb, and are coded to be thread-safe.
The #define has a comment that wcrtomb is not available in
Windows, but sandbox builds seem to work just fine with the
#define removed, so let's try taking it out. The resulting
code will still not be completely thread-safe, wcrtomb is
vulnerable if another thread calls setlocale while it is
executing, but callers are supposed to using Unicode_Init,
not setlocale, so let's ignore that problem for now.
VMware, Inc [Mon, 22 Mar 2010 22:12:04 +0000 (15:12 -0700)]
Fix sync driver support in vmbackup plugin.
The cause of the hangs seen while investigating the bug is that the Legato
sync driver doesn't like even when people are doing read-only operations
like stat(2); so it would block the calling thread, which just happened to
be the Tools service's main thread, and things would go to hell.
The fix is to add a flag to the shared app context that lets code knows
when it's safe to access the disk. The two instances of the hang I was
able to capture in the kernel debugger (the log file check task and the
guest info gathering task) now check this flag and just bail out if it's
set. This is the "quick & less intrusive" version of the fix, which will
be modified once it hits vmcore-main to be more generic and more in line
with the Tools Core API.
This *may not* fix all instances of such hangs. I've actually been able
to hang a VM while performing a quiesced snapshot with this fix, but the
frequency is much, much, much lower (it happened once in a few hundred
tries). I haven't yet been able to catch this hang in a debugger. But,
code-wise, we're at least on par with K/L (in fact, better, since K/L
does not have the guest info workaround).
A flag was added that allows disabling the sync driver without having to
uninstall it, in case of emergency. The driver is enabled by default.
Also fix the sync driver support in the vmbackup plugin. The propagation
of the sync driver handle through the different operations was busted, so
querying the handle status was not working as expected. Also make sure
resources are properly freed and errors are correctly handled.
VMware, Inc [Mon, 22 Mar 2010 22:08:07 +0000 (15:08 -0700)]
Fix frobos build error
Oops, forgot to build frobos tests for change 1010036
Add VMCIQPair interface to VMCI. The ASSERT is nice but
it breaks the build. I'm removing it for now.
VMware, Inc [Mon, 22 Mar 2010 22:07:41 +0000 (15:07 -0700)]
Add VMCIQPair interface to VMCI
VMCIQPair is a new interface that hides the queue pair internals.
Rather than access each queue in a pair directly, operations are now
performed on the queue as a whole. This is simpler and less error-prone,
and allows for future queue pair features to be added under the hood
with no change to the client code.
VMware, Inc [Mon, 22 Mar 2010 22:07:05 +0000 (15:07 -0700)]
User level multi-threading fixes for gethostbyname
gethostbyname is not always thread safe. While it uses
thread local storage on some platforms, such as Mac, it
does not on Linux. Add a non-Windows version of
Posix_GetHostByName and use it where appropriate. Also
replace some code calling uname and gethostbyname in
HostInfoPopulateHostname with a call to Hostinfo_HostName,
since all it was trying to determine was the host name.
VMware, Inc [Mon, 22 Mar 2010 22:06:08 +0000 (15:06 -0700)]
Make the tools file logger thread-safe.
This change uses a rw lock to protect the shared data in the logger. This
allows a multi-threaded environment to safely use file loggers, even with
the current features it has (lazy open of log files, log file rolling).
Note this does not protect multiple threads from writing to the file at
the same time (we just "leak" the thread-safety characteristics of the
underlying system call, if any).
VMware, Inc [Mon, 22 Mar 2010 19:24:30 +0000 (12:24 -0700)]
Tweak System_GetTimeAsString().
. simplify the Win32 implementation to use static buffers and to avoid
doing several redundant charset conversions.
. tweak the formatted string a bit, removing non-date/time-related
characters.
VMware, Inc [Mon, 22 Mar 2010 19:24:13 +0000 (12:24 -0700)]
Modify toolbox-cmd to use the new i18n support in Tools.
Move all messages to the places in their source where they are declared,
create translation catalogs based on the data currently in the Win32
rc file, and get rid of the now unneeded code.
VMware, Inc [Mon, 22 Mar 2010 19:23:45 +0000 (12:23 -0700)]
Use new i18n infrastructure in vmtoolsd.
Initialize the user's locale properly, and use the new macros to retrieve
the strings used in the command line help. (Don't localize the command line
switches themselves, though, since that's confusing.)
When initializing plugins, automatically bind them to a text domain based
on their name.
VMware, Inc [Mon, 22 Mar 2010 19:18:59 +0000 (12:18 -0700)]
Add a message catalog infrastructure to vmtoolslib.
It is based on the Msg_* infrastructure but modified to make it easier to
use in Tools. The main differences are:
. it only provides message catalog-related functionality, no message queues
or anything like that.
. it supports more languages (Msg_* seems to be restricted to en/ja on
Win32), and has fallbacks (e.g. en_US -> en) similar to how gettext
does it.
. properly implements message domains so that different binaries (i.e.,
plugins) can be loaded into the same process and have different message
catalogs, avoiding message id conflicts.
. the message catalog format extends the dictionary format to allow for
continuation lines, so that long messages can be broken into multiple
lines in the catalog file.
. it doesn't use Dictionary_* functions which are way too encumbered.
. it provides easier accessors for wide strings (Win32 only) (at the cost
of some memory overhead).
VMware, Inc [Mon, 22 Mar 2010 19:17:18 +0000 (12:17 -0700)]
Implement log file rotation for Tools.
Extend the Tools file logger to support configurable log rotation.
Add tests to make sure rotation is working as expected, and update
the documentation to reflect the new config options.
Bonus: fix an issue where "double-newlines" (caused by VMware code that
embeds newlines in log messages) weren't being fixed by the logging
code unless the logger requested charset conversion (which is not the
case for file loggers).
VMware, Inc [Mon, 22 Mar 2010 19:09:52 +0000 (12:09 -0700)]
Unity/X11: Disable Unity when running under vmwgfx.
From bug 527219:
"Unity/X11 and the new (and experimental) vmwgfx driver don't yet play nicely
together. We don't expect this to be ironed out anytime soon, so for Cobalt &
Cheerios we'll instead disable Unity/X11 unless vmware-user knows it's running
with the legacy vmware_drv.so X11 video driver."
VMware, Inc [Wed, 24 Feb 2010 22:34:37 +0000 (14:34 -0800)]
Unity/X11: Account for guest-Compiz's window decorations.
Compiz does not reparent windows from the root window, but
rather adds its decorations to a completely separate peer window.
(Unity/X11 tracks only a client window, indicated by whichever window
holds the WM_STATE property, and its top-level (child of the root)
window for determining window geometry.) Fortunately it makes use
of the _NET_FRAME_EXTENTS property to specify the approximate sizes
of the frame around its managed windows. (I say approximate in
that this property specifies a single width for each window edge,
so that doesn't handle things like rounded corners.)
This change adjusts the bridge between Unity/X11 and the window
tracker such that the tracker is given a window's coordinates
including the frame sections. As mentioned above, the caveat is that
the guest always provides single rectangles, breaking the prettiness
of rounded corners. This will be addressed some other time.
VMware, Inc [Wed, 24 Feb 2010 22:29:20 +0000 (14:29 -0800)]
Unity/X11: Populate UnityWindowTracker with initial window state.
Description says it all. When investigating why xterms weren't appearing
in Unity, jkasper noted that Tools wasn't indicating a window type. Turns
out that Unity/X11 wasn't informing UWT of the window's initial type, and
that we were only hella lucky by other events eventually causing us to
update the type.
VMware, Inc [Wed, 24 Feb 2010 22:26:53 +0000 (14:26 -0800)]
Fix Windows Tools build break
Introduced by CS 998846: apparently 'except' is #defined to be
'__except' (used in C exception handling) for WDK builds, so
it's unsuitable as a struct member.
Renaming 'except' to 'exceptions' ought to fix this problem.
VMware, Inc [Wed, 24 Feb 2010 22:24:43 +0000 (14:24 -0800)]
(01/05) Rename some mode page fields in scsi_defs.h
This patch is a trivial rename of 'pageLength' to 'len' and
'pageCode' to 'page' in some mode page structures. The latter is
purely cosmetic, but the former is useful to me: I want to use a
macro that references 'len' for every mode page (later in the
series).
VMware, Inc [Wed, 24 Feb 2010 22:24:16 +0000 (14:24 -0800)]
Linux vmware-user: set the hibernation-safe flag.
* ryanb .oO( <mvanzin> I told you so. )
So, like, remember that hibernation hack I put in place last May? Turns
out it was hella racy. This became evident when QA noticed on SLED 11 that
the post-thaw wakeup signal might take a while to arrive. Until that happened,
vmware-user may have already run through the RpcIn event loop and errored out,
as its RpcIn state is out of sync with the VMX's.
So this change introduces another hack. Luckily for me, mvanzin is doing
the carnaval thing and isn't here to interfere. Mwahaha, etc.
In short, this change modifies the RpcIn error handler, only if called after
RpcIn had been working, to set the "reload yo'se'f" bits. (That test is to
avoid needlessly/endlessly reloading itself should there really be another
vmware-user instance running (or a similar terminal case).)
After this change is submitted, a subsequent changeset will back-out CLN
852538.
VMware, Inc [Wed, 24 Feb 2010 22:22:20 +0000 (14:22 -0800)]
OVT: do not ship dbllnklst.c
The file is just a shell of its former self and does not contain any
compilable code anymore (all meat was moved into the header file) so
there is no point in shipping it.
VMware, Inc [Wed, 24 Feb 2010 22:21:45 +0000 (14:21 -0800)]
Unity: Strengthen Tools' "unity.desktop.work_area.set" handler a smidge.
Once again, manual marshalling has bitten us in the ass. While working
on bug 522656, I discovered that vmware-user was crashing in the region
code, because it was creating regions with invalid dimensions.
Said regions were created from bogus coordinates like this:
Breakpoint 1, UnityTcloSetDesktopWorkArea (result=0x7fff2ed6e980,
resultLen=0x7fff2ed6e978, name=0x2768d90 "unity.desktop.work_area.set",
args=0x275a1fb " 1 , 0 -195 1600 1200", argsSize=21, clientData=0x0)
at /mts/dbc8-a/rbeasley/p4/hosted09/bora-vmsoft/lib/unity/unity.c:854
854 {
This change adds a test s.t. x and y must be >= 0, and width and height
must be >0.
VMware, Inc [Wed, 24 Feb 2010 22:17:55 +0000 (14:17 -0800)]
Fix a couple of issues with the tools file logger.
. if the log level is "none", the code optimizes things a little bit
and never sets the file path in the logger data. This was causing
an assert later on.
. while logging the assert, the log function was asserting that the
log file path was set, which caused a second assert because of the
same situation.
VMware, Inc [Wed, 24 Feb 2010 22:15:26 +0000 (14:15 -0800)]
Reorganize the logging code in vmtoolslib.
This change is a preparation for some enhancements I'll work on for the
file loggers. It does the following:
. separate each logger implementation into their own source file.
. provide an abstraction for loggers so that, if wanted, we can add new
logger implementations in the future (e.g., syslog) more easily.
The main goal, though, is just to better organize the code and separate
the logger implementations from the common logging code.
This change does introduce a change from the previous behavior: log files
are always written in UTF-8. stdout and OutputDebugString logs are, like
before, in the local user encoding.
VMware, Inc [Wed, 24 Feb 2010 22:10:31 +0000 (14:10 -0800)]
Move platform specific time sync code into separate files.
timeSyncPosix.c contains three slewing implementations: Linux,
Adjtime, and None. This change splits them out into separate
files to reduce the number of #ifdefs required. Also remove
TimeSync_IsTimeSlewEnabled.
VMware, Inc [Wed, 24 Feb 2010 22:09:13 +0000 (14:09 -0800)]
Cleanup timesync in preparation for further slewing changes.
These are a couple of changes that I pulled out of my tree that
implements NTP style time synchronization.
* TimeSyncStepTime now handles everything involved in stepping the
time. Before this change I think we would call
BDOOR_CMD_STOPCATCHUP in cases where we hadn't stepped the time.
* TimeSyncSlewTime handles all of the steps of slewing the time.
This will be expanded in future checkins.
* Add a comment explaining the landscape at the top of the file.
* Keep slewing enabled when the periodic time sync is enabled. If
slewing isn't supported leave the slew at nominal. This makes
things more uniform and removes the need for
TimeSyncDisableWinTimeDaemon.
* Cleanup some of the logging a bit (more to follow).