From b08b1abccdb6f8614750b31f2e3dc572e7b7bc8a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 18 Feb 2016 11:25:57 -0500 Subject: [PATCH] Rename libarchive write API to "export", matching command line I was going to add new API for importing, and it was really confusing that what I think of now as import and export both had "write" in the name. It's just clearer to talk about the direction. At the same time, include `Export` in the options structure. This isn't an ABI break as the API isn't in a release. --- src/libostree/ostree-repo-libarchive.c | 18 +++++------ src/libostree/ostree-repo.h | 45 +++++++++++++------------- src/ostree/ot-builtin-export.c | 6 ++-- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/libostree/ostree-repo-libarchive.c b/src/libostree/ostree-repo-libarchive.c index 3b1b0b83..19fae757 100644 --- a/src/libostree/ostree-repo-libarchive.c +++ b/src/libostree/ostree-repo-libarchive.c @@ -362,7 +362,7 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self, static gboolean file_to_archive_entry_common (GFile *root, - OstreeRepoArchiveOptions *opts, + OstreeRepoExportArchiveOptions *opts, GFile *path, GFileInfo *file_info, struct archive_entry *entry, @@ -438,7 +438,7 @@ write_header_free_entry (struct archive *a, static gboolean write_directory_to_libarchive_recurse (OstreeRepo *self, - OstreeRepoArchiveOptions *opts, + OstreeRepoExportArchiveOptions *opts, GFile *root, GFile *dir, struct archive *a, @@ -569,7 +569,7 @@ write_directory_to_libarchive_recurse (OstreeRepo *self, #endif /** - * ostree_repo_write_tree_to_archive: + * ostree_repo_export_tree_to_archive: * @self: An #OstreeRepo * @opts: Options controlling conversion * @root: An #OstreeRepoFile for the base directory @@ -581,12 +581,12 @@ write_directory_to_libarchive_recurse (OstreeRepo *self, * file structure to @mtree. */ gboolean -ostree_repo_write_tree_to_archive (OstreeRepo *self, - OstreeRepoArchiveOptions *opts, - OstreeRepoFile *root, - void *archive, - GCancellable *cancellable, - GError **error) +ostree_repo_export_tree_to_archive (OstreeRepo *self, + OstreeRepoExportArchiveOptions *opts, + OstreeRepoFile *root, + void *archive, + GCancellable *cancellable, + GError **error) { #ifdef HAVE_LIBARCHIVE gboolean ret = FALSE; diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index 98794b9c..3b1040ab 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -441,22 +441,6 @@ gboolean ostree_repo_write_dfd_to_mtree (OstreeRepo *self, GCancellable *cancellable, GError **error); -/** - * OstreeRepoWriteArchiveOptions: - * - * An extensible options structure controlling archive creation. Ensure that - * you have entirely zeroed the structure, then set just the desired - * options. This is used by ostree_repo_write_tree_to_archive(). - */ -typedef struct { - guint disable_xattrs : 1; - guint reserved : 31; - - guint64 timestamp_secs; - - guint unused_uint[8]; - gpointer unused_ptrs[8]; -} OstreeRepoArchiveOptions; gboolean ostree_repo_write_archive_to_mtree (OstreeRepo *self, GFile *archive, @@ -466,12 +450,29 @@ gboolean ostree_repo_write_archive_to_mtree (OstreeRepo * GCancellable *cancellable, GError **error); -gboolean ostree_repo_write_tree_to_archive (OstreeRepo *self, - OstreeRepoArchiveOptions *opts, - OstreeRepoFile *root, - void *archive, /* Really struct archive * */ - GCancellable *cancellable, - GError **error); +/** + * OstreeRepoExportArchiveOptions: + * + * An extensible options structure controlling archive creation. Ensure that + * you have entirely zeroed the structure, then set just the desired + * options. This is used by ostree_repo_export_tree_to_archive(). + */ +typedef struct { + guint disable_xattrs : 1; + guint reserved : 31; + + guint64 timestamp_secs; + + guint unused_uint[8]; + gpointer unused_ptrs[8]; +} OstreeRepoExportArchiveOptions; + +gboolean ostree_repo_export_tree_to_archive (OstreeRepo *self, + OstreeRepoExportArchiveOptions *opts, + OstreeRepoFile *root, + void *archive, /* Really struct archive * */ + GCancellable *cancellable, + GError **error); gboolean ostree_repo_write_mtree (OstreeRepo *self, OstreeMutableTree *mtree, diff --git a/src/ostree/ot-builtin-export.c b/src/ostree/ot-builtin-export.c index 2d350b8c..cccb50e7 100644 --- a/src/ostree/ot-builtin-export.c +++ b/src/ostree/ot-builtin-export.c @@ -63,7 +63,7 @@ ostree_builtin_export (int argc, char **argv, GCancellable *cancellable, GError g_autofree char *commit = NULL; g_autoptr(GVariant) commit_data = NULL; struct archive *a; - OstreeRepoArchiveOptions opts = { 0, }; + OstreeRepoExportArchiveOptions opts = { 0, }; context = g_option_context_new ("COMMIT - Stream COMMIT to stdout in tar format"); @@ -124,8 +124,8 @@ ostree_builtin_export (int argc, char **argv, GCancellable *cancellable, GError opts.timestamp_secs = ostree_commit_get_timestamp (commit_data); - if (!ostree_repo_write_tree_to_archive (repo, &opts, (OstreeRepoFile*)root, a, - cancellable, error)) + if (!ostree_repo_export_tree_to_archive (repo, &opts, (OstreeRepoFile*)root, a, + cancellable, error)) goto out; if (archive_write_close (a) != ARCHIVE_OK)