diff options
-rw-r--r-- | docs/reference/node-startup-controller/node-startup-controller-docs.xml | 4 | ||||
-rw-r--r-- | node-startup-controller/Makefile.am | 39 | ||||
-rw-r--r-- | node-startup-controller/boot-manager-application.c | 74 | ||||
-rw-r--r-- | node-startup-controller/boot-manager-application.h | 12 | ||||
-rw-r--r-- | node-startup-controller/boot-manager-service.h | 45 | ||||
-rw-r--r-- | node-startup-controller/luc-starter.c | 53 | ||||
-rw-r--r-- | node-startup-controller/luc-starter.h | 10 | ||||
-rw-r--r-- | node-startup-controller/main.c | 39 | ||||
-rw-r--r-- | node-startup-controller/node-startup-controller-dbus.xml (renamed from node-startup-controller/boot-manager-dbus.xml) | 21 | ||||
-rw-r--r-- | node-startup-controller/node-startup-controller-service.c (renamed from node-startup-controller/boot-manager-service.c) | 166 | ||||
-rw-r--r-- | node-startup-controller/node-startup-controller-service.h | 45 | ||||
-rw-r--r-- | node-startup-controller/target-startup-monitor.c | 3 |
12 files changed, 258 insertions, 253 deletions
diff --git a/docs/reference/node-startup-controller/node-startup-controller-docs.xml b/docs/reference/node-startup-controller/node-startup-controller-docs.xml index 996a15e..8a4ded1 100644 --- a/docs/reference/node-startup-controller/node-startup-controller-docs.xml +++ b/docs/reference/node-startup-controller/node-startup-controller-docs.xml @@ -88,17 +88,17 @@ <chapter> <title>Public API</title> - <xi:include href="../../../node-startup-controller/boot-manager-dbus-doc-org.genivi.BootManager1.BootManager.xml"/> + <xi:include href="../../../node-startup-controller/doc-org.genivi.NodeStartupController1.NodeStartupController.xml"/> <xi:include href="legacy-app-handler.xml"/> </chapter> <chapter id="node-startup-controller-classes"> <title>Main Classes of the Node Startup Controller</title> <xi:include href="xml/boot-manager-application.xml"/> - <xi:include href="xml/boot-manager-service.xml"/> <xi:include href="xml/job-manager.xml"/> <xi:include href="xml/la-handler-service.xml"/> <xi:include href="xml/luc-starter.xml"/> + <xi:include href="xml/node-startup-controller-service.xml"/> <xi:include href="xml/target-startup-monitor.xml"/> </chapter> diff --git a/node-startup-controller/Makefile.am b/node-startup-controller/Makefile.am index 9d05213..15a3a7d 100644 --- a/node-startup-controller/Makefile.am +++ b/node-startup-controller/Makefile.am @@ -9,9 +9,9 @@ boot_managerdir = \ boot_manager_PROGRAMS = \ boot-manager -boot_manager_built_sources = \ - boot-manager-dbus.h \ - boot-manager-dbus.c +node_startup_controller_built_sources = \ + node-startup-controller-dbus.h \ + node-startup-controller-dbus.c systemd_manager_built_sources = \ systemd-manager-dbus.h \ @@ -24,8 +24,6 @@ systemd_unit_built_sources = \ boot_manager_SOURCES = \ boot-manager-application.c \ boot-manager-application.h \ - boot-manager-service.c \ - boot-manager-service.h \ glib-extensions.c \ glib-extensions.h \ job-manager.c \ @@ -34,10 +32,12 @@ boot_manager_SOURCES = \ la-handler-service.h \ luc-starter.c \ luc-starter.h \ + node-startup-controller-service.c \ + node-startup-controller-service.h \ target-startup-monitor.c \ target-startup-monitor.h \ main.c \ - $(boot_manager_built_sources) \ + $(node_startup_controller_built_sources) \ $(systemd_manager_built_sources) \ $(systemd_unit_built_sources) @@ -89,45 +89,46 @@ systemd_service_DATA = $(systemd_service_in_files:.service.in=.service) CLEANFILES = \ $(dbus_service_DATA) \ $(systemd_service_DATA) \ - boot-manager-dbus-doc-*.xml + node-startup-controller-dbus-doc-*.xml EXTRA_DIST = \ - boot-manager-dbus.xml \ + node-startup-controller-dbus.xml \ systemd-manager-dbus.xml \ $(dbus_service_in_files) \ $(systemd_service_in_files) DISTCLEANFILES = \ - $(boot_manager_built_sources) \ + $(node_startup_controller_built_sources) \ $(systemd_manager_built_sources) \ $(systemd_unit_built_sources) BUILT_SOURCES = \ - $(boot_manager_built_sources) \ + $(node_startup_controller_built_sources) \ $(systemd_manager_built_sources) \ $(systemd_unit_built_sources) -$(boot_manager_built_sources): boot-manager-dbus.xml Makefile +$(node_startup_controller_built_sources): node-startup-controller-dbus.xml Makefile $(AM_V_GEN) $(GDBUS_CODEGEN) \ --interface-prefix org.genivi \ --c-namespace "" \ - --generate-c-code boot-manager-dbus \ - --generate-docbook boot-manager-dbus-doc \ - --annotate org.genivi.BootManager1.BootManager org.gtk.GDBus.C.Name \ - Boot_Manager $< + --generate-c-code node-startup-controller-dbus \ + --generate-docbook doc \ + --annotate \ + org.genivi.NodeStartupController1.NodeStartupController \ + org.gtk.GDBus.C.Name Node_Startup_Controller $< $(systemd_manager_built_sources): systemd-manager-dbus.xml Makefile $(AM_V_GEN) $(GDBUS_CODEGEN) \ --interface-prefix org.freedesktop.systemd1 \ --c-namespace "" \ --generate-c-code systemd-manager-dbus \ - --annotate org.freedesktop.systemd1.Manager org.gtk.GDBus.C.Name \ - SystemdManager $< + --annotate org.freedesktop.systemd1.Manager \ + org.gtk.GDBus.C.Name SystemdManager $< $(systemd_unit_built_sources): systemd-unit-dbus.xml Makefile $(AM_V_GEN) $(GDBUS_CODEGEN) \ --interface-prefix org.freedesktop.systemd1 \ --c-namespace "" \ --generate-c-code systemd-unit-dbus \ - --annotate org.freedesktop.systemd1.Unit org.gtk.GDBus.C.Name \ - SystemdUnit $< + --annotate org.freedesktop.systemd1.Unit \ + org.gtk.GDBus.C.Name SystemdUnit $< diff --git a/node-startup-controller/boot-manager-application.c b/node-startup-controller/boot-manager-application.c index 5fb7436..825f3ce 100644 --- a/node-startup-controller/boot-manager-application.c +++ b/node-startup-controller/boot-manager-application.c @@ -26,7 +26,7 @@ #include <common/watchdog-client.h> #include <node-startup-controller/boot-manager-application.h> -#include <node-startup-controller/boot-manager-service.h> +#include <node-startup-controller/node-startup-controller-service.h> #include <node-startup-controller/job-manager.h> #include <node-startup-controller/la-handler-service.h> #include <node-startup-controller/luc-starter.h> @@ -44,10 +44,10 @@ enum PROP_0, PROP_CONNECTION, PROP_JOB_MANAGER, - PROP_BOOT_MANAGER_SERVICE, PROP_LUC_STARTER, PROP_LA_HANDLER, PROP_MAIN_LOOP, + PROP_NODE_STARTUP_CONTROLLER, }; @@ -85,35 +85,35 @@ struct _BootManagerApplicationClass struct _BootManagerApplication { - GObject __parent__; + GObject __parent__; /* the connection to D-Bus */ - GDBusConnection *connection; + GDBusConnection *connection; /* systemd watchdog client that repeatedly asks systemd to update * the watchdog timestamp */ - WatchdogClient *watchdog_client; + WatchdogClient *watchdog_client; /* manager of unit start and stop operations */ - JobManager *job_manager; + JobManager *job_manager; - /* boot manager service */ - BootManagerService *boot_manager_service; + /* implementation of the node startup controller service */ + NodeStartupControllerService *node_startup_controller; /* LUC starter to restore the LUC */ - LUCStarter *luc_starter; + LUCStarter *luc_starter; /* Legacy App Handler to register apps with the Node State Manager */ - LAHandlerService *la_handler; + LAHandlerService *la_handler; /* the application's main loop */ - GMainLoop *main_loop; + GMainLoop *main_loop; /* identifier for the registered bus name */ - guint bus_name_id; + guint bus_name_id; /* shutdown client for the boot manager itself */ - ShutdownClient *client; + ShutdownClient *client; }; @@ -165,16 +165,6 @@ boot_manager_application_class_init (BootManagerApplicationClass *klass) G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, - PROP_BOOT_MANAGER_SERVICE, - g_param_spec_object ("boot-manager-service", - "boot-manager-service", - "boot-manager-service", - BOOT_MANAGER_TYPE_SERVICE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_LUC_STARTER, g_param_spec_object ("luc-starter", "luc-starter", @@ -192,6 +182,16 @@ boot_manager_application_class_init (BootManagerApplicationClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, + PROP_NODE_STARTUP_CONTROLLER, + g_param_spec_object ("node-startup-controller", + "node-startup-controller", + "node-startup-controller", + TYPE_NODE_STARTUP_CONTROLLER_SERVICE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); } @@ -255,8 +255,8 @@ boot_manager_application_finalize (GObject *object) if (application->watchdog_client != NULL) g_object_unref (application->watchdog_client); - /* release the boot manager */ - g_object_unref (application->boot_manager_service); + /* release the node startup controller */ + g_object_unref (application->node_startup_controller); /* release the LUC starter */ g_object_unref (application->luc_starter); @@ -290,7 +290,7 @@ boot_manager_application_constructed (GObject *object) /* instantiate the LUC starter */ application->luc_starter = luc_starter_new (application->job_manager, - application->boot_manager_service); + application->node_startup_controller); /* be notified when LUC groups have started so that we can hand * control over to systemd again */ @@ -487,8 +487,8 @@ boot_manager_application_get_property (GObject *object, case PROP_JOB_MANAGER: g_value_set_object (value, application->job_manager); break; - case PROP_BOOT_MANAGER_SERVICE: - g_value_set_object (value, application->boot_manager_service); + case PROP_NODE_STARTUP_CONTROLLER: + g_value_set_object (value, application->node_startup_controller); case PROP_LA_HANDLER: g_value_set_object (value, application->la_handler); break; @@ -522,8 +522,8 @@ boot_manager_application_set_property (GObject *object, case PROP_JOB_MANAGER: application->job_manager = g_value_dup_object (value); break; - case PROP_BOOT_MANAGER_SERVICE: - application->boot_manager_service = g_value_dup_object (value); + case PROP_NODE_STARTUP_CONTROLLER: + application->node_startup_controller = g_value_dup_object (value); break; case PROP_LA_HANDLER: application->la_handler = g_value_dup_object (value); @@ -555,21 +555,21 @@ boot_manager_application_luc_groups_started (LUCStarter *starter, BootManagerApplication * -boot_manager_application_new (GMainLoop *main_loop, - GDBusConnection *connection, - JobManager *job_manager, - LAHandlerService *la_handler, - BootManagerService *boot_manager_service) +boot_manager_application_new (GMainLoop *main_loop, + GDBusConnection *connection, + JobManager *job_manager, + LAHandlerService *la_handler, + NodeStartupControllerService *node_startup_controller) { g_return_val_if_fail (main_loop != NULL, NULL); g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); g_return_val_if_fail (IS_JOB_MANAGER (job_manager), NULL); g_return_val_if_fail (LA_HANDLER_IS_SERVICE (la_handler), NULL); - g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (boot_manager_service), NULL); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER_SERVICE (node_startup_controller), NULL); return g_object_new (BOOT_MANAGER_TYPE_APPLICATION, "connection", connection, - "boot-manager-service", boot_manager_service, + "node-startup-controller", node_startup_controller, "job-manager", job_manager, "la-handler", la_handler, "main-loop", main_loop, diff --git a/node-startup-controller/boot-manager-application.h b/node-startup-controller/boot-manager-application.h index e7e5214..31b7c6a 100644 --- a/node-startup-controller/boot-manager-application.h +++ b/node-startup-controller/boot-manager-application.h @@ -12,7 +12,7 @@ #include <gio/gio.h> -#include <node-startup-controller/boot-manager-service.h> +#include <node-startup-controller/node-startup-controller-service.h> #include <node-startup-controller/job-manager.h> #include <node-startup-controller/la-handler-service.h> @@ -30,11 +30,11 @@ typedef struct _BootManagerApplication BootManagerApplication; GType boot_manager_application_get_type (void) G_GNUC_CONST; -BootManagerApplication *boot_manager_application_new (GMainLoop *main_loop, - GDBusConnection *connection, - JobManager *job_manager, - LAHandlerService *la_handler, - BootManagerService *boot_manager_service) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +BootManagerApplication *boot_manager_application_new (GMainLoop *main_loop, + GDBusConnection *connection, + JobManager *job_manager, + LAHandlerService *la_handler, + NodeStartupControllerService *node_startup_controller) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; G_END_DECLS diff --git a/node-startup-controller/boot-manager-service.h b/node-startup-controller/boot-manager-service.h deleted file mode 100644 index 7b4231c..0000000 --- a/node-startup-controller/boot-manager-service.h +++ /dev/null @@ -1,45 +0,0 @@ -/* vi:set et ai sw=2 sts=2 ts=2: */ -/* - - * Copyright (c) 2012 GENIVI. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef __BOOT_MANAGER_SERVICE_H__ -#define __BOOT_MANAGER_SERVICE_H__ - -#include <gio/gio.h> - -#include <node-startup-controller/systemd-manager-dbus.h> - -G_BEGIN_DECLS - -#define BOOT_MANAGER_TYPE_SERVICE (boot_manager_service_get_type ()) -#define BOOT_MANAGER_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOOT_MANAGER_TYPE_SERVICE, BootManagerService)) -#define BOOT_MANAGER_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOOT_MANAGER_TYPE_SERVICE, BootManagerServiceClass)) -#define BOOT_MANAGER_IS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOOT_MANAGER_TYPE_SERVICE)) -#define BOOT_MANAGER_IS_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOOT_MANAGER_TYPE_SERVICE)) -#define BOOT_MANAGER_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOOT_MANAGER_TYPE_SERVICE, BootManagerServiceClass)) - -typedef struct _BootManagerServiceClass BootManagerServiceClass; -typedef struct _BootManagerService BootManagerService; - - - -GType boot_manager_service_get_type (void) G_GNUC_CONST; - -BootManagerService *boot_manager_service_new (GDBusConnection *connection) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; -gboolean boot_manager_service_start_up (BootManagerService *service, - GError **error); -GVariant *boot_manager_service_read_luc (BootManagerService *service, - GError **error); -void boot_manager_service_write_luc (BootManagerService *service, - GError **error); - - -G_END_DECLS - -#endif /* !__BOOT_MANAGER_SERVICE_H__ */ - diff --git a/node-startup-controller/luc-starter.c b/node-startup-controller/luc-starter.c index 071f174..6130be5 100644 --- a/node-startup-controller/luc-starter.c +++ b/node-startup-controller/luc-starter.c @@ -22,9 +22,9 @@ #include <common/nsm-lifecycle-control-dbus.h> -#include <node-startup-controller/boot-manager-service.h> #include <node-startup-controller/job-manager.h> #include <node-startup-controller/luc-starter.h> +#include <node-startup-controller/node-startup-controller-service.h> @@ -46,7 +46,7 @@ enum { PROP_0, PROP_JOB_MANAGER, - PROP_BOOT_MANAGER_SERVICE, + PROP_NODE_STARTUP_CONTROLLER, }; @@ -88,18 +88,18 @@ struct _LUCStarterClass struct _LUCStarter { - GObject __parent__; + GObject __parent__; - JobManager *job_manager; - BootManagerService *boot_manager_service; - NSMLifecycleControl *nsm_lifecycle_control; + JobManager *job_manager; + NodeStartupControllerService *node_startup_controller; + NSMLifecycleControl *nsm_lifecycle_control; - GArray *prioritised_types; + GArray *prioritised_types; - GArray *start_order; - GHashTable *start_groups; + GArray *start_order; + GHashTable *start_groups; - GHashTable *cancellables; + GHashTable *cancellables; }; @@ -135,11 +135,11 @@ luc_starter_class_init (LUCStarterClass *klass) G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, - PROP_BOOT_MANAGER_SERVICE, - g_param_spec_object ("boot-manager-service", - "boot-manager-service", - "boot-manager-service", - BOOT_MANAGER_TYPE_SERVICE, + PROP_NODE_STARTUP_CONTROLLER, + g_param_spec_object ("node-startup-controller", + "node-startup-controller", + "node-startup-controller", + TYPE_NODE_STARTUP_CONTROLLER_SERVICE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); @@ -231,8 +231,8 @@ luc_starter_finalize (GObject *object) /* release the job manager */ g_object_unref (starter->job_manager); - /* release the boot manager service */ - g_object_unref (starter->boot_manager_service); + /* release the node startup controller service */ + g_object_unref (starter->node_startup_controller); (*G_OBJECT_CLASS (luc_starter_parent_class)->finalize) (object); } @@ -252,8 +252,8 @@ luc_starter_get_property (GObject *object, case PROP_JOB_MANAGER: g_value_set_object (value, starter->job_manager); break; - case PROP_BOOT_MANAGER_SERVICE: - g_value_set_object (value, starter->boot_manager_service); + case PROP_NODE_STARTUP_CONTROLLER: + g_value_set_object (value, starter->node_startup_controller); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -276,8 +276,8 @@ luc_starter_set_property (GObject *object, case PROP_JOB_MANAGER: starter->job_manager = g_value_dup_object (value); break; - case PROP_BOOT_MANAGER_SERVICE: - starter->boot_manager_service = g_value_dup_object (value); + case PROP_NODE_STARTUP_CONTROLLER: + starter->node_startup_controller = g_value_dup_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -562,7 +562,8 @@ luc_starter_start_groups_for_real (LUCStarter *starter) g_hash_table_remove_all (starter->cancellables); /* get the current last user context */ - context = boot_manager_service_read_luc (starter->boot_manager_service, &error); + context = node_startup_controller_service_read_luc (starter->node_startup_controller, + &error); if (error != NULL) { if (error->code == G_IO_ERROR_NOT_FOUND) @@ -617,15 +618,15 @@ luc_starter_start_groups_for_real (LUCStarter *starter) LUCStarter * -luc_starter_new (JobManager *job_manager, - BootManagerService *boot_manager_service) +luc_starter_new (JobManager *job_manager, + NodeStartupControllerService *node_startup_controller) { g_return_val_if_fail (IS_JOB_MANAGER (job_manager), NULL); - g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (boot_manager_service), NULL); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER_SERVICE (node_startup_controller), NULL); return g_object_new (TYPE_LUC_STARTER, "job-manager", job_manager, - "boot-manager-service", boot_manager_service, + "node-startup-controller-service", node_startup_controller, NULL); } diff --git a/node-startup-controller/luc-starter.h b/node-startup-controller/luc-starter.h index bcb145e..207f1bb 100644 --- a/node-startup-controller/luc-starter.h +++ b/node-startup-controller/luc-starter.h @@ -10,7 +10,7 @@ #ifndef __LUC_STARTER_H__ #define __LUC_STARTER_H__ -#include <node-startup-controller/boot-manager-service.h> +#include <node-startup-controller/node-startup-controller-service.h> #include <node-startup-controller/job-manager.h> G_BEGIN_DECLS @@ -27,10 +27,10 @@ typedef struct _LUCStarter LUCStarter; GType luc_starter_get_type (void) G_GNUC_CONST; -LUCStarter *luc_starter_new (JobManager *job_manager, - BootManagerService *boot_manager_service) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; -void luc_starter_start_groups (LUCStarter *starter); -void luc_starter_cancel (LUCStarter *starter); +LUCStarter *luc_starter_new (JobManager *job_manager, + NodeStartupControllerService *node_startup_controller) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +void luc_starter_start_groups (LUCStarter *starter); +void luc_starter_cancel (LUCStarter *starter); G_END_DECLS diff --git a/node-startup-controller/main.c b/node-startup-controller/main.c index 348597b..de7d2ce 100644 --- a/node-startup-controller/main.c +++ b/node-startup-controller/main.c @@ -21,9 +21,9 @@ #include <dlt/dlt.h> #include <node-startup-controller/boot-manager-application.h> -#include <node-startup-controller/boot-manager-dbus.h> -#include <node-startup-controller/boot-manager-service.h> #include <node-startup-controller/la-handler-service.h> +#include <node-startup-controller/node-startup-controller-dbus.h> +#include <node-startup-controller/node-startup-controller-service.h> #include <node-startup-controller/systemd-manager-dbus.h> #include <node-startup-controller/target-startup-monitor.h> @@ -48,16 +48,16 @@ int main (int argc, char **argv) { - BootManagerApplication *application; - TargetStartupMonitor *target_startup_monitor; - BootManagerService *boot_manager_service; - LAHandlerService *la_handler_service; - GDBusConnection *connection; - SystemdManager *systemd_manager; - JobManager *job_manager; - GMainLoop *main_loop; - GError *error = NULL; - gchar *msg; + NodeStartupControllerService *node_startup_controller; + BootManagerApplication *application; + TargetStartupMonitor *target_startup_monitor; + LAHandlerService *la_handler_service; + GDBusConnection *connection; + SystemdManager *systemd_manager; + JobManager *job_manager; + GMainLoop *main_loop; + GError *error = NULL; + gchar *msg; /* register the application and context in DLT */ DLT_REGISTER_APP ("BMGR", "GENIVI Boot Manager"); @@ -125,10 +125,10 @@ main (int argc, } /* instantiate the boot manager service implementation */ - boot_manager_service = boot_manager_service_new (connection); + node_startup_controller = node_startup_controller_service_new (connection); /* attempt to start the boot manager service */ - if (!boot_manager_service_start_up (boot_manager_service, &error)) + if (!node_startup_controller_service_start_up (node_startup_controller, &error)) { msg = g_strdup_printf ("Failed to start the boot manager service: %s", error->message); @@ -137,7 +137,7 @@ main (int argc, /* clean up */ g_error_free (error); - g_object_unref (boot_manager_service); + g_object_unref (node_startup_controller); g_object_unref (systemd_manager); g_object_unref (connection); @@ -162,7 +162,7 @@ main (int argc, g_clear_error (&error); g_object_unref (la_handler_service); g_object_unref (job_manager); - g_object_unref (boot_manager_service); + g_object_unref (node_startup_controller); g_object_unref (systemd_manager); g_object_unref (connection); @@ -176,8 +176,9 @@ main (int argc, target_startup_monitor = target_startup_monitor_new (systemd_manager); /* create and run the main application */ - application = boot_manager_application_new (main_loop, connection, job_manager, - la_handler_service, boot_manager_service); + application = boot_manager_application_new (main_loop, connection, + job_manager, la_handler_service, + node_startup_controller); /* run the main loop */ g_main_loop_run (main_loop); @@ -188,7 +189,7 @@ main (int argc, g_object_unref (target_startup_monitor); g_object_unref (systemd_manager); g_object_unref (job_manager); - g_object_unref (boot_manager_service); + g_object_unref (node_startup_controller); g_object_unref (connection); return EXIT_SUCCESS; diff --git a/node-startup-controller/boot-manager-dbus.xml b/node-startup-controller/node-startup-controller-dbus.xml index c1e92a0..c704337 100644 --- a/node-startup-controller/boot-manager-dbus.xml +++ b/node-startup-controller/node-startup-controller-dbus.xml @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> -<node name="/org/genivi/BootManager1/BootManager"> +<node name="/org/genivi/NodeStartupController1/NodeStartupController"> <!-- - org.genivi.BootManager1.BootManager: + org.genivi.NodeStartupController1.NodeStartupController: @short_description: Interface for managing the GENIVI LUC (Last User Context) - The GENIVI Boot Manager remembers applications that were used in the last - session of a user. It is used in order to restore these applications on - the next start-up. + The GENIVI Node Startup Controller remembers applications that were used + in the last session of a user. It is used in order to restore these + applications on the next start-up. - The Boot Manager is a passive component in the sense that it does not - remember applications on its own; instead, applications need to register - and deregister themselves proactively. + The Node Startup Controller is a passive component in the sense that it + does not remember applications on its own; instead, applications need to + register and deregister themselves proactively. Applications can be registered for different LUC types, the standard ones being "foreground", "background" and "audible". --> - <interface name="org.genivi.BootManager1.BootManager"> + <interface name="org.genivi.NodeStartupController1.NodeStartupController"> <!-- BeginLUCRegistration: @@ -52,7 +52,8 @@ <!-- FinishLUCRegistration: - Finishes the LUC registration sequence and atomically replaces the previous LUC. + Finishes the LUC registration sequence and atomically replaces the + previous LUC. --> <method name="FinishLUCRegistration"> <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> diff --git a/node-startup-controller/boot-manager-service.c b/node-startup-controller/node-startup-controller-service.c index c775d44..5e7d1d6 100644 --- a/node-startup-controller/boot-manager-service.c +++ b/node-startup-controller/node-startup-controller-service.c @@ -18,8 +18,8 @@ #include <dlt/dlt.h> #include <node-startup-controller/glib-extensions.h> -#include <node-startup-controller/boot-manager-dbus.h> -#include <node-startup-controller/boot-manager-service.h> +#include <node-startup-controller/node-startup-controller-dbus.h> +#include <node-startup-controller/node-startup-controller-service.h> @@ -36,59 +36,61 @@ enum -static void boot_manager_service_finalize (GObject *object); -static void boot_manager_service_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void boot_manager_service_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static gboolean boot_manager_service_handle_begin_luc_registration (BootManager *interface, - GDBusMethodInvocation *invocation, - BootManagerService *service); -static gboolean boot_manager_service_handle_finish_luc_registration (BootManager *interface, - GDBusMethodInvocation *invocation, - BootManagerService *service); -static gboolean boot_manager_service_handle_register_with_luc (BootManager *interface, - GDBusMethodInvocation *invocation, - GVariant *apps, - BootManagerService *service); +static void node_startup_controller_service_finalize (GObject *object); +static void node_startup_controller_service_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void node_startup_controller_service_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static gboolean node_startup_controller_service_handle_begin_luc_registration (NodeStartupController *interface, + GDBusMethodInvocation *invocation, + NodeStartupControllerService *service); +static gboolean node_startup_controller_service_handle_finish_luc_registration (NodeStartupController *interface, + GDBusMethodInvocation *invocation, + NodeStartupControllerService *service); +static gboolean node_startup_controller_service_handle_register_with_luc (NodeStartupController *interface, + GDBusMethodInvocation *invocation, + GVariant *apps, + NodeStartupControllerService *service); -struct _BootManagerServiceClass +struct _NodeStartupControllerServiceClass { GObjectClass __parent__; }; -struct _BootManagerService +struct _NodeStartupControllerService { - GObject __parent__; + GObject __parent__; - GDBusConnection *connection; - BootManager *interface; + GDBusConnection *connection; + NodeStartupController *interface; - GVariant *current_user_context; - gboolean started_registration; + GVariant *current_user_context; + gboolean started_registration; }; -G_DEFINE_TYPE (BootManagerService, boot_manager_service, G_TYPE_OBJECT); +G_DEFINE_TYPE (NodeStartupControllerService, + node_startup_controller_service, + G_TYPE_OBJECT); static void -boot_manager_service_class_init (BootManagerServiceClass *klass) +node_startup_controller_service_class_init (NodeStartupControllerServiceClass *klass) { GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = boot_manager_service_finalize; - gobject_class->get_property = boot_manager_service_get_property; - gobject_class->set_property = boot_manager_service_set_property; + gobject_class->finalize = node_startup_controller_service_finalize; + gobject_class->get_property = node_startup_controller_service_get_property; + gobject_class->set_property = node_startup_controller_service_set_property; g_object_class_install_property (gobject_class, PROP_CONNECTION, @@ -104,9 +106,9 @@ boot_manager_service_class_init (BootManagerServiceClass *klass) static void -boot_manager_service_init (BootManagerService *service) +node_startup_controller_service_init (NodeStartupControllerService *service) { - service->interface = boot_manager_skeleton_new (); + service->interface = node_startup_controller_skeleton_new (); /* initially, no registration is assumed to have been started */ service->started_registration = FALSE; @@ -116,26 +118,26 @@ boot_manager_service_init (BootManagerService *service) /* implement the RegisterWithLUC() handler */ g_signal_connect (service->interface, "handle-register-with-luc", - G_CALLBACK (boot_manager_service_handle_register_with_luc), + G_CALLBACK (node_startup_controller_service_handle_register_with_luc), service); /* implement the BeginLUCRegistration() handler */ g_signal_connect (service->interface, "handle-begin-lucregistration", - G_CALLBACK (boot_manager_service_handle_begin_luc_registration), + G_CALLBACK (node_startup_controller_service_handle_begin_luc_registration), service); /* implement the FinishLUCRegistration() handler */ g_signal_connect (service->interface, "handle-finish-lucregistration", - G_CALLBACK (boot_manager_service_handle_finish_luc_registration), + G_CALLBACK (node_startup_controller_service_handle_finish_luc_registration), service); } static void -boot_manager_service_finalize (GObject *object) +node_startup_controller_service_finalize (GObject *object) { - BootManagerService *service = BOOT_MANAGER_SERVICE (object); + NodeStartupControllerService *service = NODE_STARTUP_CONTROLLER_SERVICE (object); /* release the D-Bus connection object */ g_object_unref (service->connection); @@ -150,18 +152,18 @@ boot_manager_service_finalize (GObject *object) if (service->current_user_context != NULL) g_variant_unref (service->current_user_context); - (*G_OBJECT_CLASS (boot_manager_service_parent_class)->finalize) (object); + (*G_OBJECT_CLASS (node_startup_controller_service_parent_class)->finalize) (object); } static void -boot_manager_service_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +node_startup_controller_service_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - BootManagerService *service = BOOT_MANAGER_SERVICE (object); + NodeStartupControllerService *service = NODE_STARTUP_CONTROLLER_SERVICE (object); switch (prop_id) { @@ -177,12 +179,12 @@ boot_manager_service_get_property (GObject *object, static void -boot_manager_service_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +node_startup_controller_service_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - BootManagerService *service = BOOT_MANAGER_SERVICE (object); + NodeStartupControllerService *service = NODE_STARTUP_CONTROLLER_SERVICE (object); switch (prop_id) { @@ -198,15 +200,15 @@ boot_manager_service_set_property (GObject *object, static gboolean -boot_manager_service_handle_begin_luc_registration (BootManager *interface, - GDBusMethodInvocation *invocation, - BootManagerService *service) +node_startup_controller_service_handle_begin_luc_registration (NodeStartupController *interface, + GDBusMethodInvocation *invocation, + NodeStartupControllerService *service) { GVariantBuilder builder; - g_return_val_if_fail (IS_BOOT_MANAGER (interface), FALSE); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER (interface), FALSE); g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), FALSE); - g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (service), FALSE); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER_SERVICE (service), FALSE); /* mark the last user context registration as started */ service->started_registration = TRUE; @@ -223,16 +225,16 @@ boot_manager_service_handle_begin_luc_registration (BootManager *inter static gboolean -boot_manager_service_handle_finish_luc_registration (BootManager *interface, - GDBusMethodInvocation *invocation, - BootManagerService *service) +node_startup_controller_service_handle_finish_luc_registration (NodeStartupController *interface, + GDBusMethodInvocation *invocation, + NodeStartupControllerService *service) { GError *error = NULL; gchar *log_text; - g_return_val_if_fail (IS_BOOT_MANAGER (interface), FALSE); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER (interface), FALSE); g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), FALSE); - g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (service), FALSE); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER_SERVICE (service), FALSE); /* check if last user context registration started */ if (!service->started_registration) @@ -248,7 +250,7 @@ boot_manager_service_handle_finish_luc_registration (BootManager *inte } /* write the last user context in a file */ - boot_manager_service_write_luc (service, &error); + node_startup_controller_service_write_luc (service, &error); if (error != NULL) { log_text = g_strdup_printf ("Failed to finish LUC registration: %s", error->message); @@ -272,10 +274,10 @@ boot_manager_service_handle_finish_luc_registration (BootManager *inte static gboolean -boot_manager_service_handle_register_with_luc (BootManager *interface, - GDBusMethodInvocation *invocation, - GVariant *apps, - BootManagerService *service) +node_startup_controller_service_handle_register_with_luc (NodeStartupController *interface, + GDBusMethodInvocation *invocation, + GVariant *apps, + NodeStartupControllerService *service) { GVariantBuilder dict_builder; GHashTableIter hiter; @@ -294,9 +296,9 @@ boot_manager_service_handle_register_with_luc (BootManager *interface, guint n; gint luc_type; - g_return_val_if_fail (IS_BOOT_MANAGER (interface), FALSE); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER (interface), FALSE); g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), FALSE); - g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (service), FALSE); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER_SERVICE (service), FALSE); /* check if last user context registration started */ if (!service->started_registration) @@ -425,12 +427,12 @@ boot_manager_service_handle_register_with_luc (BootManager *interface, -BootManagerService * -boot_manager_service_new (GDBusConnection *connection) +NodeStartupControllerService * +node_startup_controller_service_new (GDBusConnection *connection) { g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); - return g_object_new (BOOT_MANAGER_TYPE_SERVICE, + return g_object_new (TYPE_NODE_STARTUP_CONTROLLER_SERVICE, "connection", connection, NULL); } @@ -438,24 +440,24 @@ boot_manager_service_new (GDBusConnection *connection) gboolean -boot_manager_service_start_up (BootManagerService *service, - GError **error) +node_startup_controller_service_start_up (NodeStartupControllerService *service, + GError **error) { - g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (service), FALSE); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER_SERVICE (service), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - /* announce the org.genivi.BootManager1.BootManager service on the bus */ + /* announce the org.genivi.NodeStartupController1.NodeStartupController service on the bus */ return g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (service->interface), service->connection, - "/org/genivi/BootManager1/BootManager", + "/org/genivi/NodeStartupController1/NodeStartupController", error); } GVariant * -boot_manager_service_read_luc (BootManagerService *service, - GError **error) +node_startup_controller_service_read_luc (NodeStartupControllerService *service, + GError **error) { const gchar *luc_path; GVariant *context; @@ -463,7 +465,7 @@ boot_manager_service_read_luc (BootManagerService *service, char *data; gsize data_len; - g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (service), NULL); + g_return_val_if_fail (IS_NODE_STARTUP_CONTROLLER_SERVICE (service), NULL); g_return_val_if_fail ((error == NULL || *error == NULL), NULL); /* check which configuration file to use; the LUC_PATH environment variable @@ -494,15 +496,15 @@ boot_manager_service_read_luc (BootManagerService *service, void -boot_manager_service_write_luc (BootManagerService *service, - GError **error) +node_startup_controller_service_write_luc (NodeStartupControllerService *service, + GError **error) { const gchar *luc_path; GError *err = NULL; GFile *luc_file; GFile *luc_dir; - g_return_if_fail (BOOT_MANAGER_IS_SERVICE (service)); + g_return_if_fail (IS_NODE_STARTUP_CONTROLLER_SERVICE (service)); g_return_if_fail (error == NULL || *error == NULL); /* check which configuration file to use; the LUC_PATH environment variable diff --git a/node-startup-controller/node-startup-controller-service.h b/node-startup-controller/node-startup-controller-service.h new file mode 100644 index 0000000..a010cce --- /dev/null +++ b/node-startup-controller/node-startup-controller-service.h @@ -0,0 +1,45 @@ +/* vi:set et ai sw=2 sts=2 ts=2: */ +/* - + * Copyright (c) 2012 GENIVI. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __NODE_STARTUP_CONTROLLER_SERVICE_H__ +#define __NODE_STARTUP_CONTROLLER_SERVICE_H__ + +#include <gio/gio.h> + +#include <node-startup-controller/systemd-manager-dbus.h> + +G_BEGIN_DECLS + +#define TYPE_NODE_STARTUP_CONTROLLER_SERVICE (node_startup_controller_service_get_type ()) +#define NODE_STARTUP_CONTROLLER_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_STARTUP_CONTROLLER_SERVICE, NodeStartupControllerService)) +#define NODE_STARTUP_CONTROLLER_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_STARTUP_CONTROLLER_SERVICE, NodeStartupControllerServiceClass)) +#define IS_NODE_STARTUP_CONTROLLER_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_STARTUP_CONTROLLER_SERVICE)) +#define IS_NODE_STARTUP_CONTROLLER_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_STARTUP_CONTROLLER_SERVICE)) +#define NODE_STARTUP_CONTROLLER_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_STARTUP_CONTROLLER_SERVICE, NodeStartupControllerServiceClass)) + +typedef struct _NodeStartupControllerServiceClass NodeStartupControllerServiceClass; +typedef struct _NodeStartupControllerService NodeStartupControllerService; + + + +GType node_startup_controller_service_get_type (void) G_GNUC_CONST; + +NodeStartupControllerService *node_startup_controller_service_new (GDBusConnection *connection) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +gboolean node_startup_controller_service_start_up (NodeStartupControllerService *service, + GError **error); +GVariant *node_startup_controller_service_read_luc (NodeStartupControllerService *service, + GError **error); +void node_startup_controller_service_write_luc (NodeStartupControllerService *service, + GError **error); + + +G_END_DECLS + +#endif /* !__NODE_STARTUP_CONTROLLER_SERVICE_H__ */ + diff --git a/node-startup-controller/target-startup-monitor.c b/node-startup-controller/target-startup-monitor.c index 722ab56..dd8a130 100644 --- a/node-startup-controller/target-startup-monitor.c +++ b/node-startup-controller/target-startup-monitor.c @@ -19,7 +19,6 @@ #include <common/nsm-enum-types.h> #include <common/nsm-lifecycle-control-dbus.h> -#include <node-startup-controller/boot-manager-dbus.h> #include <node-startup-controller/target-startup-monitor.h> #include <node-startup-controller/systemd-unit-dbus.h> @@ -153,7 +152,7 @@ target_startup_monitor_init (TargetStartupMonitor *monitor) /* set the initial state to base running, which means that * the mandatory.target has been started (this is done before the - * boot manager itself is brought up) */ + * node startup controller itself is brought up) */ target_startup_monitor_set_node_state (monitor, NSM_NODE_STATE_BASE_RUNNING); /* create the table of targets and their node states */ |