From b7c4f9a9b729bb88c9451011e5c51875b845ac83 Mon Sep 17 00:00:00 2001 From: Eric Curtin Date: Thu, 22 Feb 2024 18:15:09 +0000 Subject: [PATCH] sysroot: Reword comment and use gboolean over bool Be more explicit in the comment and use gboolean over bool. Less header inclusions when we use gboolean. Although bool is used in some places. Co-authored-by: Jonathan Lebon Signed-off-by: Eric Curtin --- src/libostree/ostree-impl-system-generator.c | 5 +++-- src/libostree/ostree-sysroot-private.h | 4 +--- src/libostree/ostree-sysroot.c | 2 +- src/libotcore/otcore-prepare-root.c | 3 ++- src/libotcore/otcore.h | 2 +- src/switchroot/ostree-prepare-root.c | 2 +- tests/test-otcore.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libostree/ostree-impl-system-generator.c b/src/libostree/ostree-impl-system-generator.c index bfda2b138f..772d5be5c0 100644 --- a/src/libostree/ostree-impl-system-generator.c +++ b/src/libostree/ostree-impl-system-generator.c @@ -264,8 +264,9 @@ _ostree_impl_system_generator (const char *normal_dir, const char *early_dir, co g_autoptr (GError) otcore_get_ostree_target_error = NULL; g_autofree char *ostree_target = NULL; - bool is_aboot = false; - /* This could happen in CoreOS live environments, where we hackily mock + gboolean is_aboot = false; + /* If no `ostree=` karg exists, gracefully no-op. + * This could happen in CoreOS live environments, where we hackily mock * the `ostree=` karg for `ostree-prepare-root.service` specifically, but * otherwise that karg doesn't exist on the real command-line. */ if (!otcore_get_ostree_target (cmdline, &is_aboot, &ostree_target, diff --git a/src/libostree/ostree-sysroot-private.h b/src/libostree/ostree-sysroot-private.h index 0e9f15bd16..b4438c9d2f 100644 --- a/src/libostree/ostree-sysroot-private.h +++ b/src/libostree/ostree-sysroot-private.h @@ -19,8 +19,6 @@ #pragma once -#include - #include "libglnx.h" #include "ostree-bootloader.h" #include "ostree.h" @@ -179,7 +177,7 @@ gboolean _ostree_sysroot_parse_bootdir_name (const char *name, char **out_osname gboolean _ostree_sysroot_list_all_boot_directories (OstreeSysroot *self, char ***out_bootdirs, GCancellable *cancellable, GError **error); -gboolean _ostree_sysroot_parse_bootlink (const char *bootlink, const bool is_aboot, +gboolean _ostree_sysroot_parse_bootlink (const char *bootlink, const gboolean is_aboot, int *out_entry_bootversion, char **out_osname, char **out_bootcsum, int *out_treebootserial, GError **error); diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 097feb8b2c..d1b3b68ef8 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -724,7 +724,7 @@ load_origin (OstreeSysroot *self, OstreeDeployment *deployment, GCancellable *ca // Parse the kernel argument ostree= gboolean -_ostree_sysroot_parse_bootlink (const char *bootlink, const bool is_aboot, +_ostree_sysroot_parse_bootlink (const char *bootlink, const gboolean is_aboot, int *out_entry_bootversion, char **out_osname, char **out_bootcsum, int *out_treebootserial, GError **error) { diff --git a/src/libotcore/otcore-prepare-root.c b/src/libotcore/otcore-prepare-root.c index 19f481c10e..60652dbfd6 100644 --- a/src/libotcore/otcore-prepare-root.c +++ b/src/libotcore/otcore-prepare-root.c @@ -75,7 +75,8 @@ otcore_find_proc_cmdline_key (const char *cmdline, const char *key) // // If invalid data is found, @error will be set. gboolean -otcore_get_ostree_target (const char *cmdline, bool *is_aboot, char **out_target, GError **error) +otcore_get_ostree_target (const char *cmdline, gboolean *is_aboot, char **out_target, + GError **error) { g_assert (cmdline); g_assert (out_target && *out_target == NULL); diff --git a/src/libotcore/otcore.h b/src/libotcore/otcore.h index 79a10f1568..fc6b81ca1a 100644 --- a/src/libotcore/otcore.h +++ b/src/libotcore/otcore.h @@ -44,7 +44,7 @@ gboolean otcore_validate_ed25519_signature (GBytes *data, GBytes *pubkey, GBytes bool *out_valid, GError **error); char *otcore_find_proc_cmdline_key (const char *cmdline, const char *key); -gboolean otcore_get_ostree_target (const char *cmdline, bool *is_aboot, char **out_target, +gboolean otcore_get_ostree_target (const char *cmdline, gboolean *is_aboot, char **out_target, GError **error); GKeyFile *otcore_load_config (int rootfs, const char *filename, GError **error); diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c index dd973594f7..dce605eb9d 100644 --- a/src/switchroot/ostree-prepare-root.c +++ b/src/switchroot/ostree-prepare-root.c @@ -124,7 +124,7 @@ resolve_deploy_path (const char *root_mountpoint) g_autoptr (GError) error = NULL; g_autofree char *ostree_target = NULL; - bool is_aboot = false; + gboolean is_aboot = false; if (!otcore_get_ostree_target (kernel_cmdline, &is_aboot, &ostree_target, &error)) errx (EXIT_FAILURE, "Failed to determine ostree target: %s", error->message); if (!ostree_target) diff --git a/tests/test-otcore.c b/tests/test-otcore.c index bc2f5a95bc..01ce5f9f49 100644 --- a/tests/test-otcore.c +++ b/tests/test-otcore.c @@ -36,7 +36,7 @@ test_prepare_root_cmdline (void) { g_autoptr (GError) error = NULL; g_autofree char *target = NULL; - bool is_aboot = false; + gboolean is_aboot = false; static const char *notfound_cases[] = { "", "foo", "foo=bar baz sometest", "xostree foo", "xostree=blah bar", NULL };