mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
libostree: Make OstreeBootloader private
It was only temporarily public while functionality was being merged down; that's done now.
This commit is contained in:
parent
4abaf27e57
commit
ac0154713d
@ -27,7 +27,6 @@ libostree_public_headers = \
|
||||
src/libostree/ostree-repo-file.h \
|
||||
src/libostree/ostree-diff.h \
|
||||
src/libostree/ostree-sysroot.h \
|
||||
src/libostree/ostree-bootloader.h \
|
||||
src/libostree/ostree-deployment.h \
|
||||
src/libostree/ostree-bootconfig-parser.h \
|
||||
$(NULL)
|
||||
|
@ -49,6 +49,7 @@ libostree_1_la_SOURCES = \
|
||||
src/libostree/ostree-sysroot-deploy.c \
|
||||
src/libostree/ostree-bootconfig-parser.c \
|
||||
src/libostree/ostree-deployment.c \
|
||||
src/libostree/ostree-bootloader.h \
|
||||
src/libostree/ostree-bootloader.c \
|
||||
src/libostree/ostree-bootloader-syslinux.h \
|
||||
src/libostree/ostree-bootloader-syslinux.c \
|
||||
|
@ -37,12 +37,12 @@ struct _OstreeBootloaderSyslinux
|
||||
|
||||
typedef GObjectClass OstreeBootloaderSyslinuxClass;
|
||||
|
||||
static void ostree_bootloader_syslinux_bootloader_iface_init (OstreeBootloaderInterface *iface);
|
||||
G_DEFINE_TYPE_WITH_CODE (OstreeBootloaderSyslinux, ostree_bootloader_syslinux, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (OSTREE_TYPE_BOOTLOADER, ostree_bootloader_syslinux_bootloader_iface_init));
|
||||
static void _ostree_bootloader_syslinux_bootloader_iface_init (OstreeBootloaderInterface *iface);
|
||||
G_DEFINE_TYPE_WITH_CODE (OstreeBootloaderSyslinux, _ostree_bootloader_syslinux, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (OSTREE_TYPE_BOOTLOADER, _ostree_bootloader_syslinux_bootloader_iface_init));
|
||||
|
||||
static gboolean
|
||||
ostree_bootloader_syslinux_query (OstreeBootloader *bootloader)
|
||||
_ostree_bootloader_syslinux_query (OstreeBootloader *bootloader)
|
||||
{
|
||||
OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (bootloader);
|
||||
|
||||
@ -50,7 +50,7 @@ ostree_bootloader_syslinux_query (OstreeBootloader *bootloader)
|
||||
}
|
||||
|
||||
static const char *
|
||||
ostree_bootloader_syslinux_get_name (OstreeBootloader *bootloader)
|
||||
_ostree_bootloader_syslinux_get_name (OstreeBootloader *bootloader)
|
||||
{
|
||||
return "syslinux";
|
||||
}
|
||||
@ -111,7 +111,7 @@ append_config_from_boostree_loader_entries (OstreeBootloaderSyslinux *self,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader,
|
||||
_ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader,
|
||||
int bootversion,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@ -254,39 +254,39 @@ ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader,
|
||||
}
|
||||
|
||||
static void
|
||||
ostree_bootloader_syslinux_finalize (GObject *object)
|
||||
_ostree_bootloader_syslinux_finalize (GObject *object)
|
||||
{
|
||||
OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (object);
|
||||
|
||||
g_clear_object (&self->sysroot);
|
||||
g_clear_object (&self->config_path);
|
||||
|
||||
G_OBJECT_CLASS (ostree_bootloader_syslinux_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (_ostree_bootloader_syslinux_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
void
|
||||
ostree_bootloader_syslinux_init (OstreeBootloaderSyslinux *self)
|
||||
_ostree_bootloader_syslinux_init (OstreeBootloaderSyslinux *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
ostree_bootloader_syslinux_bootloader_iface_init (OstreeBootloaderInterface *iface)
|
||||
_ostree_bootloader_syslinux_bootloader_iface_init (OstreeBootloaderInterface *iface)
|
||||
{
|
||||
iface->query = ostree_bootloader_syslinux_query;
|
||||
iface->get_name = ostree_bootloader_syslinux_get_name;
|
||||
iface->write_config = ostree_bootloader_syslinux_write_config;
|
||||
iface->query = _ostree_bootloader_syslinux_query;
|
||||
iface->get_name = _ostree_bootloader_syslinux_get_name;
|
||||
iface->write_config = _ostree_bootloader_syslinux_write_config;
|
||||
}
|
||||
|
||||
void
|
||||
ostree_bootloader_syslinux_class_init (OstreeBootloaderSyslinuxClass *class)
|
||||
_ostree_bootloader_syslinux_class_init (OstreeBootloaderSyslinuxClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = ostree_bootloader_syslinux_finalize;
|
||||
object_class->finalize = _ostree_bootloader_syslinux_finalize;
|
||||
}
|
||||
|
||||
OstreeBootloaderSyslinux *
|
||||
ostree_bootloader_syslinux_new (OstreeSysroot *sysroot)
|
||||
_ostree_bootloader_syslinux_new (OstreeSysroot *sysroot)
|
||||
{
|
||||
OstreeBootloaderSyslinux *self = g_object_new (OSTREE_TYPE_BOOTLOADER_SYSLINUX, NULL);
|
||||
self->sysroot = g_object_ref (sysroot);
|
||||
|
@ -24,15 +24,15 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define OSTREE_TYPE_BOOTLOADER_SYSLINUX (ostree_bootloader_syslinux_get_type ())
|
||||
#define OSTREE_TYPE_BOOTLOADER_SYSLINUX (_ostree_bootloader_syslinux_get_type ())
|
||||
#define OSTREE_BOOTLOADER_SYSLINUX(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OSTREE_TYPE_BOOTLOADER_SYSLINUX, OstreeBootloaderSyslinux))
|
||||
#define OSTREE_IS_BOOTLOADER_SYSLINUX(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OSTREE_TYPE_BOOTLOADER_SYSLINUX))
|
||||
|
||||
typedef struct _OstreeBootloaderSyslinux OstreeBootloaderSyslinux;
|
||||
|
||||
GType ostree_bootloader_syslinux_get_type (void) G_GNUC_CONST;
|
||||
GType _ostree_bootloader_syslinux_get_type (void) G_GNUC_CONST;
|
||||
|
||||
OstreeBootloaderSyslinux * ostree_bootloader_syslinux_new (OstreeSysroot *sysroot);
|
||||
OstreeBootloaderSyslinux * _ostree_bootloader_syslinux_new (OstreeSysroot *sysroot);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -41,12 +41,12 @@ struct _OstreeBootloaderUboot
|
||||
|
||||
typedef GObjectClass OstreeBootloaderUbootClass;
|
||||
|
||||
static void ostree_bootloader_uboot_bootloader_iface_init (OstreeBootloaderInterface *iface);
|
||||
G_DEFINE_TYPE_WITH_CODE (OstreeBootloaderUboot, ostree_bootloader_uboot, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (OSTREE_TYPE_BOOTLOADER, ostree_bootloader_uboot_bootloader_iface_init));
|
||||
static void _ostree_bootloader_uboot_bootloader_iface_init (OstreeBootloaderInterface *iface);
|
||||
G_DEFINE_TYPE_WITH_CODE (OstreeBootloaderUboot, _ostree_bootloader_uboot, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (OSTREE_TYPE_BOOTLOADER, _ostree_bootloader_uboot_bootloader_iface_init));
|
||||
|
||||
static gboolean
|
||||
ostree_bootloader_uboot_query (OstreeBootloader *bootloader)
|
||||
_ostree_bootloader_uboot_query (OstreeBootloader *bootloader)
|
||||
{
|
||||
OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader);
|
||||
|
||||
@ -54,7 +54,7 @@ ostree_bootloader_uboot_query (OstreeBootloader *bootloader)
|
||||
}
|
||||
|
||||
static const char *
|
||||
ostree_bootloader_uboot_get_name (OstreeBootloader *bootloader)
|
||||
_ostree_bootloader_uboot_get_name (OstreeBootloader *bootloader)
|
||||
{
|
||||
return "U-Boot";
|
||||
}
|
||||
@ -98,7 +98,7 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader,
|
||||
_ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader,
|
||||
int bootversion,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@ -139,39 +139,39 @@ ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader,
|
||||
}
|
||||
|
||||
static void
|
||||
ostree_bootloader_uboot_finalize (GObject *object)
|
||||
_ostree_bootloader_uboot_finalize (GObject *object)
|
||||
{
|
||||
OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (object);
|
||||
|
||||
g_clear_object (&self->sysroot);
|
||||
g_clear_object (&self->config_path);
|
||||
|
||||
G_OBJECT_CLASS (ostree_bootloader_uboot_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (_ostree_bootloader_uboot_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
void
|
||||
ostree_bootloader_uboot_init (OstreeBootloaderUboot *self)
|
||||
_ostree_bootloader_uboot_init (OstreeBootloaderUboot *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
ostree_bootloader_uboot_bootloader_iface_init (OstreeBootloaderInterface *iface)
|
||||
_ostree_bootloader_uboot_bootloader_iface_init (OstreeBootloaderInterface *iface)
|
||||
{
|
||||
iface->query = ostree_bootloader_uboot_query;
|
||||
iface->get_name = ostree_bootloader_uboot_get_name;
|
||||
iface->write_config = ostree_bootloader_uboot_write_config;
|
||||
iface->query = _ostree_bootloader_uboot_query;
|
||||
iface->get_name = _ostree_bootloader_uboot_get_name;
|
||||
iface->write_config = _ostree_bootloader_uboot_write_config;
|
||||
}
|
||||
|
||||
void
|
||||
ostree_bootloader_uboot_class_init (OstreeBootloaderUbootClass *class)
|
||||
_ostree_bootloader_uboot_class_init (OstreeBootloaderUbootClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = ostree_bootloader_uboot_finalize;
|
||||
object_class->finalize = _ostree_bootloader_uboot_finalize;
|
||||
}
|
||||
|
||||
OstreeBootloaderUboot *
|
||||
ostree_bootloader_uboot_new (OstreeSysroot *sysroot)
|
||||
_ostree_bootloader_uboot_new (OstreeSysroot *sysroot)
|
||||
{
|
||||
OstreeBootloaderUboot *self = g_object_new (OSTREE_TYPE_BOOTLOADER_UBOOT, NULL);
|
||||
self->sysroot = g_object_ref (sysroot);
|
||||
|
@ -28,14 +28,14 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define OSTREE_TYPE_BOOTLOADER_UBOOT (ostree_bootloader_uboot_get_type ())
|
||||
#define OSTREE_TYPE_BOOTLOADER_UBOOT (_ostree_bootloader_uboot_get_type ())
|
||||
#define OSTREE_BOOTLOADER_UBOOT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OSTREE_TYPE_BOOTLOADER_UBOOT, OstreeBootloaderUboot))
|
||||
#define OSTREE_IS_BOOTLOADER_UBOOT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OSTREE_TYPE_BOOTLOADER_UBOOT))
|
||||
|
||||
typedef struct _OstreeBootloaderUboot OstreeBootloaderUboot;
|
||||
|
||||
GType ostree_bootloader_uboot_get_type (void) G_GNUC_CONST;
|
||||
GType _ostree_bootloader_uboot_get_type (void) G_GNUC_CONST;
|
||||
|
||||
OstreeBootloaderUboot * ostree_bootloader_uboot_new (OstreeSysroot *sysroot);
|
||||
OstreeBootloaderUboot * _ostree_bootloader_uboot_new (OstreeSysroot *sysroot);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -22,15 +22,15 @@
|
||||
#include "ostree-bootloader.h"
|
||||
#include "libgsystem.h"
|
||||
|
||||
G_DEFINE_INTERFACE (OstreeBootloader, ostree_bootloader, G_TYPE_OBJECT)
|
||||
G_DEFINE_INTERFACE (OstreeBootloader, _ostree_bootloader, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
ostree_bootloader_default_init (OstreeBootloaderInterface *iface)
|
||||
_ostree_bootloader_default_init (OstreeBootloaderInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
ostree_bootloader_query (OstreeBootloader *self)
|
||||
_ostree_bootloader_query (OstreeBootloader *self)
|
||||
{
|
||||
g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), FALSE);
|
||||
|
||||
@ -38,12 +38,12 @@ ostree_bootloader_query (OstreeBootloader *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_bootloader_get_name:
|
||||
* _ostree_bootloader_get_name:
|
||||
*
|
||||
* Returns: (transfer none): Name of this bootloader
|
||||
*/
|
||||
const char *
|
||||
ostree_bootloader_get_name (OstreeBootloader *self)
|
||||
_ostree_bootloader_get_name (OstreeBootloader *self)
|
||||
{
|
||||
g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), NULL);
|
||||
|
||||
@ -51,7 +51,7 @@ ostree_bootloader_get_name (OstreeBootloader *self)
|
||||
}
|
||||
|
||||
gboolean
|
||||
ostree_bootloader_write_config (OstreeBootloader *self,
|
||||
_ostree_bootloader_write_config (OstreeBootloader *self,
|
||||
int bootversion,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define OSTREE_TYPE_BOOTLOADER (ostree_bootloader_get_type ())
|
||||
#define OSTREE_TYPE_BOOTLOADER (_ostree_bootloader_get_type ())
|
||||
#define OSTREE_BOOTLOADER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OSTREE_TYPE_BOOTLOADER, OstreeBootloader))
|
||||
#define OSTREE_IS_BOOTLOADER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OSTREE_TYPE_BOOTLOADER))
|
||||
#define OSTREE_BOOTLOADER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), OSTREE_TYPE_BOOTLOADER, OstreeBootloaderInterface))
|
||||
@ -45,16 +45,16 @@ struct _OstreeBootloaderInterface
|
||||
GError **error);
|
||||
};
|
||||
|
||||
GType ostree_bootloader_get_type (void) G_GNUC_CONST;
|
||||
GType _ostree_bootloader_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gboolean ostree_bootloader_query (OstreeBootloader *self);
|
||||
gboolean _ostree_bootloader_query (OstreeBootloader *self);
|
||||
|
||||
const char *ostree_bootloader_get_name (OstreeBootloader *self);
|
||||
const char *_ostree_bootloader_get_name (OstreeBootloader *self);
|
||||
|
||||
gboolean ostree_bootloader_write_config (OstreeBootloader *self,
|
||||
int bootversion,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean _ostree_bootloader_write_config (OstreeBootloader *self,
|
||||
int bootversion,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -992,10 +992,10 @@ ostree_sysroot_write_deployments (OstreeSysroot *sysroot,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
guint i;
|
||||
gs_unref_object OstreeBootloader *bootloader = ostree_sysroot_query_bootloader (sysroot);
|
||||
gs_unref_object OstreeBootloader *bootloader = _ostree_sysroot_query_bootloader (sysroot);
|
||||
|
||||
if (bootloader)
|
||||
g_print ("Detected bootloader: %s\n", ostree_bootloader_get_name (bootloader));
|
||||
g_print ("Detected bootloader: %s\n", _ostree_bootloader_get_name (bootloader));
|
||||
else
|
||||
g_print ("Detected bootloader: (unknown)\n");
|
||||
|
||||
@ -1043,8 +1043,8 @@ ostree_sysroot_write_deployments (OstreeSysroot *sysroot,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (bootloader && !ostree_bootloader_write_config (bootloader, new_bootversion,
|
||||
cancellable, error))
|
||||
if (bootloader && !_ostree_bootloader_write_config (bootloader, new_bootversion,
|
||||
cancellable, error))
|
||||
{
|
||||
g_prefix_error (error, "Bootloader write config: ");
|
||||
goto out;
|
||||
|
@ -60,5 +60,7 @@ OstreeOrderedHash *_ostree_sysroot_parse_kernel_args (const char *options);
|
||||
|
||||
char * _ostree_sysroot_kernel_arg_string_serialize (OstreeOrderedHash *ohash);
|
||||
|
||||
OstreeBootloader *_ostree_sysroot_query_bootloader (OstreeSysroot *sysroot);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -800,17 +800,17 @@ ostree_sysroot_get_repo (OstreeSysroot *self,
|
||||
* Returns: (transfer full): Currently active bootloader in @sysroot
|
||||
*/
|
||||
OstreeBootloader *
|
||||
ostree_sysroot_query_bootloader (OstreeSysroot *self)
|
||||
_ostree_sysroot_query_bootloader (OstreeSysroot *self)
|
||||
{
|
||||
OstreeBootloaderSyslinux *syslinux;
|
||||
OstreeBootloaderUboot *uboot;
|
||||
|
||||
syslinux = ostree_bootloader_syslinux_new (self);
|
||||
if (ostree_bootloader_query ((OstreeBootloader*)syslinux))
|
||||
syslinux = _ostree_bootloader_syslinux_new (self);
|
||||
if (_ostree_bootloader_query ((OstreeBootloader*)syslinux))
|
||||
return (OstreeBootloader*) (syslinux);
|
||||
|
||||
uboot = ostree_bootloader_uboot_new (self);
|
||||
if (ostree_bootloader_query ((OstreeBootloader*)uboot))
|
||||
uboot = _ostree_bootloader_uboot_new (self);
|
||||
if (_ostree_bootloader_query ((OstreeBootloader*)uboot))
|
||||
return (OstreeBootloader*) (uboot);
|
||||
|
||||
return NULL;
|
||||
|
@ -70,8 +70,6 @@ gboolean ostree_sysroot_get_repo (OstreeSysroot *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
OstreeBootloader *ostree_sysroot_query_bootloader (OstreeSysroot *sysroot);
|
||||
|
||||
|
||||
gboolean ostree_sysroot_find_booted_deployment (OstreeSysroot *sysroot,
|
||||
GPtrArray *deployments,
|
||||
|
Loading…
Reference in New Issue
Block a user