From: John Wolfe Date: Tue, 6 Oct 2020 21:30:56 +0000 (-0700) Subject: Changes to common source files not directly applicable to open-vm-tools. X-Git-Tag: stable-11.3.0~293 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b966cb3822b3a8cb9815af6f2da46f8f367b58cd;p=thirdparty%2Fopen-vm-tools.git Changes to common source files not directly applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/vmware/tools/plugin.h b/open-vm-tools/lib/include/vmware/tools/plugin.h index 1776a6260..e8e3d146c 100644 --- a/open-vm-tools/lib/include/vmware/tools/plugin.h +++ b/open-vm-tools/lib/include/vmware/tools/plugin.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2019,2020 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2020 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 @@ -264,6 +264,18 @@ typedef enum { } ToolsCoreAPI; +struct ToolsServiceProperty; + +/** + * Type of the function that installs a new property in + * the application context service object. + * + * @param[in] obj The application context service object. + * @param[in] prop Property to install. + */ +typedef void (*RegisterServiceProperty)(gpointer obj, + struct ToolsServiceProperty *prop); + /** * Defines the context of a tools application. This data is provided by the * core services to applications when they're loaded. @@ -301,6 +313,13 @@ typedef struct ToolsAppCtx { * register and emit their own signals using this object. */ gpointer serviceObj; + + /** + * Function pointer for plugins to register properties to + * the service object serviceObj. + * This allows a plugin to share data and services to others. + */ + RegisterServiceProperty registerServiceProperty; } ToolsAppCtx; #if defined(G_PLATFORM_WIN32) diff --git a/open-vm-tools/services/vmtoolsd/mainLoop.c b/open-vm-tools/services/vmtoolsd/mainLoop.c index 3c6313adf..437f8ee74 100644 --- a/open-vm-tools/services/vmtoolsd/mainLoop.c +++ b/open-vm-tools/services/vmtoolsd/mainLoop.c @@ -1200,6 +1200,8 @@ ToolsCore_Setup(ToolsServiceState *state) g_type_init(); state->ctx.serviceObj = g_object_new(TOOLSCORE_TYPE_SERVICE, NULL); + state->ctx.registerServiceProperty = + (RegisterServiceProperty)ToolsCoreService_RegisterProperty; /* Register the core properties. */ ToolsCoreService_RegisterProperty(state->ctx.serviceObj,