[ostree] admin: Add API to OtBootloader to get name



commit 000dd5add39f69b7ad653234c56ea62e36581da6
Author: Colin Walters <walters verbum org>
Date:   Thu Aug 22 06:33:04 2013 -0400

    admin: Add API to OtBootloader to get name
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706548

 src/ostree/ot-bootloader-syslinux.c |    7 +++++++
 src/ostree/ot-bootloader-uboot.c    |    7 +++++++
 src/ostree/ot-bootloader.c          |   13 +++++++++++++
 src/ostree/ot-bootloader.h          |    3 +++
 4 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/ostree/ot-bootloader-syslinux.c b/src/ostree/ot-bootloader-syslinux.c
index 790db09..3fe5df7 100644
--- a/src/ostree/ot-bootloader-syslinux.c
+++ b/src/ostree/ot-bootloader-syslinux.c
@@ -49,6 +49,12 @@ ot_bootloader_syslinux_query (OtBootloader *bootloader)
   return g_file_query_file_type (self->config_path, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == 
G_FILE_TYPE_SYMBOLIC_LINK;
 }
 
+static const char *
+ot_bootloader_syslinux_get_name (OtBootloader *bootloader)
+{
+  return "syslinux";
+}
+
 static gboolean
 append_config_from_boot_loader_entries (OtBootloaderSyslinux  *self,
                                         gboolean               regenerate_default,
@@ -267,6 +273,7 @@ static void
 ot_bootloader_syslinux_bootloader_iface_init (OtBootloaderInterface *iface)
 {
   iface->query = ot_bootloader_syslinux_query;
+  iface->get_name = ot_bootloader_syslinux_get_name;
   iface->write_config = ot_bootloader_syslinux_write_config;
 }
 
diff --git a/src/ostree/ot-bootloader-uboot.c b/src/ostree/ot-bootloader-uboot.c
index e065a80..43dfe1e 100644
--- a/src/ostree/ot-bootloader-uboot.c
+++ b/src/ostree/ot-bootloader-uboot.c
@@ -53,6 +53,12 @@ ot_bootloader_uboot_query (OtBootloader *bootloader)
   return g_file_query_file_type (self->config_path, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == 
G_FILE_TYPE_SYMBOLIC_LINK;
 }
 
+static const char *
+ot_bootloader_uboot_get_name (OtBootloader *bootloader)
+{
+  return "U-Boot";
+}
+
 static gboolean
 create_config_from_boot_loader_entries (OtBootloaderUboot     *self,
                                         int                    bootversion,
@@ -153,6 +159,7 @@ static void
 ot_bootloader_uboot_bootloader_iface_init (OtBootloaderInterface *iface)
 {
   iface->query = ot_bootloader_uboot_query;
+  iface->get_name = ot_bootloader_uboot_get_name;
   iface->write_config = ot_bootloader_uboot_write_config;
 }
 
diff --git a/src/ostree/ot-bootloader.c b/src/ostree/ot-bootloader.c
index 27edaa0..b74b3ab 100644
--- a/src/ostree/ot-bootloader.c
+++ b/src/ostree/ot-bootloader.c
@@ -37,6 +37,19 @@ ot_bootloader_query (OtBootloader  *self)
   return OT_BOOTLOADER_GET_IFACE (self)->query (self);
 }
 
+/**
+ * ot_bootloader_get_name:
+ *
+ * Returns: (transfer none): Name of this bootloader
+ */
+const char *
+ot_bootloader_get_name (OtBootloader  *self)
+{
+  g_return_val_if_fail (OT_IS_BOOTLOADER (self), NULL);
+
+  return OT_BOOTLOADER_GET_IFACE (self)->get_name (self);
+}
+
 gboolean
 ot_bootloader_write_config (OtBootloader  *self,
                             int            bootversion,
diff --git a/src/ostree/ot-bootloader.h b/src/ostree/ot-bootloader.h
index 098291a..e7ae075 100644
--- a/src/ostree/ot-bootloader.h
+++ b/src/ostree/ot-bootloader.h
@@ -38,6 +38,7 @@ struct _OtBootloaderInterface
 
   /* virtual functions */
   gboolean             (* query)                  (OtBootloader  *self);
+  const char *         (* get_name)               (OtBootloader  *self);
   gboolean             (* write_config)           (OtBootloader  *self,
                                                    int            bootversion,
                                                    GCancellable  *cancellable,
@@ -48,6 +49,8 @@ GType ot_bootloader_get_type (void) G_GNUC_CONST;
 
 gboolean ot_bootloader_query (OtBootloader *self);
 
+const char *ot_bootloader_get_name (OtBootloader  *self);
+
 gboolean ot_bootloader_write_config (OtBootloader  *self,
                                      int            bootversion,
                                      GCancellable  *cancellable,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]