VMware, Inc [Wed, 26 Jan 2011 02:07:25 +0000 (18:07 -0800)]
Support dnd/fcp with gvfs/kio
This change implemented support for non-file scheme (smb, sftp ...)
for DnD/FCP. Because it needs some glib functions, some code has to be
repeated 4 times :(.
VMware, Inc [Wed, 26 Jan 2011 02:05:25 +0000 (18:05 -0800)]
powerOps: fix handling non-ascii power scripts on Ubuntu/Suse
If conversion of script name to current locale fails try using
original string (which should be UTF-8) and hope that shell
will understand it.
Note that conversions to system locale succeed on Fedora and RHEL
(which set G_BROKEN_FILENAMES=1) and fail on Open SUSE and Ubuntu
which expect everything to be pure UTF-8. Also Ubuntu is quite
funky because when I switched system language to Russian LANG in
terminals still was set as en_US.UTF-8; /etc/default/locale has
to be edited manually.
VMware, Inc [Wed, 26 Jan 2011 02:04:35 +0000 (18:04 -0800)]
Handle VMCI device shutdown when clients are still attached.
When Windows reboots/halts, it sends the VMCI device
a shutdown PnP event. This event is sent even if the
device is still referenced. Clients are supposed to
handle IRP_MJ_SHUTDOWN (or similar) and detach, but if
they don't, then it's possible for them to call us
after the device is gone, at which point we can
explode.
Fixed so that we gracefully handle this. On a shutdown
event:
1) Fail VMCI handle creation from this point on, but
allow other calls, so that handles can be closed.
2) Inform vsock that the device is going away.
3) VSock fails DGRAM/STREAM creation from this point on.
4) VSock informs all open sockets that the device
is going away. The sockets close their handles
and their wait list is kicked so that they wakeup
from recv() etc.
5) VSock closes the control channel.
6) VSock fails all creation calls from this point on,
but allows other calls, so that sockets can be
closed etc.
VMware, Inc [Wed, 26 Jan 2011 02:01:59 +0000 (18:01 -0800)]
Limit VMCI queue pair memory to 128MB per device
In the future, we will rewrite how the VMCI device allocates queue
pairs, so that they will be located "on the device" and be
exposed through the PCI address range.
We should be able to provide up to a maximum of 128MB queue
pair memory, so this change enforces that limit now.
VMware, Inc [Wed, 26 Jan 2011 01:57:58 +0000 (17:57 -0800)]
Toolbox GTK: use pixbufs instead of pixmaps
Function gdk_pixmap_colormap_create_from_xpm_d() is deprecated
and GTK/GDK documentation suggests using GdkPixbuf and
gdk_pixbuf_new_from_xpm_data() instead.
VMware, Inc [Wed, 26 Jan 2011 01:57:20 +0000 (17:57 -0800)]
DnD of non-ascii-text fails from gedit
The reason is that in our acceptable target list, we did not put utf8
as most wanted target, and gedit just provided unicode (as string)
instead of utf8 string. The fix is to move utf8 to top of acceptable
drop target list.
VMware, Inc [Wed, 26 Jan 2011 01:48:08 +0000 (17:48 -0800)]
Clipboard gets cleared if pasting a file again
The reason for the bug is that we used to rely on ClipboardClear
signal to check if we are still the clipboard owner. But that signal
is not reliable, and some unexpected ClipboardClear signal may cause
us clearing clipboard data unexpectedly. The fix is to rely on our
own private format like other implementation did.
VMware, Inc [Wed, 26 Jan 2011 01:47:05 +0000 (17:47 -0800)]
Fix power script handling on non-UTF-8 locales
Since we are not using script name retrieved from the config file
in glib file operations, but rather spawn a new process with it
as executable, we should convert the string to current (system)
locale, not glib filename representation.
VMware, Inc [Wed, 26 Jan 2011 01:46:42 +0000 (17:46 -0800)]
lib/file: Reduce log noise
I spotted this in a log file in the PR. It is possible for
one thread to open a lock file on POSIXen and by the time it
tries to stat the lock file another thread has already deleted
(unlinked) the file because it is stale. Had the other thread
not done this, the first aforementioned thread would have done
the unlink.
If this occurs, suppress an warning/error message; it's just
noise.
VMware, Inc [Wed, 26 Jan 2011 01:44:27 +0000 (17:44 -0800)]
Tools Logging: fix overzealous redirecting to console on Windows
The change that introduced automatic redirect of standard output
and standard error streams to a console on Windows completely broke
use of "vmtoolsd --cmd <xxx>" in scripts: redirect to files stopped
working.
Change VMTools_AttachConsole() to check if stdout/stderr point to
an on-disk file or a pipe before redirecting them to CONOUT.
VMware, Inc [Wed, 26 Jan 2011 01:44:14 +0000 (17:44 -0800)]
DnD: close connection to vmblock upon receiving SIGUSR1
Our install scripts expect that vmusr process (on non-Windows
platforms) will close connection to vmblock service upon
receiving SIGUSR1 and will not reopen it until next restart.
Install USR1 handler in DnD/CP plugin; also move block handling
from CopyPasteDnDX11 class and instead create a inew singleton
class for managing block connection state.
VMware, Inc [Wed, 26 Jan 2011 01:43:57 +0000 (17:43 -0800)]
vmci: replace kernelStubs with driverLog.
kernelStubs has been replaced with driverLog, which is
what we already use for the host driver. Checked that
there are no missing symbols (for example, Panic).
VMware, Inc [Wed, 26 Jan 2011 01:41:00 +0000 (17:41 -0800)]
Text copied from OO Calc is pasted as image
The reason for the bug is that on Linux after we got image data, we did
not try to get other format of data like Windows implementation did. The
fix is to try to get other formats of data after we got image data.
VMware, Inc [Wed, 26 Jan 2011 01:37:27 +0000 (17:37 -0800)]
The HGFS leaks session objects when disabling Shared Folders
The HGFS server session was referenced with the session create request
handler in response to a new session request call from the guest.
Unfortunately, since there is no corresponding destroy session
request from the guests so the HGFS server session will
not get destroyed due to this reference. Furthermore, there is more
work required for the handling of the disabling of Shared Folders
feature wrt to session support. This is also coming later on.
Also, once the channel is destroyed and disconnects from the
HGFS server in response to a UI disable command of the
shared folders feature, the HGFS server session is lost and
therefore leaked. Additional consequence of this is that any
open handles with that session also then remain open as they
will not be closed until the VMX process is destroyed.
Fix is to remove the session referencing from the create session and
destroy session handlers until session support is completed and
correctly handled.
VMware, Inc [Wed, 26 Jan 2011 01:35:36 +0000 (17:35 -0800)]
Prevent unexpected guest UI DragEnter
In some cases there may be some unexpected UI DragEnter after DnD
finished, which may disturb our state machine. With this change, guest
DragEnter is not allowed within 0.5 second after each DnD.
VMware, Inc [Wed, 26 Jan 2011 01:34:43 +0000 (17:34 -0800)]
Rewrite the ResolutionSet RandR12 code V2
The code was rewritten and added in a new file, resolutionRandR12.c. The rewrite addresses a number of issues:
1) The RandR12 code was never enabled if the server supported the VMwareCtrl extension.
2) If the RandR12 code was trivially enabled by moving the check for the VMwareCtrl extension, vmtoolsd would deadlock and freeze the X server.
This issue is still not fully investigated, though, but commented fixes in this changeset seems to work around it.
3) If the old RandR12 code was enabled together with the deadlock fixes, resolution wasn't set right. In fact mostly it wasn't set at all, perhaps due to races with
other resolutionset mechanisms. Typically the added autofit modes were never used.
4) Error checking and recovery in the old code was not very elaborate.
5) DPI calculation was incorrect since only the pixel dimensions of the first output were considered, and in that case only on resolution increases.
6) The rather long function made bugfixing and error recovery implementation hard. It's now split up.
Together with a minor change in the modesetting kernel these changes appears to remove the need for using VMWareCtrl with the vmwgfx driver, This has only
been tested with two monitors, though.
V2. Fix broken builds when NO_MULTIMON was set to true.
VMware, Inc [Mon, 20 Dec 2010 22:21:55 +0000 (14:21 -0800)]
Give checkvm some love.
Clean up our favorite useless app:
. use lib/backdoor and lib/checkvm instead of inline asm
. don't reimplement getopt on win32 since we already have it in lib/misc
. fix some code standard nits
VMware, Inc [Mon, 20 Dec 2010 22:17:15 +0000 (14:17 -0800)]
Fix conflicting Bool types when using X11.
Some distributions'* X headers seem to cause conflicts that our current
checks weren't catching. It sucks that we have this conflicting type
name and that they are of different types in the first place, but what
are you gonna do...
Anyway, checking upstream's version of Xdefs.h, it seems to check for
_XTYPEDEF_BOOL when defining the type. So both check for that before
defining our type, and define it so that Xdefs.h won't try to re-define
it.
VMware, Inc [Mon, 20 Dec 2010 22:15:43 +0000 (14:15 -0800)]
Fix Guest Hgfs server interface for multiple callers
Code does not quite cope with multiple callers for the same process
which leads to memory leaks.
The guest channel uses two globals: a channel data object and a server
data object both are shared for all registered connections that use the
internal HGFS RPC. The channel data and server data objects are reference
counted, initialized on the first reference and torndown on the final
reference removal.
At some point in the future if a client requires its own private callback
which will call HGFS server, then the channel code will allocate a new
channel which will in turn get its own private HGFS server session.
Currently this is not supported.
VMware, Inc [Mon, 20 Dec 2010 22:13:22 +0000 (14:13 -0800)]
Make VSOCK reset connection during connect on QP detach
If the peer of a stream connection detaches from an already
allocated queue pair while the connection state is still
"connecting", we should treat it as a reset. The peer may
detach for a number of reasons, the two primary ones are 1)
the VM got killed, 2) the QP busmem invalidation failed.
This case is already handled by the common code, but not the
linux specific implementation.
This change also resets the VMCI datagram handle allocated by
the stream sockets to VMCI_INVALID_HANDLE when it is
destroyed, since the validity of the handle is used to
determine whether we should call destroy on the handle when
the module is unloaded.
VMware, Inc [Mon, 20 Dec 2010 22:12:44 +0000 (14:12 -0800)]
Hgfs Over VMCI. Asynchronous.
Start supporting Async operations on Hgfs over vmci for Mac.
- Right now when you suspend the VM, change vmx file to disable
vmci - it will correctly fallback to backdoor however it will
not upgrade to vmci when one is available since transport change
is only triggered when you see that current channel is not working.
This logic should go away when session change is implemented which
should detect change in session and restart detection of which channel
is available.
VMware, Inc [Mon, 20 Dec 2010 22:07:52 +0000 (14:07 -0800)]
vmtoolsd: add a worker thread pool.
The thread pool allows both for pooled requests and for non-pooled
requests, where the pool just manages the thread lifecycle and makes
sure the task is notified of things such as service shutdown.
VMware, Inc [Mon, 20 Dec 2010 22:05:51 +0000 (14:05 -0800)]
Tear down file transfer object if init called multiple times.
GuestDnDCPMgr persists during the lifetime of the guest/plugin.
But we may be initialized multiple times during that lifetime via
Init() call. Init() should release any previous file transfer
object and create a new one each time it is invoked.
Also added code to cleanup the CopyPasteDnDWrapper singleton on
receiving shutdown signal from vmusr. Though I am not seeing that
signal at all either on Windows (tried setting bp in windbg) or
Linux. So, when the process exits, we will likely still have one
dangling init call.
VMware, Inc [Mon, 20 Dec 2010 22:05:30 +0000 (14:05 -0800)]
Host part of directory change notification.
Initial implementation of directory change notification support for Mac OS.
1. Parse set notification watch request from the guest and pass it
down to platform specific library.
2. Parse remove change notification watch and call plaform specific library.
3. Call platform specific library when shared folder is being added/removed and
enumerate all shared folders during initialization.
4. Implement callback to send notifications back.
5. Integrated with Mac OS specific directory notification code.
6. Implemented prototype of change directory notification support for WIndows host.
VMware, Inc [Mon, 20 Dec 2010 22:04:19 +0000 (14:04 -0800)]
vmxnet: fix build break
The previous change moved the definition of ETH_MIN_FRAME_LEN from
net.h to eth_public.h. I had followed through with the appropriate
refactoring in the vmkernel, but forgot to scour the rest of the
codebase for references, and missed one in the Linux build of
vmxnet.
VMware, Inc [Mon, 20 Dec 2010 22:00:03 +0000 (14:00 -0800)]
Remove unused user space support from VMCI guest drivers
In ancient times, there existed a user level library for
VMCI. It talked to the VMCI guest driver through ioctls. Also,
it needed infrastructure in the guest driver to keep track
of user level processes and their datagram handles.
For all of the modules except windows, we should also be able
to get rid of the character device. I'll do that as a separate
change.
VMware, Inc [Mon, 20 Dec 2010 21:58:46 +0000 (13:58 -0800)]
Clean up leftover references to VM_ASM_PLUS.
VM_ASM_PLUS was removed because it's always true now. This
change gets rid of a few leftover references in the 64-bit
code that were generating compiler warnings.
VMware, Inc [Mon, 20 Dec 2010 21:47:42 +0000 (13:47 -0800)]
Unity/X11: Free desktop mappings when exiting Unity.
When last hacking this code, I added two ASSERTs making sure that
the host:guest desktop map pointers were NULL when entering Unity
and numDesktops == 0. This is true when first entering Unity
in a single session, but not for subsequent entrances in the same
session.
Rather than keep the mappings until the plugin is destroyed, we'll
now flush them upon exit.
VMware, Inc [Mon, 20 Dec 2010 21:47:08 +0000 (13:47 -0800)]
Trivial: add some logging to trace events on detection window
Fairly low bandwidth logging of events occuring on detection window.
Also small tweeks to move positioning of button presses away from
border of window.
VMware, Inc [Mon, 20 Dec 2010 21:46:19 +0000 (13:46 -0800)]
lib/unicode: simplify and improve Unicode_FindLastSubstrInRange
No need to be peeking under the hood at the physical implementation
in Unicode_FindLastSubstrInRange. This makes things much easier to
understand and removes possible problems with physical handling
issues
VMware, Inc [Mon, 20 Dec 2010 21:45:14 +0000 (13:45 -0800)]
lib/unicode: fix Unicode_ReplaceRange
Continuing the lib/unicode bug hunt, Unicode_ReplaceRange gets fixed.
Make Unicode_Join not use Unicode_Append so there is no potential
recursion problems between routines.
VMware, Inc [Mon, 20 Dec 2010 21:44:25 +0000 (13:44 -0800)]
lib/unicode: Unicode_Substr is broken
There is a confusion of code points and code units within lib/unicode
that needs to be cleaned up. Here I fix Unicode_Substr using the
technique I plan to use across most of the function in
unicodeSimpleOperations.c.
More changes will ensue until the base PR is fixed.