[ostree/wip/libsysroot: 2/4] Move Deployment and BootconfigParser into libostree
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree/wip/libsysroot: 2/4] Move Deployment and BootconfigParser into libostree
- Date: Sun, 15 Sep 2013 22:12:05 +0000 (UTC)
commit 35bab87691fc0997e13f40680fbb9afd416ce1b9
Author: Colin Walters <walters verbum org>
Date: Sun Sep 15 15:06:31 2013 -0400
Move Deployment and BootconfigParser into libostree
As part of moving admin functionality there. While we are doing this,
rename OtConfigParser to OstreeBootConfig parser since it's a better
name.
Makefile-libostree.am | 4 +
Makefile-ostree.am | 4 -
.../ostree-bootconfig-parser.c} | 60 ++++----
src/libostree/ostree-bootconfig-parser.h | 56 ++++++
.../ostree-deployment.c} | 92 +++++-----
src/libostree/ostree-deployment.h | 63 +++++++
src/libostree/ostree.h | 2 +
src/ostree/ot-admin-builtin-deploy.c | 4 +-
src/ostree/ot-admin-builtin-diff.c | 4 +-
src/ostree/ot-admin-builtin-status.c | 12 +-
src/ostree/ot-admin-builtin-undeploy.c | 8 +-
src/ostree/ot-admin-builtin-upgrade.c | 12 +-
src/ostree/ot-admin-cleanup.c | 16 +-
src/ostree/ot-admin-deploy.c | 176 ++++++++++----------
src/ostree/ot-admin-deploy.h | 8 +-
src/ostree/ot-admin-functions.c | 74 ++++-----
src/ostree/ot-admin-functions.h | 15 +-
src/ostree/ot-bootloader-syslinux.c | 10 +-
src/ostree/ot-bootloader-uboot.c | 8 +-
src/ostree/ot-config-parser.h | 56 ------
src/ostree/ot-deployment.h | 64 -------
21 files changed, 370 insertions(+), 378 deletions(-)
---
diff --git a/Makefile-libostree.am b/Makefile-libostree.am
index c375527..a24c542 100644
--- a/Makefile-libostree.am
+++ b/Makefile-libostree.am
@@ -45,6 +45,10 @@ libostree_1_la_SOURCES = \
src/libostree/ostree-repo-file-enumerator.h \
src/libostree/ostree-sysroot.c \
src/libostree/ostree-sysroot.h \
+ src/libostree/ostree-bootconfig-parser.h \
+ src/libostree/ostree-bootconfig-parser.c \
+ src/libostree/ostree-deployment.h \
+ src/libostree/ostree-deployment.c \
$(NULL)
if USE_LIBARCHIVE
libostree_1_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \
diff --git a/Makefile-ostree.am b/Makefile-ostree.am
index 19bc85c..3fe1a05 100644
--- a/Makefile-ostree.am
+++ b/Makefile-ostree.am
@@ -71,10 +71,6 @@ ostree_SOURCES += \
src/ostree/ot-bootloader-syslinux.c \
src/ostree/ot-bootloader-uboot.h \
src/ostree/ot-bootloader-uboot.c \
- src/ostree/ot-config-parser.h \
- src/ostree/ot-config-parser.c \
- src/ostree/ot-deployment.h \
- src/ostree/ot-deployment.c \
src/ostree/ot-ordered-hash.h \
src/ostree/ot-ordered-hash.c \
$(NULL)
diff --git a/src/ostree/ot-config-parser.c b/src/libostree/ostree-bootconfig-parser.c
similarity index 75%
rename from src/ostree/ot-config-parser.c
rename to src/libostree/ostree-bootconfig-parser.c
index e87d5b9..e660685 100644
--- a/src/ostree/ot-config-parser.c
+++ b/src/libostree/ostree-bootconfig-parser.c
@@ -20,10 +20,10 @@
#include "config.h"
-#include "ot-config-parser.h"
+#include "ostree-bootconfig-parser.h"
#include "libgsystem.h"
-struct _OtConfigParser
+struct _OstreeBootconfigParser
{
GObject parent_instance;
@@ -34,15 +34,15 @@ struct _OtConfigParser
GPtrArray *lines;
};
-typedef GObjectClass OtConfigParserClass;
+typedef GObjectClass OstreeBootconfigParserClass;
-G_DEFINE_TYPE (OtConfigParser, ot_config_parser, G_TYPE_OBJECT)
+G_DEFINE_TYPE (OstreeBootconfigParser, ostree_bootconfig_parser, G_TYPE_OBJECT)
gboolean
-ot_config_parser_parse (OtConfigParser *self,
- GFile *path,
- GCancellable *cancellable,
- GError **error)
+ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
+ GFile *path,
+ GCancellable *cancellable,
+ GError **error)
{
gboolean ret = FALSE;
gs_free char *contents = NULL;
@@ -88,22 +88,22 @@ ot_config_parser_parse (OtConfigParser *self,
}
void
-ot_config_parser_set (OtConfigParser *self,
- const char *key,
- const char *value)
+ostree_bootconfig_parser_set (OstreeBootconfigParser *self,
+ const char *key,
+ const char *value)
{
g_hash_table_replace (self->options, g_strdup (key), g_strdup (value));
}
const char *
-ot_config_parser_get (OtConfigParser *self,
- const char *key)
+ostree_bootconfig_parser_get (OstreeBootconfigParser *self,
+ const char *key)
{
return g_hash_table_lookup (self->options, key);
}
static gboolean
-write_key (OtConfigParser *self,
+write_key (OstreeBootconfigParser *self,
GDataOutputStream *out,
const char *key,
const char *value,
@@ -127,10 +127,10 @@ write_key (OtConfigParser *self,
}
gboolean
-ot_config_parser_write (OtConfigParser *self,
- GFile *output,
- GCancellable *cancellable,
- GError **error)
+ostree_bootconfig_parser_write (OstreeBootconfigParser *self,
+ GFile *output,
+ GCancellable *cancellable,
+ GError **error)
{
gboolean ret = FALSE;
GHashTableIter hashiter;
@@ -191,40 +191,38 @@ ot_config_parser_write (OtConfigParser *self,
}
static void
-ot_config_parser_finalize (GObject *object)
+ostree_bootconfig_parser_finalize (GObject *object)
{
- OtConfigParser *self = OT_CONFIG_PARSER (object);
+ OstreeBootconfigParser *self = OSTREE_BOOTCONFIG_PARSER (object);
g_hash_table_unref (self->options);
g_ptr_array_unref (self->lines);
g_free (self->separators);
- G_OBJECT_CLASS (ot_config_parser_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ostree_bootconfig_parser_parent_class)->finalize (object);
}
static void
-ot_config_parser_init (OtConfigParser *self)
+ostree_bootconfig_parser_init (OstreeBootconfigParser *self)
{
self->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
self->lines = g_ptr_array_new ();
}
void
-ot_config_parser_class_init (OtConfigParserClass *class)
+ostree_bootconfig_parser_class_init (OstreeBootconfigParserClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = ot_config_parser_finalize;
+ object_class->finalize = ostree_bootconfig_parser_finalize;
}
-OtConfigParser *
-ot_config_parser_new (const char *separators)
+OstreeBootconfigParser *
+ostree_bootconfig_parser_new (void)
{
- OtConfigParser *self = NULL;
+ OstreeBootconfigParser *self = NULL;
- g_return_val_if_fail (separators != NULL && separators[0], NULL);
-
- self = g_object_new (OT_TYPE_CONFIG_PARSER, NULL);
- self->separators = g_strdup (separators);
+ self = g_object_new (OSTREE_TYPE_BOOTCONFIG_PARSER, NULL);
+ self->separators = g_strdup (" \t");
return self;
}
diff --git a/src/libostree/ostree-bootconfig-parser.h b/src/libostree/ostree-bootconfig-parser.h
new file mode 100644
index 0000000..0761016
--- /dev/null
+++ b/src/libostree/ostree-bootconfig-parser.h
@@ -0,0 +1,56 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum org>
+ *
+ * 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
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define OSTREE_TYPE_BOOTCONFIG_PARSER (ostree_bootconfig_parser_get_type ())
+#define OSTREE_BOOTCONFIG_PARSER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OSTREE_TYPE_BOOTCONFIG_PARSER,
OstreeBootconfigParser))
+#define OSTREE_IS_BOOTCONFIG_PARSER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst),
OSTREE_TYPE_BOOTCONFIG_PARSER))
+
+typedef struct _OstreeBootconfigParser OstreeBootconfigParser;
+
+GType ostree_bootconfig_parser_get_type (void) G_GNUC_CONST;
+
+OstreeBootconfigParser * ostree_bootconfig_parser_new (void);
+
+gboolean ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
+ GFile *path,
+ GCancellable *cancellable,
+ GError **error);
+
+gboolean ostree_bootconfig_parser_write (OstreeBootconfigParser *self,
+ GFile *output,
+ GCancellable *cancellable,
+ GError **error);
+
+void ostree_bootconfig_parser_set (OstreeBootconfigParser *self,
+ const char *key,
+ const char *value);
+
+const char *ostree_bootconfig_parser_get (OstreeBootconfigParser *self,
+ const char *key);
+
+
+G_END_DECLS
+
diff --git a/src/ostree/ot-deployment.c b/src/libostree/ostree-deployment.c
similarity index 56%
rename from src/ostree/ot-deployment.c
rename to src/libostree/ostree-deployment.c
index 4956961..0a64641 100644
--- a/src/ostree/ot-deployment.c
+++ b/src/libostree/ostree-deployment.c
@@ -20,10 +20,10 @@
#include "config.h"
-#include "ot-deployment.h"
+#include "ostree-deployment.h"
#include "libgsystem.h"
-struct _OtDeployment
+struct _OstreeDeployment
{
GObject parent_instance;
@@ -33,76 +33,76 @@ struct _OtDeployment
int deployserial; /* How many times this particular csum appears in deployment list */
char *bootcsum; /* Checksum of kernel+initramfs */
int bootserial; /* An integer assigned to this tree per its ${bootcsum} */
- OtConfigParser *bootconfig; /* Bootloader configuration */
+ OstreeBootconfigParser *bootconfig; /* Bootloader configuration */
GKeyFile *origin; /* How to construct an upgraded version of this tree */
};
-typedef GObjectClass OtDeploymentClass;
+typedef GObjectClass OstreeDeploymentClass;
-G_DEFINE_TYPE (OtDeployment, ot_deployment, G_TYPE_OBJECT)
+G_DEFINE_TYPE (OstreeDeployment, ostree_deployment, G_TYPE_OBJECT)
const char *
-ot_deployment_get_csum (OtDeployment *self)
+ostree_deployment_get_csum (OstreeDeployment *self)
{
return self->csum;
}
const char *
-ot_deployment_get_bootcsum (OtDeployment *self)
+ostree_deployment_get_bootcsum (OstreeDeployment *self)
{
return self->bootcsum;
}
const char *
-ot_deployment_get_osname (OtDeployment *self)
+ostree_deployment_get_osname (OstreeDeployment *self)
{
return self->osname;
}
int
-ot_deployment_get_deployserial (OtDeployment *self)
+ostree_deployment_get_deployserial (OstreeDeployment *self)
{
return self->deployserial;
}
int
-ot_deployment_get_bootserial (OtDeployment *self)
+ostree_deployment_get_bootserial (OstreeDeployment *self)
{
return self->bootserial;
}
-OtConfigParser *
-ot_deployment_get_bootconfig (OtDeployment *self)
+OstreeBootconfigParser *
+ostree_deployment_get_bootconfig (OstreeDeployment *self)
{
return self->bootconfig;
}
GKeyFile *
-ot_deployment_get_origin (OtDeployment *self)
+ostree_deployment_get_origin (OstreeDeployment *self)
{
return self->origin;
}
int
-ot_deployment_get_index (OtDeployment *self)
+ostree_deployment_get_index (OstreeDeployment *self)
{
return self->index;
}
void
-ot_deployment_set_index (OtDeployment *self, int index)
+ostree_deployment_set_index (OstreeDeployment *self, int index)
{
self->index = index;
}
void
-ot_deployment_set_bootserial (OtDeployment *self, int index)
+ostree_deployment_set_bootserial (OstreeDeployment *self, int index)
{
self->bootserial = index;
}
void
-ot_deployment_set_bootconfig (OtDeployment *self, OtConfigParser *bootconfig)
+ostree_deployment_set_bootconfig (OstreeDeployment *self, OstreeBootconfigParser *bootconfig)
{
g_clear_object (&self->bootconfig);
if (bootconfig)
@@ -110,55 +110,55 @@ ot_deployment_set_bootconfig (OtDeployment *self, OtConfigParser *bootconfig)
}
void
-ot_deployment_set_origin (OtDeployment *self, GKeyFile *origin)
+ostree_deployment_set_origin (OstreeDeployment *self, GKeyFile *origin)
{
g_clear_pointer (&self->origin, g_key_file_unref);
if (origin)
self->origin = g_key_file_ref (origin);
}
-OtDeployment *
-ot_deployment_clone (OtDeployment *self)
+OstreeDeployment *
+ostree_deployment_clone (OstreeDeployment *self)
{
- OtDeployment *ret = ot_deployment_new (self->index, self->osname, self->csum,
+ OstreeDeployment *ret = ostree_deployment_new (self->index, self->osname, self->csum,
self->deployserial,
self->bootcsum, self->bootserial);
- ot_deployment_set_bootconfig (ret, self->bootconfig);
- ot_deployment_set_origin (ret, self->origin);
+ ostree_deployment_set_bootconfig (ret, self->bootconfig);
+ ostree_deployment_set_origin (ret, self->origin);
return ret;
}
guint
-ot_deployment_hash (gconstpointer v)
+ostree_deployment_hash (gconstpointer v)
{
- OtDeployment *d = (OtDeployment*)v;
- return g_str_hash (ot_deployment_get_osname (d)) +
- g_str_hash (ot_deployment_get_csum (d)) +
- ot_deployment_get_deployserial (d);
+ OstreeDeployment *d = (OstreeDeployment*)v;
+ return g_str_hash (ostree_deployment_get_osname (d)) +
+ g_str_hash (ostree_deployment_get_csum (d)) +
+ ostree_deployment_get_deployserial (d);
}
gboolean
-ot_deployment_equal (gconstpointer ap, gconstpointer bp)
+ostree_deployment_equal (gconstpointer ap, gconstpointer bp)
{
- OtDeployment *a = (OtDeployment*)ap;
- OtDeployment *b = (OtDeployment*)bp;
+ OstreeDeployment *a = (OstreeDeployment*)ap;
+ OstreeDeployment *b = (OstreeDeployment*)bp;
if (a == NULL && b == NULL)
return TRUE;
else if (a != NULL && b != NULL)
- return g_str_equal (ot_deployment_get_osname (a),
- ot_deployment_get_osname (b)) &&
- g_str_equal (ot_deployment_get_csum (a),
- ot_deployment_get_csum (b)) &&
- ot_deployment_get_deployserial (a) == ot_deployment_get_deployserial (b);
+ return g_str_equal (ostree_deployment_get_osname (a),
+ ostree_deployment_get_osname (b)) &&
+ g_str_equal (ostree_deployment_get_csum (a),
+ ostree_deployment_get_csum (b)) &&
+ ostree_deployment_get_deployserial (a) == ostree_deployment_get_deployserial (b);
else
return FALSE;
}
static void
-ot_deployment_finalize (GObject *object)
+ostree_deployment_finalize (GObject *object)
{
- OtDeployment *self = OT_DEPLOYMENT (object);
+ OstreeDeployment *self = OSTREE_DEPLOYMENT (object);
g_free (self->osname);
g_free (self->csum);
@@ -166,31 +166,31 @@ ot_deployment_finalize (GObject *object)
g_clear_object (&self->bootconfig);
g_clear_pointer (&self->origin, g_key_file_unref);
- G_OBJECT_CLASS (ot_deployment_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ostree_deployment_parent_class)->finalize (object);
}
void
-ot_deployment_init (OtDeployment *self)
+ostree_deployment_init (OstreeDeployment *self)
{
}
void
-ot_deployment_class_init (OtDeploymentClass *class)
+ostree_deployment_class_init (OstreeDeploymentClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = ot_deployment_finalize;
+ object_class->finalize = ostree_deployment_finalize;
}
-OtDeployment *
-ot_deployment_new (int index,
+OstreeDeployment *
+ostree_deployment_new (int index,
const char *osname,
const char *csum,
int deployserial,
const char *bootcsum,
int bootserial)
{
- OtDeployment *self;
+ OstreeDeployment *self;
/* index may be -1 */
g_return_val_if_fail (osname != NULL, NULL);
@@ -199,7 +199,7 @@ ot_deployment_new (int index,
/* We can have "disconnected" deployments that don't have a
bootcsum/serial */
- self = g_object_new (OT_TYPE_DEPLOYMENT, NULL);
+ self = g_object_new (OSTREE_TYPE_DEPLOYMENT, NULL);
self->index = index;
self->osname = g_strdup (osname);
self->csum = g_strdup (csum);
diff --git a/src/libostree/ostree-deployment.h b/src/libostree/ostree-deployment.h
new file mode 100644
index 0000000..a96a00a
--- /dev/null
+++ b/src/libostree/ostree-deployment.h
@@ -0,0 +1,63 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters verbum org>
+ *
+ * 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
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "ostree-bootconfig-parser.h"
+
+G_BEGIN_DECLS
+
+#define OSTREE_TYPE_DEPLOYMENT (ostree_deployment_get_type ())
+#define OSTREE_DEPLOYMENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OSTREE_TYPE_DEPLOYMENT,
OstreeDeployment))
+#define OSTREE_IS_DEPLOYMENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OSTREE_TYPE_DEPLOYMENT))
+
+typedef struct _OstreeDeployment OstreeDeployment;
+
+GType ostree_deployment_get_type (void) G_GNUC_CONST;
+
+guint ostree_deployment_hash (gconstpointer v);
+gboolean ostree_deployment_equal (gconstpointer a, gconstpointer b);
+
+OstreeDeployment * ostree_deployment_new (int index,
+ const char *osname,
+ const char *csum,
+ int deployserial,
+ const char *bootcsum,
+ int bootserial);
+
+int ostree_deployment_get_index (OstreeDeployment *self);
+const char *ostree_deployment_get_osname (OstreeDeployment *self);
+int ostree_deployment_get_deployserial (OstreeDeployment *self);
+const char *ostree_deployment_get_csum (OstreeDeployment *self);
+const char *ostree_deployment_get_bootcsum (OstreeDeployment *self);
+int ostree_deployment_get_bootserial (OstreeDeployment *self);
+OstreeBootconfigParser *ostree_deployment_get_bootconfig (OstreeDeployment *self);
+GKeyFile *ostree_deployment_get_origin (OstreeDeployment *self);
+
+void ostree_deployment_set_index (OstreeDeployment *self, int index);
+void ostree_deployment_set_bootserial (OstreeDeployment *self, int index);
+void ostree_deployment_set_bootconfig (OstreeDeployment *self, OstreeBootconfigParser *bootconfig);
+void ostree_deployment_set_origin (OstreeDeployment *self, GKeyFile *origin);
+
+OstreeDeployment *ostree_deployment_clone (OstreeDeployment *self);
+
+
+G_END_DECLS
+
diff --git a/src/libostree/ostree.h b/src/libostree/ostree.h
index aaaeb1b..730b616 100644
--- a/src/libostree/ostree.h
+++ b/src/libostree/ostree.h
@@ -27,4 +27,6 @@
#include <ostree-mutable-tree.h>
#include <ostree-repo-file.h>
#include <ostree-sysroot.h>
+#include <ostree-deployment.h>
+#include <ostree-bootconfig-parser.h>
#include <ostree-diff.h>
diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c
index 7f49e4f..66b868e 100644
--- a/src/ostree/ot-admin-builtin-deploy.c
+++ b/src/ostree/ot-admin-builtin-deploy.c
@@ -58,8 +58,8 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeSysroot *sysroot, GCancell
gs_unref_object OstreeRepo *repo = NULL;
gs_unref_ptrarray GPtrArray *current_deployments = NULL;
gs_unref_ptrarray GPtrArray *new_deployments = NULL;
- gs_unref_object OtDeployment *new_deployment = NULL;
- gs_unref_object OtDeployment *booted_deployment = NULL;
+ gs_unref_object OstreeDeployment *new_deployment = NULL;
+ gs_unref_object OstreeDeployment *booted_deployment = NULL;
gs_free char *revision = NULL;
context = g_option_context_new ("REFSPEC - Checkout revision REFSPEC as the new default deployment");
diff --git a/src/ostree/ot-admin-builtin-diff.c b/src/ostree/ot-admin-builtin-diff.c
index e64fe7e..c3f0e84 100644
--- a/src/ostree/ot-admin-builtin-diff.c
+++ b/src/ostree/ot-admin-builtin-diff.c
@@ -42,7 +42,7 @@ ot_admin_builtin_diff (int argc, char **argv, OstreeSysroot *sysroot, GCancellab
GOptionContext *context;
gboolean ret = FALSE;
gs_unref_object GFile *repo_path = NULL;
- gs_unref_object OtDeployment *deployment = NULL;
+ gs_unref_object OstreeDeployment *deployment = NULL;
gs_unref_object GFile *deployment_dir = NULL;
gs_unref_ptrarray GPtrArray *modified = NULL;
gs_unref_ptrarray GPtrArray *removed = NULL;
@@ -73,7 +73,7 @@ ot_admin_builtin_diff (int argc, char **argv, OstreeSysroot *sysroot, GCancellab
cancellable, error))
goto out;
if (deployment != NULL)
- opt_osname = (char*)ot_deployment_get_osname (deployment);
+ opt_osname = (char*)ostree_deployment_get_osname (deployment);
if (deployment == NULL)
deployment = ot_admin_get_merge_deployment (deployments, opt_osname, deployment);
if (deployment == NULL)
diff --git a/src/ostree/ot-admin-builtin-status.c b/src/ostree/ot-admin-builtin-status.c
index f29fd8b..6de2d2d 100644
--- a/src/ostree/ot-admin-builtin-status.c
+++ b/src/ostree/ot-admin-builtin-status.c
@@ -39,7 +39,7 @@ ot_admin_builtin_status (int argc, char **argv, OstreeSysroot *sysroot, GCancell
GOptionContext *context;
gboolean ret = FALSE;
int bootversion;
- gs_unref_object OtDeployment *booted_deployment = NULL;
+ gs_unref_object OstreeDeployment *booted_deployment = NULL;
gs_unref_ptrarray GPtrArray *deployments = NULL;
guint i;
@@ -77,15 +77,15 @@ ot_admin_builtin_status (int argc, char **argv, OstreeSysroot *sysroot, GCancell
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
GKeyFile *origin;
g_print ("%c %s %s.%d\n",
deployment == booted_deployment ? '*' : ' ',
- ot_deployment_get_osname (deployment),
- ot_deployment_get_csum (deployment),
- ot_deployment_get_deployserial (deployment));
- origin = ot_deployment_get_origin (deployment);
+ ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_deployserial (deployment));
+ origin = ostree_deployment_get_origin (deployment);
if (!origin)
g_print (" origin: none\n");
else
diff --git a/src/ostree/ot-admin-builtin-undeploy.c b/src/ostree/ot-admin-builtin-undeploy.c
index 5a6a279..c4427b3 100644
--- a/src/ostree/ot-admin-builtin-undeploy.c
+++ b/src/ostree/ot-admin-builtin-undeploy.c
@@ -42,8 +42,8 @@ ot_admin_builtin_undeploy (int argc, char **argv, OstreeSysroot *sysroot, GCance
int deploy_index;
int current_bootversion;
gs_unref_ptrarray GPtrArray *current_deployments = NULL;
- gs_unref_object OtDeployment *booted_deployment = NULL;
- gs_unref_object OtDeployment *target_deployment = NULL;
+ gs_unref_object OstreeDeployment *booted_deployment = NULL;
+ gs_unref_object OstreeDeployment *target_deployment = NULL;
context = g_option_context_new ("INDEX - Delete deployment INDEX");
@@ -100,8 +100,8 @@ ot_admin_builtin_undeploy (int argc, char **argv, OstreeSysroot *sysroot, GCance
cancellable, error))
goto out;
- g_print ("Deleted deployment %s.%d\n", ot_deployment_get_csum (target_deployment),
- ot_deployment_get_deployserial (target_deployment));
+ g_print ("Deleted deployment %s.%d\n", ostree_deployment_get_csum (target_deployment),
+ ostree_deployment_get_deployserial (target_deployment));
if (!ot_admin_cleanup (ostree_sysroot_get_path (sysroot), cancellable, error))
{
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
index 269bcdd..215f403 100644
--- a/src/ostree/ot-admin-builtin-upgrade.c
+++ b/src/ostree/ot-admin-builtin-upgrade.c
@@ -55,11 +55,11 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
gs_free char *new_revision = NULL;
gs_unref_object GFile *deployment_path = NULL;
gs_unref_object GFile *deployment_origin_path = NULL;
- gs_unref_object OtDeployment *booted_deployment = NULL;
- gs_unref_object OtDeployment *merge_deployment = NULL;
+ gs_unref_object OstreeDeployment *booted_deployment = NULL;
+ gs_unref_object OstreeDeployment *merge_deployment = NULL;
gs_unref_ptrarray GPtrArray *current_deployments = NULL;
gs_unref_ptrarray GPtrArray *new_deployments = NULL;
- gs_unref_object OtDeployment *new_deployment = NULL;
+ gs_unref_object OstreeDeployment *new_deployment = NULL;
int current_bootversion;
int new_bootversion;
GKeyFile *origin;
@@ -84,7 +84,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
cancellable, error))
goto out;
if (!opt_osname)
- opt_osname = (char*)ot_deployment_get_osname (booted_deployment);
+ opt_osname = (char*)ostree_deployment_get_osname (booted_deployment);
merge_deployment = ot_admin_get_merge_deployment (current_deployments, opt_osname,
booted_deployment);
@@ -96,7 +96,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
if (!ostree_repo_open (repo, cancellable, error))
goto out;
- origin = ot_deployment_get_origin (merge_deployment);
+ origin = ostree_deployment_get_origin (merge_deployment);
if (!origin)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@@ -128,7 +128,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
error))
goto out;
- if (strcmp (ot_deployment_get_csum (merge_deployment), new_revision) == 0)
+ if (strcmp (ostree_deployment_get_csum (merge_deployment), new_revision) == 0)
{
g_print ("Refspec %s is unchanged\n", origin_refspec);
}
diff --git a/src/ostree/ot-admin-cleanup.c b/src/ostree/ot-admin-cleanup.c
index c4066b3..216cd6e 100644
--- a/src/ostree/ot-admin-cleanup.c
+++ b/src/ostree/ot-admin-cleanup.c
@@ -23,8 +23,6 @@
#include "config.h"
#include "ot-admin-functions.h"
-#include "ot-deployment.h"
-#include "ot-config-parser.h"
#include "otutil.h"
#include "ostree.h"
#include "libgsystem.h"
@@ -65,7 +63,7 @@ list_deployment_dirs_for_os (GFile *osdir,
const char *name;
GFileInfo *file_info = NULL;
GFile *child = NULL;
- gs_unref_object OtDeployment *deployment = NULL;
+ gs_unref_object OstreeDeployment *deployment = NULL;
gs_free char *csum = NULL;
gint deployserial;
@@ -83,7 +81,7 @@ list_deployment_dirs_for_os (GFile *osdir,
if (!ot_admin_parse_deploy_path_name (name, &csum, &deployserial, error))
goto out;
- deployment = ot_deployment_new (-1, osname, csum, deployserial, NULL, -1);
+ deployment = ostree_deployment_new (-1, osname, csum, deployserial, NULL, -1);
g_ptr_array_add (inout_deployments, g_object_ref (deployment));
}
@@ -315,9 +313,9 @@ cleanup_old_deployments (GFile *sysroot,
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
GFile *deployment_path = ot_admin_get_deployment_directory (sysroot, deployment);
- char *bootcsum = g_strdup (ot_deployment_get_bootcsum (deployment));
+ char *bootcsum = g_strdup (ostree_deployment_get_bootcsum (deployment));
/* Transfer ownership */
g_hash_table_insert (active_deployment_dirs, deployment_path, deployment_path);
g_hash_table_insert (active_boot_checksums, bootcsum, bootcsum);
@@ -329,7 +327,7 @@ cleanup_old_deployments (GFile *sysroot,
for (i = 0; i < all_deployment_dirs->len; i++)
{
- OtDeployment *deployment = all_deployment_dirs->pdata[i];
+ OstreeDeployment *deployment = all_deployment_dirs->pdata[i];
gs_unref_object GFile *deployment_path = ot_admin_get_deployment_directory (sysroot, deployment);
gs_unref_object GFile *origin_path = ot_admin_get_deployment_origin_path (deployment_path);
if (!g_hash_table_lookup (active_deployment_dirs, deployment_path))
@@ -453,7 +451,7 @@ generate_deployment_refs_and_prune (GFile *sysroot,
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
gs_free char *refname = g_strdup_printf ("ostree/%d/%d/%u",
bootversion, subbootversion,
i);
@@ -461,7 +459,7 @@ generate_deployment_refs_and_prune (GFile *sysroot,
if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
goto out;
- ostree_repo_transaction_set_refspec (repo, refname, ot_deployment_get_csum (deployment));
+ ostree_repo_transaction_set_refspec (repo, refname, ostree_deployment_get_csum (deployment));
if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
goto out;
diff --git a/src/ostree/ot-admin-deploy.c b/src/ostree/ot-admin-deploy.c
index c2a171d..c5cc588 100644
--- a/src/ostree/ot-admin-deploy.c
+++ b/src/ostree/ot-admin-deploy.c
@@ -24,8 +24,6 @@
#include "ot-admin-functions.h"
#include "ot-admin-deploy.h"
-#include "ot-deployment.h"
-#include "ot-config-parser.h"
#include "ot-bootloader-syslinux.h"
#include "otutil.h"
#include "ostree-core.h"
@@ -202,13 +200,13 @@ merge_etc_changes (GFile *orig_etc,
static gboolean
checkout_deployment_tree (GFile *sysroot,
OstreeRepo *repo,
- OtDeployment *deployment,
+ OstreeDeployment *deployment,
GFile **out_deployment_path,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- const char *csum = ot_deployment_get_csum (deployment);
+ const char *csum = ostree_deployment_get_csum (deployment);
gs_unref_object GFile *root = NULL;
gs_unref_object GFileInfo *file_info = NULL;
gs_free char *checkout_target_name = NULL;
@@ -226,9 +224,9 @@ checkout_deployment_tree (GFile *sysroot,
goto out;
osdeploy_path = ot_gfile_get_child_build_path (sysroot, "ostree", "deploy",
- ot_deployment_get_osname (deployment),
+ ostree_deployment_get_osname (deployment),
"deploy", NULL);
- checkout_target_name = g_strdup_printf ("%s.%d", csum, ot_deployment_get_deployserial (deployment));
+ checkout_target_name = g_strdup_printf ("%s.%d", csum, ostree_deployment_get_deployserial (deployment));
deploy_target_path = g_file_get_child (osdeploy_path, checkout_target_name);
deploy_parent = g_file_get_parent (deploy_target_path);
@@ -250,8 +248,8 @@ checkout_deployment_tree (GFile *sysroot,
static gboolean
merge_configuration (GFile *sysroot,
- OtDeployment *previous_deployment,
- OtDeployment *deployment,
+ OstreeDeployment *previous_deployment,
+ OstreeDeployment *deployment,
GFile *deployment_path,
GCancellable *cancellable,
GError **error)
@@ -267,20 +265,20 @@ merge_configuration (GFile *sysroot,
if (previous_deployment)
{
gs_unref_object GFile *previous_path = NULL;
- OtConfigParser *previous_bootconfig;
+ OstreeBootconfigParser *previous_bootconfig;
previous_path = ot_admin_get_deployment_directory (sysroot, previous_deployment);
source_etc_path = g_file_resolve_relative_path (previous_path, "etc");
source_etc_pristine_path = g_file_resolve_relative_path (previous_path, "usr/etc");
- previous_bootconfig = ot_deployment_get_bootconfig (previous_deployment);
+ previous_bootconfig = ostree_deployment_get_bootconfig (previous_deployment);
if (previous_bootconfig)
{
- const char *previous_options = ot_config_parser_get (previous_bootconfig, "options");
+ const char *previous_options = ostree_bootconfig_parser_get (previous_bootconfig, "options");
/* Completely overwrite the previous options here; we will extend
* them later.
*/
- ot_config_parser_set (ot_deployment_get_bootconfig (deployment), "options",
+ ostree_bootconfig_parser_set (ostree_deployment_get_bootconfig (deployment), "options",
previous_options);
}
}
@@ -334,12 +332,12 @@ merge_configuration (GFile *sysroot,
static gboolean
write_origin_file (GFile *sysroot,
- OtDeployment *deployment,
+ OstreeDeployment *deployment,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- GKeyFile *origin = ot_deployment_get_origin (deployment);
+ GKeyFile *origin = ostree_deployment_get_origin (deployment);
if (origin)
{
@@ -468,14 +466,14 @@ checksum_from_kernel_src (GFile *src,
static int
sort_by_bootserial (gconstpointer ap, gconstpointer bp)
{
- OtDeployment **a_loc = (OtDeployment**)ap;
- OtDeployment *a = *a_loc;
- OtDeployment **b_loc = (OtDeployment**)bp;
- OtDeployment *b = *b_loc;
+ OstreeDeployment **a_loc = (OstreeDeployment**)ap;
+ OstreeDeployment *a = *a_loc;
+ OstreeDeployment **b_loc = (OstreeDeployment**)bp;
+ OstreeDeployment *b = *b_loc;
- if (ot_deployment_get_bootserial (a) == ot_deployment_get_bootserial (b))
+ if (ostree_deployment_get_bootserial (a) == ostree_deployment_get_bootserial (b))
return 0;
- else if (ot_deployment_get_bootserial (a) < ot_deployment_get_bootserial (b))
+ else if (ostree_deployment_get_bootserial (a) < ostree_deployment_get_bootserial (b))
return -1;
return 1;
}
@@ -490,11 +488,11 @@ filter_deployments_by_bootcsum (GPtrArray *deployments,
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
- if (strcmp (ot_deployment_get_osname (deployment), osname) != 0)
+ if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
- if (strcmp (ot_deployment_get_bootcsum (deployment), bootcsum) != 0)
+ if (strcmp (ostree_deployment_get_bootcsum (deployment), bootcsum) != 0)
continue;
g_ptr_array_add (ret, deployment);
@@ -508,8 +506,8 @@ static void
compute_new_deployment_list (int current_bootversion,
GPtrArray *current_deployments,
const char *osname,
- OtDeployment *booted_deployment,
- OtDeployment *merge_deployment,
+ OstreeDeployment *booted_deployment,
+ OstreeDeployment *merge_deployment,
gboolean retain,
const char *revision,
const char *bootcsum,
@@ -520,28 +518,28 @@ compute_new_deployment_list (int current_bootversion,
int new_index;
guint new_deployserial = 0;
int new_bootserial = 0;
- gs_unref_object OtDeployment *new_deployment = NULL;
+ gs_unref_object OstreeDeployment *new_deployment = NULL;
gs_unref_ptrarray GPtrArray *matching_deployments_by_bootserial = NULL;
- OtDeployment *deployment_to_delete = NULL;
+ OstreeDeployment *deployment_to_delete = NULL;
gs_unref_ptrarray GPtrArray *ret_new_deployments = NULL;
gboolean requires_new_bootversion;
if (osname == NULL)
- osname = ot_deployment_get_osname (booted_deployment);
+ osname = ostree_deployment_get_osname (booted_deployment);
/* First, compute the serial for this deployment; we look
* for other ones in this os with the same checksum.
*/
for (i = 0; i < current_deployments->len; i++)
{
- OtDeployment *deployment = current_deployments->pdata[i];
+ OstreeDeployment *deployment = current_deployments->pdata[i];
- if (strcmp (ot_deployment_get_osname (deployment), osname) != 0)
+ if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
- if (strcmp (ot_deployment_get_csum (deployment), revision) != 0)
+ if (strcmp (ostree_deployment_get_csum (deployment), revision) != 0)
continue;
- new_deployserial = MAX(new_deployserial, ot_deployment_get_deployserial (deployment)+1);
+ new_deployserial = MAX(new_deployserial, ostree_deployment_get_deployserial (deployment)+1);
}
/* We retain by default (well, hardcoded now) one previous
@@ -558,14 +556,14 @@ compute_new_deployment_list (int current_bootversion,
{
for (i = 0; i < current_deployments->len; i++)
{
- OtDeployment *deployment = current_deployments->pdata[i];
+ OstreeDeployment *deployment = current_deployments->pdata[i];
- if (strcmp (ot_deployment_get_osname (deployment), osname) != 0)
+ if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
// Keep both the booted and merge deployments
- if (ot_deployment_equal (deployment, booted_deployment) ||
- ot_deployment_equal (deployment, merge_deployment))
+ if (ostree_deployment_equal (deployment, booted_deployment) ||
+ ostree_deployment_equal (deployment, merge_deployment))
continue;
deployment_to_delete = deployment;
@@ -577,24 +575,24 @@ compute_new_deployment_list (int current_bootversion,
*/
requires_new_bootversion =
(deployment_to_delete == NULL) ||
- (strcmp (ot_deployment_get_bootcsum (deployment_to_delete), bootcsum) != 0);
+ (strcmp (ostree_deployment_get_bootcsum (deployment_to_delete), bootcsum) != 0);
ret_new_deployments = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
- new_deployment = ot_deployment_new (0, osname, revision, new_deployserial,
+ new_deployment = ostree_deployment_new (0, osname, revision, new_deployserial,
bootcsum, new_bootserial);
g_ptr_array_add (ret_new_deployments, g_object_ref (new_deployment));
new_index = 1;
for (i = 0; i < current_deployments->len; i++)
{
- OtDeployment *orig_deployment = current_deployments->pdata[i];
- gs_unref_object OtDeployment *deployment_clone = NULL;
+ OstreeDeployment *orig_deployment = current_deployments->pdata[i];
+ gs_unref_object OstreeDeployment *deployment_clone = NULL;
if (orig_deployment == deployment_to_delete)
continue;
- deployment_clone = ot_deployment_clone (orig_deployment);
- ot_deployment_set_index (deployment_clone, new_index);
+ deployment_clone = ostree_deployment_clone (orig_deployment);
+ ostree_deployment_set_index (deployment_clone, new_index);
new_index++;
g_ptr_array_add (ret_new_deployments, g_object_ref (deployment_clone));
}
@@ -606,8 +604,8 @@ compute_new_deployment_list (int current_bootversion,
osname, bootcsum);
for (i = 0; i < matching_deployments_by_bootserial->len; i++)
{
- OtDeployment *deployment = matching_deployments_by_bootserial->pdata[i];
- ot_deployment_set_bootserial (deployment, i);
+ OstreeDeployment *deployment = matching_deployments_by_bootserial->pdata[i];
+ ostree_deployment_set_bootserial (deployment, i);
}
*out_new_deployments = ret_new_deployments;
@@ -671,15 +669,15 @@ print_deployment_set (gboolean for_removal,
g_hash_table_iter_init (&hashiter, set);
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{
- OtDeployment *deployment = hashkey;
+ OstreeDeployment *deployment = hashkey;
g_print (" %c %s %s.%d",
- for_removal ? '-' : '+', ot_deployment_get_osname (deployment),
- ot_deployment_get_csum (deployment),
- ot_deployment_get_deployserial (deployment));
+ for_removal ? '-' : '+', ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_deployserial (deployment));
if (!for_removal)
- g_print (" index=%d", ot_deployment_get_index (deployment));
+ g_print (" index=%d", ostree_deployment_get_index (deployment));
g_print ("\n");
}
}
@@ -688,8 +686,8 @@ static void
print_deployment_diff (GPtrArray *current_deployments,
GPtrArray *new_deployments)
{
- gs_unref_hashtable GHashTable *curset = object_array_to_set (current_deployments, ot_deployment_hash,
ot_deployment_equal);
- gs_unref_hashtable GHashTable *newset = object_array_to_set (new_deployments, ot_deployment_hash,
ot_deployment_equal);
+ gs_unref_hashtable GHashTable *curset = object_array_to_set (current_deployments, ostree_deployment_hash,
ostree_deployment_equal);
+ gs_unref_hashtable GHashTable *newset = object_array_to_set (new_deployments, ostree_deployment_hash,
ostree_deployment_equal);
gs_unref_hashtable GHashTable *removed = NULL;
gs_unref_hashtable GHashTable *added = NULL;
@@ -743,15 +741,15 @@ swap_bootlinks (GFile *sysroot,
for (i = 0; i < new_deployments->len; i++)
{
- OtDeployment *deployment = new_deployments->pdata[i];
+ OstreeDeployment *deployment = new_deployments->pdata[i];
gs_free char *bootlink_pathname = g_strdup_printf ("%s/%s/%d",
- ot_deployment_get_osname (deployment),
- ot_deployment_get_bootcsum (deployment),
- ot_deployment_get_bootserial (deployment));
+ ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_bootcsum (deployment),
+ ostree_deployment_get_bootserial (deployment));
gs_free char *bootlink_target = g_strdup_printf ("../../../deploy/%s/deploy/%s.%d",
- ot_deployment_get_osname (deployment),
- ot_deployment_get_csum (deployment),
- ot_deployment_get_deployserial (deployment));
+ ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_deployserial (deployment));
gs_unref_object GFile *linkname = g_file_get_child (ostree_subbootdir, bootlink_pathname);
gs_unref_object GFile *linkname_parent = g_file_get_parent (linkname);
@@ -822,15 +820,15 @@ parse_os_release (const char *contents,
static gboolean
install_deployment_kernel (GFile *sysroot,
int new_bootversion,
- OtDeployment *deployment,
+ OstreeDeployment *deployment,
guint n_deployments,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- const char *osname = ot_deployment_get_osname (deployment);
- const char *bootcsum = ot_deployment_get_bootcsum (deployment);
+ const char *osname = ostree_deployment_get_osname (deployment);
+ const char *bootcsum = ostree_deployment_get_bootcsum (deployment);
gs_unref_object GFile *bootdir = NULL;
gs_unref_object GFile *bootcsumdir = NULL;
gs_unref_object GFile *bootconfpath = NULL;
@@ -854,10 +852,10 @@ install_deployment_kernel (GFile *sysroot,
gs_free char *options_key = NULL;
__attribute__((cleanup(ot_ordered_hash_cleanup))) OtOrderedHash *ohash = NULL;
const char *val;
- OtConfigParser *bootconfig;
+ OstreeBootconfigParser *bootconfig;
gsize len;
- bootconfig = ot_deployment_get_bootconfig (deployment);
+ bootconfig = ostree_deployment_get_bootconfig (deployment);
deployment_dir = ot_admin_get_deployment_directory (sysroot, deployment);
if (!get_kernel_from_tree (deployment_dir, &tree_kernel_path, &tree_initramfs_path,
@@ -870,8 +868,8 @@ install_deployment_kernel (GFile *sysroot,
bootcsum);
bootconfpath = ot_gfile_resolve_path_printf (bootdir, "loader.%d/entries/ostree-%s-%s-%d.conf",
new_bootversion, osname,
- ot_deployment_get_csum (deployment),
- ot_deployment_get_bootserial (deployment));
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_bootserial (deployment));
if (!gs_file_ensure_directory (bootcsumdir, TRUE, cancellable, error))
goto out;
@@ -925,35 +923,35 @@ install_deployment_kernel (GFile *sysroot,
goto out;
}
- title_key = g_strdup_printf ("ostree:%s:%d %s", ot_deployment_get_osname (deployment),
- ot_deployment_get_index (deployment),
+ title_key = g_strdup_printf ("ostree:%s:%d %s", ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_index (deployment),
val);
- ot_config_parser_set (bootconfig, "title", title_key);
+ ostree_bootconfig_parser_set (bootconfig, "title", title_key);
- version_key = g_strdup_printf ("%d", n_deployments - ot_deployment_get_index (deployment));
- ot_config_parser_set (bootconfig, "version", version_key);
+ version_key = g_strdup_printf ("%d", n_deployments - ostree_deployment_get_index (deployment));
+ ostree_bootconfig_parser_set (bootconfig, "version", version_key);
linux_relpath = g_file_get_relative_path (bootdir, dest_kernel_path);
linux_key = g_strconcat ("/", linux_relpath, NULL);
- ot_config_parser_set (bootconfig, "linux", linux_key);
+ ostree_bootconfig_parser_set (bootconfig, "linux", linux_key);
if (dest_initramfs_path)
{
initramfs_relpath = g_file_get_relative_path (bootdir, dest_initramfs_path);
initrd_key = g_strconcat ("/", initramfs_relpath, NULL);
- ot_config_parser_set (bootconfig, "initrd", initrd_key);
+ ostree_bootconfig_parser_set (bootconfig, "initrd", initrd_key);
}
- val = ot_config_parser_get (bootconfig, "options");
+ val = ostree_bootconfig_parser_get (bootconfig, "options");
ostree_kernel_arg = g_strdup_printf ("/ostree/boot.%d/%s/%s/%d",
new_bootversion, osname, bootcsum,
- ot_deployment_get_bootserial (deployment));
+ ostree_deployment_get_bootserial (deployment));
ohash = ot_admin_parse_kernel_args (val);
ot_ordered_hash_replace_key (ohash, "ostree", ostree_kernel_arg);
options_key = ot_admin_kernel_arg_string_serialize (ohash);
- ot_config_parser_set (bootconfig, "options", options_key);
+ ostree_bootconfig_parser_set (bootconfig, "options", options_key);
- if (!ot_config_parser_write (ot_deployment_get_bootconfig (deployment), bootconfpath,
+ if (!ostree_bootconfig_parser_write (ostree_deployment_get_bootconfig (deployment), bootconfpath,
cancellable, error))
goto out;
@@ -1025,7 +1023,7 @@ ot_admin_write_deployments (GFile *sysroot,
{
for (i = 0; i < new_deployments->len; i++)
{
- OtDeployment *deployment = new_deployments->pdata[i];
+ OstreeDeployment *deployment = new_deployments->pdata[i];
if (!install_deployment_kernel (sysroot, new_bootversion,
deployment, new_deployments->len,
cancellable, error))
@@ -1078,24 +1076,24 @@ ot_admin_deploy (GFile *sysroot,
GKeyFile *origin,
char **add_kernel_argv,
gboolean retain,
- OtDeployment *booted_deployment,
- OtDeployment *provided_merge_deployment,
- OtDeployment **out_new_deployment,
+ OstreeDeployment *booted_deployment,
+ OstreeDeployment *provided_merge_deployment,
+ OstreeDeployment **out_new_deployment,
int *out_new_bootversion,
GPtrArray **out_new_deployments,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- OtDeployment *new_deployment;
- gs_unref_object OtDeployment *merge_deployment = NULL;
+ OstreeDeployment *new_deployment;
+ gs_unref_object OstreeDeployment *merge_deployment = NULL;
gs_unref_object OstreeRepo *repo = NULL;
gs_unref_object GFile *commit_root = NULL;
gs_unref_object GFile *tree_kernel_path = NULL;
gs_unref_object GFile *tree_initramfs_path = NULL;
gs_unref_object GFile *new_deployment_path = NULL;
gs_free char *new_bootcsum = NULL;
- gs_unref_object OtConfigParser *bootconfig = NULL;
+ gs_unref_object OstreeBootconfigParser *bootconfig = NULL;
gs_unref_ptrarray GPtrArray *new_deployments = NULL;
int new_bootversion;
@@ -1151,7 +1149,7 @@ ot_admin_deploy (GFile *sysroot,
&new_deployments,
&new_bootversion);
new_deployment = g_object_ref (new_deployments->pdata[0]);
- ot_deployment_set_origin (new_deployment, origin);
+ ostree_deployment_set_origin (new_deployment, origin);
print_deployment_diff (current_deployments, new_deployments);
@@ -1172,8 +1170,8 @@ ot_admin_deploy (GFile *sysroot,
/* Create an empty boot configuration; we will merge things into
* it as we go.
*/
- bootconfig = ot_config_parser_new (" ");
- ot_deployment_set_bootconfig (new_deployment, bootconfig);
+ bootconfig = ostree_bootconfig_parser_new ();
+ ostree_deployment_set_bootconfig (new_deployment, bootconfig);
if (!merge_configuration (sysroot, merge_deployment, new_deployment,
new_deployment_path,
@@ -1196,7 +1194,7 @@ ot_admin_deploy (GFile *sysroot,
__attribute__((cleanup(ot_ordered_hash_cleanup))) OtOrderedHash *ohash = NULL;
gs_free char *new_options = NULL;
- ohash = ot_admin_parse_kernel_args (ot_config_parser_get (bootconfig, "options"));
+ ohash = ot_admin_parse_kernel_args (ostree_bootconfig_parser_get (bootconfig, "options"));
for (strviter = add_kernel_argv; *strviter; strviter++)
{
@@ -1207,7 +1205,7 @@ ot_admin_deploy (GFile *sysroot,
}
new_options = ot_admin_kernel_arg_string_serialize (ohash);
- ot_config_parser_set (bootconfig, "options", new_options);
+ ostree_bootconfig_parser_set (bootconfig, "options", new_options);
}
if (!ot_admin_write_deployments (sysroot, current_bootversion, new_bootversion,
@@ -1222,7 +1220,7 @@ ot_admin_deploy (GFile *sysroot,
* done from the host.
*/
{
- gs_unref_object GFile *osdir = ot_gfile_resolve_path_printf (sysroot, "ostree/deploy/%s",
ot_deployment_get_osname (new_deployment));
+ gs_unref_object GFile *osdir = ot_gfile_resolve_path_printf (sysroot, "ostree/deploy/%s",
ostree_deployment_get_osname (new_deployment));
gs_unref_object GFile *os_current_path = g_file_get_child (osdir, "current");
gs_free char *target = g_file_get_relative_path (osdir, new_deployment_path);
g_assert (target != NULL);
diff --git a/src/ostree/ot-admin-deploy.h b/src/ostree/ot-admin-deploy.h
index ab9f1f5..e076d00 100644
--- a/src/ostree/ot-admin-deploy.h
+++ b/src/ostree/ot-admin-deploy.h
@@ -23,7 +23,7 @@
#pragma once
#include <gio/gio.h>
-#include "ot-deployment.h"
+#include <ostree.h>
#include "ot-bootloader.h"
#include "ot-ordered-hash.h"
@@ -44,9 +44,9 @@ gboolean ot_admin_deploy (GFile *sysroot,
GKeyFile *origin,
char **add_kernel_argv,
gboolean retain,
- OtDeployment *booted_deployment,
- OtDeployment *merge_deployment,
- OtDeployment **out_new_deployment,
+ OstreeDeployment *booted_deployment,
+ OstreeDeployment *merge_deployment,
+ OstreeDeployment **out_new_deployment,
int *out_new_bootversion,
GPtrArray **out_new_deployments,
GCancellable *cancellable,
diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c
index 92a181c..770857a 100644
--- a/src/ostree/ot-admin-functions.c
+++ b/src/ostree/ot-admin-functions.c
@@ -23,8 +23,6 @@
#include "config.h"
#include "ot-admin-functions.h"
-#include "ot-deployment.h"
-#include "ot-config-parser.h"
#include "ot-bootloader-syslinux.h"
#include "ot-bootloader-uboot.h"
#include "otutil.h"
@@ -281,13 +279,13 @@ parse_origin (GFile *sysroot,
static gboolean
parse_deployment (GFile *sysroot,
const char *boot_link,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
const char *relative_boot_link;
- gs_unref_object OtDeployment *ret_deployment = NULL;
+ gs_unref_object OstreeDeployment *ret_deployment = NULL;
int entry_boot_version;
int treebootserial = -1;
int deployserial = -1;
@@ -326,10 +324,10 @@ parse_deployment (GFile *sysroot,
cancellable, error))
goto out;
- ret_deployment = ot_deployment_new (-1, osname, treecsum, deployserial,
+ ret_deployment = ostree_deployment_new (-1, osname, treecsum, deployserial,
bootcsum, treebootserial);
if (origin)
- ot_deployment_set_origin (ret_deployment, origin);
+ ostree_deployment_set_origin (ret_deployment, origin);
ret = TRUE;
ot_transfer_out_value (out_deployment, &ret_deployment);
@@ -362,7 +360,7 @@ parse_kernel_commandline (OtOrderedHash **out_args,
/**
* ot_admin_find_booted_deployment:
* @target_sysroot: Root directory
- * @deployments: (element-type OtDeployment): Loaded deployments
+ * @deployments: (element-type OstreeDeployment): Loaded deployments
* @out_deployment: (out): The currently booted deployment
* @cancellable:
* @error:
@@ -374,13 +372,13 @@ parse_kernel_commandline (OtOrderedHash **out_args,
gboolean
ot_admin_find_booted_deployment (GFile *target_sysroot,
GPtrArray *deployments,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gs_unref_object GFile *active_root = g_file_new_for_path ("/");
- gs_unref_object OtDeployment *ret_deployment = NULL;
+ gs_unref_object OstreeDeployment *ret_deployment = NULL;
if (g_file_equal (active_root, target_sysroot))
{
@@ -402,7 +400,7 @@ ot_admin_find_booted_deployment (GFile *target_sysroot,
{
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
gs_unref_object GFile *deployment_path = ot_admin_get_deployment_directory (active_root,
deployment);
guint32 device;
guint64 inode;
@@ -440,12 +438,12 @@ gboolean
ot_admin_require_deployment_or_osname (GFile *sysroot,
GPtrArray *deployments,
const char *osname,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object OtDeployment *ret_deployment = NULL;
+ gs_unref_object OstreeDeployment *ret_deployment = NULL;
if (!ot_admin_find_booted_deployment (sysroot, deployments, &ret_deployment,
cancellable, error))
@@ -464,18 +462,18 @@ ot_admin_require_deployment_or_osname (GFile *sysroot,
return ret;
}
-OtDeployment *
+OstreeDeployment *
ot_admin_get_merge_deployment (GPtrArray *deployments,
const char *osname,
- OtDeployment *booted_deployment)
+ OstreeDeployment *booted_deployment)
{
g_return_val_if_fail (osname != NULL || booted_deployment != NULL, NULL);
if (osname == NULL)
- osname = ot_deployment_get_osname (booted_deployment);
+ osname = ostree_deployment_get_osname (booted_deployment);
if (booted_deployment &&
- g_strcmp0 (ot_deployment_get_osname (booted_deployment), osname) == 0)
+ g_strcmp0 (ostree_deployment_get_osname (booted_deployment), osname) == 0)
{
return g_object_ref (booted_deployment);
}
@@ -484,9 +482,9 @@ ot_admin_get_merge_deployment (GPtrArray *deployments,
guint i;
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
- if (strcmp (ot_deployment_get_osname (deployment), osname) != 0)
+ if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
return g_object_ref (deployment);
@@ -637,9 +635,9 @@ ot_admin_read_boot_loader_configs (GFile *sysroot,
g_str_has_suffix (name, ".conf") &&
g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
{
- gs_unref_object OtConfigParser *config = ot_config_parser_new (" \t");
+ gs_unref_object OstreeBootconfigParser *config = ostree_bootconfig_parser_new ();
- if (!ot_config_parser_parse (config, child, cancellable, error))
+ if (!ostree_bootconfig_parser_parse (config, child, cancellable, error))
{
g_prefix_error (error, "Parsing %s: ", gs_file_get_path_cached (child));
goto out;
@@ -657,13 +655,13 @@ ot_admin_read_boot_loader_configs (GFile *sysroot,
}
static char *
-get_ostree_kernel_arg_from_config (OtConfigParser *config)
+get_ostree_kernel_arg_from_config (OstreeBootconfigParser *config)
{
const char *options;
char *ret = NULL;
char **opts, **iter;
- options = ot_config_parser_get (config, "options");
+ options = ostree_bootconfig_parser_get (config, "options");
if (!options)
return NULL;
@@ -684,14 +682,14 @@ get_ostree_kernel_arg_from_config (OtConfigParser *config)
static gboolean
list_deployments_process_one_boot_entry (GFile *sysroot,
- OtConfigParser *config,
+ OstreeBootconfigParser *config,
GPtrArray *inout_deployments,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gs_free char *ostree_arg = NULL;
- gs_unref_object OtDeployment *deployment = NULL;
+ gs_unref_object OstreeDeployment *deployment = NULL;
ostree_arg = get_ostree_kernel_arg_from_config (config);
if (ostree_arg == NULL)
@@ -705,7 +703,7 @@ list_deployments_process_one_boot_entry (GFile *sysroot,
cancellable, error))
goto out;
- ot_deployment_set_bootconfig (deployment, config);
+ ostree_deployment_set_bootconfig (deployment, config);
g_ptr_array_add (inout_deployments, g_object_ref (deployment));
@@ -718,12 +716,12 @@ static gint
compare_deployments_by_boot_loader_version_reversed (gconstpointer a_pp,
gconstpointer b_pp)
{
- OtDeployment *a = *((OtDeployment**)a_pp);
- OtDeployment *b = *((OtDeployment**)b_pp);
- OtConfigParser *a_bootconfig = ot_deployment_get_bootconfig (a);
- OtConfigParser *b_bootconfig = ot_deployment_get_bootconfig (b);
- const char *a_version = ot_config_parser_get (a_bootconfig, "version");
- const char *b_version = ot_config_parser_get (b_bootconfig, "version");
+ OstreeDeployment *a = *((OstreeDeployment**)a_pp);
+ OstreeDeployment *b = *((OstreeDeployment**)b_pp);
+ OstreeBootconfigParser *a_bootconfig = ostree_deployment_get_bootconfig (a);
+ OstreeBootconfigParser *b_bootconfig = ostree_deployment_get_bootconfig (b);
+ const char *a_version = ostree_bootconfig_parser_get (a_bootconfig, "version");
+ const char *b_version = ostree_bootconfig_parser_get (b_bootconfig, "version");
if (a_version && b_version)
{
@@ -761,7 +759,7 @@ ot_admin_list_deployments (GFile *sysroot,
for (i = 0; i < boot_loader_configs->len; i++)
{
- OtConfigParser *config = boot_loader_configs->pdata[i];
+ OstreeBootconfigParser *config = boot_loader_configs->pdata[i];
if (!list_deployments_process_one_boot_entry (sysroot, config, ret_deployments,
cancellable, error))
@@ -771,8 +769,8 @@ ot_admin_list_deployments (GFile *sysroot,
g_ptr_array_sort (ret_deployments, compare_deployments_by_boot_loader_version_reversed);
for (i = 0; i < ret_deployments->len; i++)
{
- OtDeployment *deployment = ret_deployments->pdata[i];
- ot_deployment_set_index (deployment, i);
+ OstreeDeployment *deployment = ret_deployments->pdata[i];
+ ostree_deployment_set_index (deployment, i);
}
ret = TRUE;
@@ -784,12 +782,12 @@ ot_admin_list_deployments (GFile *sysroot,
GFile *
ot_admin_get_deployment_directory (GFile *sysroot,
- OtDeployment *deployment)
+ OstreeDeployment *deployment)
{
gs_free char *path = g_strdup_printf ("ostree/deploy/%s/deploy/%s.%d",
- ot_deployment_get_osname (deployment),
- ot_deployment_get_csum (deployment),
- ot_deployment_get_deployserial (deployment));
+ ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_deployserial (deployment));
return g_file_resolve_relative_path (sysroot, path);
}
diff --git a/src/ostree/ot-admin-functions.h b/src/ostree/ot-admin-functions.h
index 61f8b23..f48912a 100644
--- a/src/ostree/ot-admin-functions.h
+++ b/src/ostree/ot-admin-functions.h
@@ -23,8 +23,7 @@
#pragma once
#include <gio/gio.h>
-#include "ostree.h"
-#include "ot-deployment.h"
+#include <ostree.h>
#include "ot-bootloader.h"
#include "ot-ordered-hash.h"
@@ -79,30 +78,30 @@ gboolean ot_admin_list_deployments (GFile *sysroot,
gboolean ot_admin_find_booted_deployment (GFile *sysroot,
GPtrArray *deployments,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error);
gboolean ot_admin_require_booted_deployment (GFile *sysroot,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error);
gboolean ot_admin_require_deployment_or_osname (GFile *sysroot,
GPtrArray *deployment_list,
const char *osname,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error);
-OtDeployment *ot_admin_get_merge_deployment (GPtrArray *deployment_list,
+OstreeDeployment *ot_admin_get_merge_deployment (GPtrArray *deployment_list,
const char *osname,
- OtDeployment *booted_deployment);
+ OstreeDeployment *booted_deployment);
GFile *ot_admin_get_deployment_origin_path (GFile *deployment_path);
GFile *ot_admin_get_deployment_directory (GFile *sysroot,
- OtDeployment *deployment);
+ OstreeDeployment *deployment);
gboolean ot_admin_get_repo (GFile *sysroot,
OstreeRepo **out_repo,
diff --git a/src/ostree/ot-bootloader-syslinux.c b/src/ostree/ot-bootloader-syslinux.c
index 3fe5df7..2d951f3 100644
--- a/src/ostree/ot-bootloader-syslinux.c
+++ b/src/ostree/ot-bootloader-syslinux.c
@@ -73,10 +73,10 @@ append_config_from_boot_loader_entries (OtBootloaderSyslinux *self,
for (i = 0; i < boot_loader_configs->len; i++)
{
- OtConfigParser *config = boot_loader_configs->pdata[i];
+ OstreeBootconfigParser *config = boot_loader_configs->pdata[i];
const char *val;
- val = ot_config_parser_get (config, "title");
+ val = ostree_bootconfig_parser_get (config, "title");
if (!val)
val = "(Untitled)";
@@ -87,7 +87,7 @@ append_config_from_boot_loader_entries (OtBootloaderSyslinux *self,
g_ptr_array_add (new_lines, g_strdup_printf ("LABEL %s", val));
- val = ot_config_parser_get (config, "linux");
+ val = ostree_bootconfig_parser_get (config, "linux");
if (!val)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@@ -96,11 +96,11 @@ append_config_from_boot_loader_entries (OtBootloaderSyslinux *self,
}
g_ptr_array_add (new_lines, g_strdup_printf ("\tKERNEL %s", val));
- val = ot_config_parser_get (config, "initrd");
+ val = ostree_bootconfig_parser_get (config, "initrd");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("\tINITRD %s", val));
- val = ot_config_parser_get (config, "options");
+ val = ostree_bootconfig_parser_get (config, "options");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("\tAPPEND %s", val));
}
diff --git a/src/ostree/ot-bootloader-uboot.c b/src/ostree/ot-bootloader-uboot.c
index 15951a0..691d2a5 100644
--- a/src/ostree/ot-bootloader-uboot.c
+++ b/src/ostree/ot-bootloader-uboot.c
@@ -67,7 +67,7 @@ create_config_from_boot_loader_entries (OtBootloaderUboot *self,
GError **error)
{
gs_unref_ptrarray GPtrArray *boot_loader_configs = NULL;
- OtConfigParser *config;
+ OstreeBootconfigParser *config;
const char *val;
if (!ot_admin_read_boot_loader_configs (self->sysroot, bootversion, &boot_loader_configs,
@@ -77,7 +77,7 @@ create_config_from_boot_loader_entries (OtBootloaderUboot *self,
/* U-Boot doesn't support a menu so just pick the first one since the list is ordered */
config = boot_loader_configs->pdata[0];
- val = ot_config_parser_get (config, "linux");
+ val = ostree_bootconfig_parser_get (config, "linux");
if (!val)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@@ -86,11 +86,11 @@ create_config_from_boot_loader_entries (OtBootloaderUboot *self,
}
g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image=%s", val));
- val = ot_config_parser_get (config, "initrd");
+ val = ostree_bootconfig_parser_get (config, "initrd");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image=%s", val));
- val = ot_config_parser_get (config, "options");
+ val = ostree_bootconfig_parser_get (config, "options");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", val));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]