From 898b1fdc705cc7829a188a7f6351cbbf37fc237f Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 13 Apr 2023 17:22:38 -0400 Subject: lib/sysroot-cleanup: Make some static utility functions global Prep for future patch. --- src/libostree/ostree-sysroot-cleanup.c | 26 +++++++++++++------------- src/libostree/ostree-sysroot-private.h | 9 +++++++++ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/libostree/ostree-sysroot-cleanup.c b/src/libostree/ostree-sysroot-cleanup.c index 2b5c3e68..619831d0 100644 --- a/src/libostree/ostree-sysroot-cleanup.c +++ b/src/libostree/ostree-sysroot-cleanup.c @@ -108,10 +108,10 @@ list_all_deployment_directories (OstreeSysroot *self, return TRUE; } -static gboolean -parse_bootdir_name (const char *name, - char **out_osname, - char **out_csum) +gboolean +_ostree_sysroot_parse_bootdir_name (const char *name, + char **out_osname, + char **out_csum) { const char *lastdash; @@ -136,11 +136,11 @@ parse_bootdir_name (const char *name, return TRUE; } -static gboolean -list_all_boot_directories (OstreeSysroot *self, - char ***out_bootdirs, - GCancellable *cancellable, - GError **error) +gboolean +_ostree_sysroot_list_all_boot_directories (OstreeSysroot *self, + char ***out_bootdirs, + GCancellable *cancellable, + GError **error) { g_autoptr(GPtrArray) ret_bootdirs = g_ptr_array_new_with_free_func (g_free); @@ -163,7 +163,7 @@ list_all_boot_directories (OstreeSysroot *self, /* Only look at directories ending in -CHECKSUM; nothing else * should be in here, but let's be conservative. */ - if (!parse_bootdir_name (dent->d_name, NULL, NULL)) + if (!_ostree_sysroot_parse_bootdir_name (dent->d_name, NULL, NULL)) continue; g_ptr_array_add (ret_bootdirs, g_strdup (dent->d_name)); @@ -306,7 +306,7 @@ cleanup_old_deployments (OstreeSysroot *self, /* Clean up boot directories */ g_auto(GStrv) all_boot_dirs = NULL; - if (!list_all_boot_directories (self, &all_boot_dirs, cancellable, error)) + if (!_ostree_sysroot_list_all_boot_directories (self, &all_boot_dirs, cancellable, error)) return FALSE; for (char **it = all_boot_dirs; it && *it; it++) @@ -314,8 +314,8 @@ cleanup_old_deployments (OstreeSysroot *self, char *bootdir = *it; g_autofree char *bootcsum = NULL; - if (!parse_bootdir_name (bootdir, NULL, &bootcsum)) - g_assert_not_reached (); /* checked in list_all_boot_directories() */ + if (!_ostree_sysroot_parse_bootdir_name (bootdir, NULL, &bootcsum)) + g_assert_not_reached (); /* checked in _ostree_sysroot_list_all_boot_directories() */ if (g_hash_table_lookup (active_boot_checksums, bootcsum)) continue; diff --git a/src/libostree/ostree-sysroot-private.h b/src/libostree/ostree-sysroot-private.h index a49a406c..dfa649cb 100644 --- a/src/libostree/ostree-sysroot-private.h +++ b/src/libostree/ostree-sysroot-private.h @@ -187,4 +187,13 @@ gboolean _ostree_sysroot_cleanup_internal (OstreeSysroot *sysroot, GCancellable *cancellable, GError **error); +gboolean _ostree_sysroot_parse_bootdir_name (const char *name, + char **out_osname, + char **out_csum); + +gboolean _ostree_sysroot_list_all_boot_directories (OstreeSysroot *self, + char ***out_bootdirs, + GCancellable *cancellable, + GError **error); + G_END_DECLS -- cgit v1.2.1