boot-manager-application.h \
boot-manager-service.c \
boot-manager-service.h \
+ luc-starter.c \
+ luc-starter.h \
main.c \
$(boot_manager_built_sources)
#include <boot-manager/boot-manager-dbus.h>
#include <boot-manager/boot-manager-application.h>
#include <boot-manager/boot-manager-service.h>
+#include <boot-manager/luc-starter.h>
enum
{
PROP_0,
- PROP_BOOT_MANAGER_SERVICE,
+ PROP_BOOT_MANAGER,
+ PROP_LUC_STARTER,
};
static void boot_manager_application_finalize (GObject *object);
+static void boot_manager_application_constructed (GObject *object);
static void boot_manager_application_get_property (GObject *object,
guint prop_id,
GValue *value,
* the watchdog timestamp */
WatchdogClient *watchdog_client;
- /* service object that implements the boot manager D-Bus interface */
- BootManagerService *service;
+ /* implementation of the boot manager D-Bus interface */
+ BootManagerService *boot_manager;
+
+ /* LUC starter to restore the LUC */
+ LUCStarter *luc_starter;
};
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = boot_manager_application_finalize;
+ gobject_class->constructed = boot_manager_application_constructed;
gobject_class->get_property = boot_manager_application_get_property;
gobject_class->set_property = boot_manager_application_set_property;
gapplication_class->startup = boot_manager_application_startup;
g_object_class_install_property (gobject_class,
- PROP_BOOT_MANAGER_SERVICE,
- g_param_spec_object ("boot-manager-service",
- "boot-manager-service",
- "boot-manager-service",
+ PROP_BOOT_MANAGER,
+ g_param_spec_object ("boot-manager",
+ "boot-manager",
+ "boot-manager",
BOOT_MANAGER_TYPE_SERVICE,
G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
+ 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",
+ "luc-starter",
+ TYPE_LUC_STARTER,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
}
/* release the watchdog client */
g_object_unref (application->watchdog_client);
- /* release the boot manager service implementation */
- if (application->service != NULL)
- g_object_unref (application->service);
+ /* release the boot manager implementation */
+ if (application->boot_manager != NULL)
+ g_object_unref (application->boot_manager);
(*G_OBJECT_CLASS (boot_manager_application_parent_class)->finalize) (object);
}
static void
+boot_manager_application_constructed (GObject *object)
+{
+ BootManagerApplication *application = BOOT_MANAGER_APPLICATION (object);
+
+ /* create the LUC starter */
+ application->luc_starter = luc_starter_new (application->boot_manager);
+}
+
+
+
+static void
boot_manager_application_get_property (GObject *object,
guint prop_id,
GValue *value,
switch (prop_id)
{
- case PROP_BOOT_MANAGER_SERVICE:
- g_value_set_object (value, application->service);
+ case PROP_BOOT_MANAGER:
+ g_value_set_object (value, application->boot_manager);
+ break;
+ case PROP_LUC_STARTER:
+ g_value_set_object (value, application->luc_starter);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
switch (prop_id)
{
- case PROP_BOOT_MANAGER_SERVICE:
- application->service = g_value_dup_object (value);
+ case PROP_BOOT_MANAGER:
+ application->boot_manager = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
static void
boot_manager_application_startup (GApplication *app)
{
+ BootManagerApplication *application = BOOT_MANAGER_APPLICATION (app);
+
+ /* chain up to the parent class */
(*G_APPLICATION_CLASS (boot_manager_application_parent_class)->startup) (app);
+
+ /* restore the LUC if desired */
+ luc_starter_start_groups (application->luc_starter);
}
BootManagerApplication *
-boot_manager_application_new (BootManagerService *service)
+boot_manager_application_new (BootManagerService *boot_manager)
{
+ g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (boot_manager), NULL);
+
return g_object_new (BOOT_MANAGER_TYPE_APPLICATION,
"application-id", "org.genivi.BootManager1",
"flags", G_APPLICATION_IS_SERVICE,
- "boot-manager-service", service,
+ "boot-manager", boot_manager,
NULL);
}
--- /dev/null
+/* 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/.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#include <boot-manager/boot-manager-service.h>
+#include <boot-manager/luc-starter.h>
+
+
+
+/* property identifiers */
+enum
+{
+ PROP_0,
+ PROP_BOOT_MANAGER,
+};
+
+
+
+static void luc_starter_finalize (GObject *object);
+static void luc_starter_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void luc_starter_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+
+
+struct _LUCStarterClass
+{
+ GObjectClass __parent__;
+};
+
+struct _LUCStarter
+{
+ GObject __parent__;
+
+ BootManagerService *boot_manager;
+};
+
+
+
+G_DEFINE_TYPE (LUCStarter, luc_starter, G_TYPE_OBJECT);
+
+
+
+static void
+luc_starter_class_init (LUCStarterClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = luc_starter_finalize;
+ gobject_class->get_property = luc_starter_get_property;
+ gobject_class->set_property = luc_starter_set_property;
+
+ g_object_class_install_property (gobject_class,
+ PROP_BOOT_MANAGER,
+ g_param_spec_object ("boot-manager",
+ "boot-manager",
+ "boot-manager",
+ BOOT_MANAGER_TYPE_SERVICE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+}
+
+
+
+static void
+luc_starter_init (LUCStarter *service)
+{
+}
+
+
+
+static void
+luc_starter_finalize (GObject *object)
+{
+ LUCStarter *service = LUC_STARTER (object);
+
+ /* release the boot manager */
+ g_object_unref (service->boot_manager);
+
+ (*G_OBJECT_CLASS (luc_starter_parent_class)->finalize) (object);
+}
+
+
+
+static void
+luc_starter_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ LUCStarter *service = LUC_STARTER (object);
+
+ switch (prop_id)
+ {
+ case PROP_BOOT_MANAGER:
+ g_value_set_object (value, service->boot_manager);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+luc_starter_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ LUCStarter *service = LUC_STARTER (object);
+
+ switch (prop_id)
+ {
+ case PROP_BOOT_MANAGER:
+ service->boot_manager = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+LUCStarter *
+luc_starter_new (BootManagerService *boot_manager)
+{
+ g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (boot_manager), NULL);
+ return g_object_new (TYPE_LUC_STARTER, "boot-manager", boot_manager, NULL);
+}
+
+
+
+void
+luc_starter_start_groups (LUCStarter *starter)
+{
+ g_debug ("restore LUC if desired");
+}
--- /dev/null
+/* 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 __LUC_STARTER_H__
+#define __LUC_STARTER_H__
+
+#include <boot-manager/boot-manager-service.h>
+
+G_BEGIN_DECLS
+
+#define TYPE_LUC_STARTER (luc_starter_get_type ())
+#define LUC_STARTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LUC_STARTER, LUCStarter))
+#define LUC_STARTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LUC_STARTER, LUCStarterClass))
+#define IS_LUC_STARTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LUC_STARTER))
+#define IS_LUC_STARTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LUC_STARTER)
+#define LUC_STARTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LUC_STARTER, LUCStarterClass))
+
+typedef struct _LUCStarterClass LUCStarterClass;
+typedef struct _LUCStarter LUCStarter;
+
+GType luc_starter_get_type (void) G_GNUC_CONST;
+
+LUCStarter *luc_starter_new (BootManagerService *boot_manager) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+void luc_starter_start_groups (LUCStarter *starter);
+
+G_END_DECLS
+
+#endif /* !__LUC_STARTER_H__ */
+
dnl *** Configure option for prioritising LUC types ***
dnl ***************************************************
AC_ARG_WITH([prioritised-luc-types],
- [AS_HELP_STRING([--with-prioritised-luc-types=LIST],
- [Comma-separated list of LUC types to be prioritised during start-up])],
- [with_prioritised_luc_types=$withval], [with_prioritised_luc_types=])
+ [AS_HELP_STRING([--with-prioritised-luc-types=LIST],
+ [Comma-separated list of LUC types to be prioritised during start-up])],
+ [with_prioritised_luc_types=$withval], [with_prioritised_luc_types=])
AC_DEFINE_UNQUOTED([PRIORITISED_LUC_TYPES],
- ["$with_prioritised_luc_types"],
- [Prioritised LUC types])
+ ["$with_prioritised_luc_types"],
+ [Prioritised LUC types])
+
+dnl ***********************************
+dnl *** Check for debugging support ***
+dnl ***********************************
+AC_ARG_ENABLE([debug],
+ AC_HELP_STRING([--enable-debug@:@=no|yes@:>@],
+ [Build with debugging support @<:@default=m4_default([$1], [no])@:>@]),
+ [enable_debug=$enableval], [enable_debug=m4_default([$1], [no])])
+AC_MSG_CHECKING([whether to build with debugging support])
+if test x"$enable_debug" = x"yes"; then
+ AC_DEFINE([DEBUG], [1], [Define for debugging support])
+
+ CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
+ CFLAGS="$CFLAGS -Werror -Wall -Wextra \
+ -Wno-missing-field-initializers \
+ -Wno-unused-parameter -Wold-style-definition \
+ -Wdeclaration-after-statement \
+ -Wmissing-declarations \
+ -Wmissing-noreturn -Wshadow -Wpointer-arith \
+ -Wcast-align -Wformat-security \
+ -Winit-self -Wmissing-include-dirs -Wundef \
+ -Wmissing-format-attribute -Wnested-externs \
+ -fstack-protector"
+
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
AC_OUTPUT([
Makefile