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.
This commit is contained in:
Colin Walters 2016-02-18 11:25:57 -05:00
parent 707c14aeeb
commit b08b1abccd
3 changed files with 35 additions and 34 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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)