This is my patch for 2008.08.08 release. This patch adds a simple "Record"
panel to vmware-toolbox and "record" command to vmware-toolbox-cmd.
I configured the build by "--without-procps --disable-unity", since I
didn't install the two packages.
I have tested the patch on rhel5, suse10 and ubuntu7.04.
I get the contribution agreement document, but I am not sure if paper form
or electronic form is required.
Best regards,
Yiwen
On 8/14/08, Adar Dembo <[EMAIL PROTECTED]> wrote:
>
> > I used to work on migrating vassert sdk from windows
> > to linux platform, with the help of some internal engineers.
> > The latest release of vassert sdk in windows supports start
> > and stop recording inside the guest, and I just make the
> > upgrade in linux. I think it useful to add a GUI for toolbox
> > or some command line tool controlling record process, to the
> > open-vm-tools. I have made a private copy based on 2008.07.01
> > release, and I am testing it on the latest release as well as
> > various platforms. I would be glad to contribute it as a
> > patch, do you think it is useful?
> > If so, is there some process to get it done? It seems
> > that the tracking system is favoured here, but I am not sure
> > if this idea is suitable with it.
> > I am eager to hear your comments.
>
> I think the ability to control the record process would be a great addition
> to the toolbox, and we'd love to take your contribution. Note that since
> 2008.08.08 there's also the command line toolbox, so it would likewise be
> great if you could add support for this feature in both the command line
> toolbox as well as the graphical toolbox. In terms of code factoring, it
> would probably be best to add the infrastructure (backdoor commands or
> whatever) to lib/guestApp, and then implement a gtk pane for the graphical
> toolbox and a new set of commands in the command line toolbox, both making
> use of the calls in lib/guestApp.
>
> In terms of the process, I suggest you start by signing our contribution
> agreement (http://open-vm-tools.sourceforge.net/files/vca.pdf) so we can
> get that bit of bureaucracy out of the way. After that, it would be best to
> create some patches that implement your design and send them for review to
> this mailing list. Please stick to the open-vm-tools coding style, which you
> can find at http://open-vm-tools.wiki.sourceforge.net/CodingStandards.
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> open-vm-tools-devel mailing list
> open-vm-tools-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open-vm-tools-devel
>
From 1cf55724e08a0773c946e755a4c7eb1ec8f27d2a Mon Sep 17 00:00:00 2001
From: root <[EMAIL PROTECTED]>
Date: Mon, 18 Aug 2008 10:06:32 +0800
Subject: [PATCH] Record control
---
toolbox/Makefile.am | 3 +
toolbox/Makefile.in | 16 ++++--
toolbox/toolbox-cmd.c | 65 ++++++++++++++++++++++-
toolbox/toolbox-gtk.c | 4 ++
toolbox/toolboxCmdInt.h | 5 ++
toolbox/toolboxGtkInt.h | 3 +
toolbox/toolboxRecord.c | 126 +++++++++++++++++++++++++++++++++++++++++++
toolbox/toolboxcmd-record.c | 38 +++++++++++++
8 files changed, 254 insertions(+), 6 deletions(-)
create mode 100644 toolbox/toolboxRecord.c
create mode 100644 toolbox/toolboxcmd-record.c
diff --git a/toolbox/Makefile.am b/toolbox/Makefile.am
index c8e082d..457b870 100644
--- a/toolbox/Makefile.am
+++ b/toolbox/Makefile.am
@@ -63,6 +63,8 @@ if HAVE_X11
vmware_toolbox_SOURCES += toolboxOptions.c
vmware_toolbox_SOURCES += toolboxScripts.c
vmware_toolbox_SOURCES += toolboxShrink.c
+ vmware_toolbox_SOURCES += toolboxRecord.c
+ vmware_toolbox_SOURCES += toolboxcmd-record.c
# Here's something wacky: automake will muck up the translation of this
# conditional if it is indented. For more details, see:
@@ -106,6 +108,7 @@ vmware_toolbox_cmd_SOURCES += toolboxcmd-scripts.c
vmware_toolbox_cmd_SOURCES += toolboxcmd-shrink.c
vmware_toolbox_cmd_SOURCES += toolboxcmd-stat.c
vmware_toolbox_cmd_SOURCES += toolboxcmd-time.c
+vmware_toolbox_cmd_SOURCES += toolboxcmd-record.c
if HAVE_ICU
vmware_toolbox_cmd_LDADD += @ICU_LIBS@
diff --git a/toolbox/Makefile.in b/toolbox/Makefile.in
index db516c0..f13a652 100644
--- a/toolbox/Makefile.in
+++ b/toolbox/Makefile.in
@@ -71,13 +71,16 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am__vmware_toolbox_SOURCES_DIST = debugStdio.c toolbox-gtk.c \
toolboxAbout.c toolboxDevices.c toolboxOptions.c \
- toolboxScripts.c toolboxShrink.c
+ toolboxScripts.c toolboxShrink.c toolboxRecord.c \
+ toolboxcmd-record.c
@[EMAIL PROTECTED] = debugStdio.$(OBJEXT) \
@HAVE_X11_TRUE@ toolbox-gtk.$(OBJEXT) toolboxAbout.$(OBJEXT) \
@HAVE_X11_TRUE@ toolboxDevices.$(OBJEXT) \
@HAVE_X11_TRUE@ toolboxOptions.$(OBJEXT) \
@HAVE_X11_TRUE@ toolboxScripts.$(OBJEXT) \
[EMAIL PROTECTED]@ toolboxShrink.$(OBJEXT)
[EMAIL PROTECTED]@ toolboxShrink.$(OBJEXT) \
[EMAIL PROTECTED]@ toolboxRecord.$(OBJEXT) \
[EMAIL PROTECTED]@ toolboxcmd-record.$(OBJEXT)
vmware_toolbox_OBJECTS = $(am_vmware_toolbox_OBJECTS)
am__DEPENDENCIES_1 =
@[EMAIL PROTECTED] = \
@@ -86,7 +89,8 @@ am__DEPENDENCIES_1 =
am_vmware_toolbox_cmd_OBJECTS = debugStdio.$(OBJEXT) \
toolbox-cmd.$(OBJEXT) toolboxcmd-devices.$(OBJEXT) \
toolboxcmd-scripts.$(OBJEXT) toolboxcmd-shrink.$(OBJEXT) \
- toolboxcmd-stat.$(OBJEXT) toolboxcmd-time.$(OBJEXT)
+ toolboxcmd-stat.$(OBJEXT) toolboxcmd-time.$(OBJEXT) \
+ toolboxcmd-record.$(OBJEXT)
vmware_toolbox_cmd_OBJECTS = $(am_vmware_toolbox_cmd_OBJECTS)
vmware_toolbox_cmd_DEPENDENCIES = ../libguestlib/libguestlib.la \
../lib/guestInfo/libGuestInfo.a ../lib/guestApp/libGuestApp.a \
@@ -279,7 +283,7 @@ COMMON = ../lib/conf/libConf.a
../lib/eventManager/libEventManager.a \
@[EMAIL PROTECTED] = debugStdio.c toolbox-gtk.c \
@HAVE_X11_TRUE@ toolboxAbout.c toolboxDevices.c \
@HAVE_X11_TRUE@ toolboxOptions.c toolboxScripts.c \
[EMAIL PROTECTED]@ toolboxShrink.c
[EMAIL PROTECTED]@ toolboxShrink.c toolboxRecord.c toolboxcmd-record.c
@HAVE_ICU_FALSE@@[EMAIL PROTECTED] = $(LINK)
@HAVE_ICU_TRUE@@[EMAIL PROTECTED] = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@HAVE_ICU_TRUE@@HAVE_X11_TRUE@ $(LIBTOOLFLAGS)
--mode=link $(CXX) $(AM_CXXFLAGS) \
@@ -290,7 +294,7 @@ vmware_toolbox_cmd_LDADD = ../libguestlib/libguestlib.la \
$(COMMON) $(am__append_3)
vmware_toolbox_cmd_SOURCES = debugStdio.c toolbox-cmd.c \
toolboxcmd-devices.c toolboxcmd-scripts.c toolboxcmd-shrink.c \
- toolboxcmd-stat.c toolboxcmd-time.c
+ toolboxcmd-stat.c toolboxcmd-time.c toolboxRecord.c
@[EMAIL PROTECTED] = $(LINK)
@[EMAIL PROTECTED] = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@HAVE_ICU_TRUE@ $(LIBTOOLFLAGS) --mode=link $(CXX)
\
@@ -384,6 +388,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
[EMAIL PROTECTED]@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
[EMAIL PROTECTED]@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@
$<
diff --git a/toolbox/toolbox-cmd.c b/toolbox/toolbox-cmd.c
index 0b4887e..46d8551 100644
--- a/toolbox/toolbox-cmd.c
+++ b/toolbox/toolbox-cmd.c
@@ -71,11 +71,13 @@ static int DiskCommand(char **argv, int argc);
static int StatCommand(char **argv, int argc);
static int ScriptCommand(char **argv, int argc);
static int TimeSyncCommand(char **argv, int argc);
+static int RecordCommand(char **argv, int argc);
static void DeviceHelp(char *progName);
static void DiskHelp(char *progName);
static void ScriptHelp(char *progName);
static void StatHelp(char *progName);
static void TimeSyncHelp(char *progName);
+static void RecordHelp(char *progName);
static void ToolboxCmdHelp(char *progName);
static const CmdTable * ParseCommand(char **argv, int argc);
static Bool CheckArgumentLength(char **argv, int argc);
@@ -91,6 +93,7 @@ static const CmdTable commands[] = {
{ "disk", DiskCommand, TRUE, DiskHelp},
{ "stat", StatCommand, FALSE, StatHelp},
{ "device", DeviceCommand, FALSE, DeviceHelp},
+ { "record", RecordCommand, FALSE, RecordHelp},
{ "help", HelpCommand, FALSE, ToolboxCmdHelp},
{ NULL, } };
@@ -185,7 +188,8 @@ ToolboxCmdHelp(char *progName)
" device\n"
" script\n"
" disk\n"
- " stat\n\n"
+ " stat\n"
+ " record\n\n"
"For additional information please visit
http://www.vmware.com/support/\n\n",
progName, progName, progName, progName);
}
@@ -313,6 +317,32 @@ StatHelp(char *progName) // IN: The name of the program
obtained from argv[0]
" cpulimit: Prints cput limit\n", progName);
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * StatHelp --
+ *
+ * Prints the help for the stat command.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static void
+RecordHelp(char *progName) // IN: The name of the program obtained from argv[0]
+{
+ printf("record: control recording process inside guest\n"
+ "Usage: %s record <subcommand>\n\n"
+ "Subcommands\n"
+ " start: start recording\n"
+ " stop: stop recording\n", progName);
+}
+
/*
*-----------------------------------------------------------------------------
@@ -582,7 +612,40 @@ TimeSyncCommand(char **argv, // IN: command line arguments
return EX_USAGE;
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * RecordCommand --
+ *
+ * Parse and Handle recording commands.
+ *
+ * Results:
+ * Returns EXIT_SUCCESS on success.
+ * Returns the appropriate exit code errors.
+ *
+ * Side effects:
+ * Might start and stop recording, guest os may be suspended
+ * to wait for the recording panel in host.
+ *
+ *-----------------------------------------------------------------------------
+ */
+static int
+RecordCommand(char **argv, // IN: Command line arguments
+ int argc) // IN: Length of command line argumenst
+{
+ if (CheckArgumentLength(argv, argc)) {
+ if (strcmp(argv[optind], "start") == 0) {
+ return Record_Control(1);
+ } else if (strcmp(argv[optind], "stop") == 0) {
+ return Record_Control(2);
+ } else {
+ fprintf(stderr, "Unknown subcommand");
+ }
+ }
+ RecordHelp(argv[0]);
+ return EX_USAGE;
+}
/*
*-----------------------------------------------------------------------------
*
diff --git a/toolbox/toolbox-gtk.c b/toolbox/toolbox-gtk.c
index a49bd55..753928f 100644
--- a/toolbox/toolbox-gtk.c
+++ b/toolbox/toolbox-gtk.c
@@ -589,6 +589,8 @@ ToolsMain_Create(void)
gtk_label_new_with_mnemonic(TAB_LABEL_SCRIPTS));
gtk_notebook_append_page(GTK_NOTEBOOK(notebookMain),
Shrink_Create(ToolsMain),
gtk_label_new_with_mnemonic(TAB_LABEL_SHRINK));
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebookMain),
Record_Create(ToolsMain),
+ gtk_label_new_with_mnemonic(TAB_LABEL_RECORD));
gtk_notebook_append_page(GTK_NOTEBOOK(notebookMain),
About_Create(ToolsMain),
gtk_label_new_with_mnemonic(TAB_LABEL_ABOUT));
#else
@@ -596,6 +598,8 @@ ToolsMain_Create(void)
gtk_label_new(TAB_LABEL_SCRIPTS));
gtk_notebook_append_page(GTK_NOTEBOOK(notebookMain),
Shrink_Create(ToolsMain),
gtk_label_new(TAB_LABEL_SHRINK));
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebookMain),
Record_Create(ToolsMain),
+ gtk_lable_new(TAB_LABEL_RECORD));
gtk_notebook_append_page(GTK_NOTEBOOK(notebookMain),
About_Create(ToolsMain),
gtk_label_new(TAB_LABEL_ABOUT));
#endif
diff --git a/toolbox/toolboxCmdInt.h b/toolbox/toolboxCmdInt.h
index f3a8f0c..0f4305d 100644
--- a/toolbox/toolboxCmdInt.h
+++ b/toolbox/toolboxCmdInt.h
@@ -80,4 +80,9 @@ int Stat_GetMemorySwapped(void);
int Stat_GetMemoryLimit(void);
int Stat_GetMemoryReservation(void);
+/*
+ * Record commands
+ */
+int Record_Control(int mode);
+
#endif /*_TOOLBOX_CMD_H_*/
diff --git a/toolbox/toolboxGtkInt.h b/toolbox/toolboxGtkInt.h
index 3f9c42f..1cb1d78 100644
--- a/toolbox/toolboxGtkInt.h
+++ b/toolbox/toolboxGtkInt.h
@@ -48,12 +48,14 @@
#define TAB_LABEL_DEVICES "De_vices"
#define TAB_LABEL_SCRIPTS "Scri_pts"
#define TAB_LABEL_SHRINK "Shrin_k"
+#define TAB_LABEL_RECORD "_Record"
#define TAB_LABEL_ABOUT "Abo_ut"
#else
#define TAB_LABEL_OPTIONS "Options"
#define TAB_LABEL_DEVICES "Devices"
#define TAB_LABEL_SCRIPTS "Scripts"
#define TAB_LABEL_SHRINK "Shrink"
+#define TAB_LABEL_RECORD "Record"
#define TAB_LABEL_ABOUT "About"
#endif
@@ -69,6 +71,7 @@ GtkWidget* Devices_Create(GtkWidget* mainWnd);
GtkWidget* Options_Create(GtkWidget* mainWnd);
GtkWidget* Scripts_Create(GtkWidget* mainWnd);
GtkWidget* Shrink_Create(GtkWidget* mainWnd);
+GtkWidget* Record_Create(GtkWidget* mainWnd);
void Options_OnTimeSyncToggled(gpointer btn, gpointer data);
void Devices_OnDeviceToggled(gpointer btn, gpointer data);
diff --git a/toolbox/toolboxRecord.c b/toolbox/toolboxRecord.c
new file mode 100644
index 0000000..aa381d9
--- /dev/null
+++ b/toolbox/toolboxRecord.c
@@ -0,0 +1,126 @@
+/*********************************************************
+ * Copyright (C) 2005 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.
+ *
+ *********************************************************/
+
+/*
+ * toolboxRecord.c --
+ *
+ * The record tab for the linux gtk toolbox.
+ */
+
+#include "toolboxGtkInt.h"
+#include "toolboxCmdInt.h"
+
+static void Record_OnStart(gpointer, gpointer);
+static void Record_OnStop(gpointer, gpointer);
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Record_Create --
+ *
+ * Create, layout, and init the Record tab UI and all its widgets.
+ *
+ * Results:
+ * The Record tab widget (it's a vbox).
+ *
+ * Side effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+GtkWidget*
+Record_Create(GtkWidget* mainWnd)
+{
+ GtkWidget* recordtab;
+ GtkWidget* hbox[2];
+ GtkWidget* startbtn;
+ GtkWidget* stopbtn;
+ recordtab = gtk_vbox_new(FALSE, 50);
+ gtk_widget_show(recordtab);
+ hbox[0] = gtk_hbox_new(FALSE, 10);
+ hbox[1] = gtk_hbox_new(FALSE, 10);
+ gtk_widget_show(hbox[0]);
+ gtk_widget_show(hbox[1]);
+ gtk_box_pack_start(GTK_BOX(recordtab), hbox[0], FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(recordtab), hbox[1], FALSE, FALSE, 0);
+#ifdef GTK2
+ startbtn = gtk_button_new_with_mnemonic("Sta_rt");
+ stopbtn = gtk_button_new_with_mnemonic("S_top");
+#else
+ startbtn = gtk_button_new_with_label("Start");
+ stopbtn = gtk_button_new_with_label("Stop");
+#endif
+ gtk_widget_show(startbtn);
+ gtk_box_pack_start(GTK_BOX(hbox[1]), startbtn, FALSE, FALSE, 10);
+ gtk_widget_set_usize(startbtn, 70, 25);
+ gtk_signal_connect(GTK_OBJECT(startbtn), "clicked",
+ GTK_SIGNAL_FUNC(Record_OnStart), NULL);
+ gtk_widget_show(stopbtn);
+ gtk_box_pack_end(GTK_BOX(hbox[1]), stopbtn, FALSE, FALSE, 10);
+ gtk_widget_set_usize(stopbtn, 70, 6);
+ gtk_signal_connect(GTK_OBJECT(stopbtn), "clicked",
+ GTK_SIGNAL_FUNC(Record_OnStop), NULL);
+ return recordtab;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Record_OnStart --
+ *
+ * Callback for the gtk signal "clicked" on the Record tab's start
+ * button.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Host VMware product starts recording this vm.
+ *
+ *-----------------------------------------------------------------------------
+ */
+void
+Record_OnStart(gpointer btn, // IN: unused
+ gpointer data) // IN: unused
+{
+ Record_Control(1);
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Record_OnStop --
+ *
+ * Callback for the gtk signal "clicked" on the Record tab's stop
+ * button.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Host VMware product stops recording this vm.
+ *
+ *-----------------------------------------------------------------------------
+ */
+void
+Record_OnStop(gpointer btn, // IN: unused
+ gpointer data) // IN: unused
+{
+ Record_Control(2);
+}
+
diff --git a/toolbox/toolboxcmd-record.c b/toolbox/toolboxcmd-record.c
new file mode 100644
index 0000000..cf49eb1
--- /dev/null
+++ b/toolbox/toolboxcmd-record.c
@@ -0,0 +1,54 @@
+/*********************************************************
+ * Copyright (C) 2005 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.
+ *
+ *********************************************************/
+
+/*
+ * toolboxRecord.c --
+ *
+ * Record operations for toolbox command line console.
+ */
+
+#include "toolboxCmdInt.h"
+#include "backdoor.h"
+#include "backdoor_def.h"
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Record_Control --
+ *
+ * Start or stop recording proccess, flagged by mode.
+ * mode 1 for start and mode 2 for stop.
+ *
+ * Results:
+ * 1 if the call is successful.
+ *
+ * Side effects:
+ * Host VMware product starts or stops recording this vm.
+ *
+ *-----------------------------------------------------------------------------
+ */
+int
+Record_Control(int mode) // IN: flag of starting or stopping recording
+{
+ Backdoor_proto bp;
+ bp.in.size = mode;
+ bp.in.cx.halfs.low = BDOOR_CMD_STATELOGGER;
+ Backdoor(&bp);
+ return bp.out.ax.halfs.low;
+}
+
--
1.5.6.5
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
open-vm-tools-devel mailing list
open-vm-tools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-vm-tools-devel