diff options
Diffstat (limited to 'src/libostree/ostree-repo-static-delta-private.h')
-rw-r--r-- | src/libostree/ostree-repo-static-delta-private.h | 156 |
1 files changed, 64 insertions, 92 deletions
diff --git a/src/libostree/ostree-repo-static-delta-private.h b/src/libostree/ostree-repo-static-delta-private.h index e1b4de3b..72208c2e 100644 --- a/src/libostree/ostree-repo-static-delta-private.h +++ b/src/libostree/ostree-repo-static-delta-private.h @@ -24,7 +24,7 @@ G_BEGIN_DECLS /* Arbitrarily chosen */ -#define OSTREE_STATIC_DELTA_PART_MAX_SIZE_BYTES (16*1024*1024) +#define OSTREE_STATIC_DELTA_PART_MAX_SIZE_BYTES (16 * 1024 * 1024) /* 1 byte for object type, 32 bytes for checksum */ #define OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN 33 @@ -57,7 +57,6 @@ G_BEGIN_DECLS #define OSTREE_STATIC_DELTA_META_ENTRY_FORMAT "(uayttay)" - /** * OSTREE_STATIC_DELTA_FALLBACK_FORMAT: * @@ -100,7 +99,9 @@ G_BEGIN_DECLS * fetch individually - the compiler determined it wasn't worth * duplicating the space. */ -#define OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT "(a{sv}tayay" OSTREE_COMMIT_GVARIANT_STRING "aya" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT "a" OSTREE_STATIC_DELTA_FALLBACK_FORMAT ")" +#define OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT \ + "(a{sv}tayay" OSTREE_COMMIT_GVARIANT_STRING "aya" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT \ + "a" OSTREE_STATIC_DELTA_FALLBACK_FORMAT ")" /** * OSTREE_STATIC_DELTA_SIGNED_FORMAT @@ -119,15 +120,17 @@ G_BEGIN_DECLS */ #define OSTREE_STATIC_DELTA_SIGNED_FORMAT "(taya{sv})" -#define OSTREE_STATIC_DELTA_SIGNED_MAGIC 0x4F535453474E4454 /* OSTSGNDT */ +#define OSTREE_STATIC_DELTA_SIGNED_MAGIC 0x4F535453474E4454 /* OSTSGNDT */ -typedef enum { +typedef enum +{ OSTREE_STATIC_DELTA_OPEN_FLAGS_NONE = 0, OSTREE_STATIC_DELTA_OPEN_FLAGS_SKIP_CHECKSUM = (1 << 0), OSTREE_STATIC_DELTA_OPEN_FLAGS_VARIANT_TRUSTED = (1 << 1) } OstreeStaticDeltaOpenFlags; -typedef enum { +typedef enum +{ OSTREE_STATIC_DELTA_OP_OPEN_SPLICE_AND_CLOSE = 'S', OSTREE_STATIC_DELTA_OP_OPEN = 'o', OSTREE_STATIC_DELTA_OP_WRITE = 'w', @@ -138,52 +141,39 @@ typedef enum { } OstreeStaticDeltaOpCode; #define OSTREE_STATIC_DELTA_N_OPS 7 -gboolean -_ostree_static_delta_part_open (GInputStream *part_in, - GBytes *inline_part_bytes, - OstreeStaticDeltaOpenFlags flags, - const char *expected_checksum, - GVariant **out_part, - GCancellable *cancellable, - GError **error); +gboolean _ostree_static_delta_part_open (GInputStream *part_in, GBytes *inline_part_bytes, + OstreeStaticDeltaOpenFlags flags, + const char *expected_checksum, GVariant **out_part, + GCancellable *cancellable, GError **error); -typedef struct { +typedef struct +{ guint n_ops_executed[OSTREE_STATIC_DELTA_N_OPS]; } OstreeDeltaExecuteStats; -gboolean _ostree_static_delta_part_execute (OstreeRepo *repo, - GVariant *header, - GVariant *part_payload, - gboolean stats_only, +gboolean _ostree_static_delta_part_execute (OstreeRepo *repo, GVariant *header, + GVariant *part_payload, gboolean stats_only, OstreeDeltaExecuteStats *stats, - GCancellable *cancellable, - GError **error); - -void _ostree_static_delta_part_execute_async (OstreeRepo *repo, - GVariant *header, - GVariant *part_payload, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean _ostree_static_delta_part_execute_finish (OstreeRepo *repo, - GAsyncResult *result, - GError **error); - -gboolean -_ostree_static_delta_parse_checksum_array (GVariant *array, - guint8 **out_checksums_array, - guint *out_n_checksums, - GError **error); - -gboolean -_ostree_repo_static_delta_part_have_all_objects (OstreeRepo *repo, - GVariant *checksum_array, - gboolean *out_have_all, - GCancellable *cancellable, - GError **error); - -typedef struct { + GCancellable *cancellable, GError **error); + +void _ostree_static_delta_part_execute_async (OstreeRepo *repo, GVariant *header, + GVariant *part_payload, GCancellable *cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean _ostree_static_delta_part_execute_finish (OstreeRepo *repo, GAsyncResult *result, + GError **error); + +gboolean _ostree_static_delta_parse_checksum_array (GVariant *array, guint8 **out_checksums_array, + guint *out_n_checksums, GError **error); + +gboolean _ostree_repo_static_delta_part_have_all_objects (OstreeRepo *repo, + GVariant *checksum_array, + gboolean *out_have_all, + GCancellable *cancellable, + GError **error); + +typedef struct +{ char *checksum; guint64 size; GPtrArray *basenames; @@ -191,45 +181,27 @@ typedef struct { void _ostree_delta_content_sizenames_free (gpointer v); -gboolean -_ostree_delta_compute_similar_objects (OstreeRepo *repo, - GVariant *from_commit, - GVariant *to_commit, - GHashTable *new_reachable_regfile_content, - guint similarity_percent_threshold, - GHashTable **out_modified_regfile_content, - GCancellable *cancellable, - GError **error); - -gboolean -_ostree_repo_static_delta_query_exists (OstreeRepo *repo, - const char *delta_id, - gboolean *out_exists, - GCancellable *cancellable, - GError **error); -GVariant * -_ostree_repo_static_delta_superblock_digest (OstreeRepo *repo, - const char *from, - const char *to, - GCancellable *cancellable, - GError **error); - -gboolean -_ostree_repo_static_delta_dump (OstreeRepo *repo, - const char *delta_id, - GCancellable *cancellable, - GError **error); - -gboolean -_ostree_repo_static_delta_delete (OstreeRepo *repo, - const char *delta_id, - GCancellable *cancellable, - GError **error); -gboolean -_ostree_repo_static_delta_reindex (OstreeRepo *repo, - const char *opt_to_commit, - GCancellable *cancellable, - GError **error); +gboolean _ostree_delta_compute_similar_objects (OstreeRepo *repo, GVariant *from_commit, + GVariant *to_commit, + GHashTable *new_reachable_regfile_content, + guint similarity_percent_threshold, + GHashTable **out_modified_regfile_content, + GCancellable *cancellable, GError **error); + +gboolean _ostree_repo_static_delta_query_exists (OstreeRepo *repo, const char *delta_id, + gboolean *out_exists, GCancellable *cancellable, + GError **error); +GVariant *_ostree_repo_static_delta_superblock_digest (OstreeRepo *repo, const char *from, + const char *to, GCancellable *cancellable, + GError **error); + +gboolean _ostree_repo_static_delta_dump (OstreeRepo *repo, const char *delta_id, + GCancellable *cancellable, GError **error); + +gboolean _ostree_repo_static_delta_delete (OstreeRepo *repo, const char *delta_id, + GCancellable *cancellable, GError **error); +gboolean _ostree_repo_static_delta_reindex (OstreeRepo *repo, const char *opt_to_commit, + GCancellable *cancellable, GError **error); /* Used for static deltas which due to a historical mistake are * inconsistent endian. @@ -237,8 +209,7 @@ _ostree_repo_static_delta_reindex (OstreeRepo *repo, * https://bugzilla.gnome.org/show_bug.cgi?id=762515 */ static inline guint32 -maybe_swap_endian_u32 (gboolean swap, - guint32 v) +maybe_swap_endian_u32 (gboolean swap, guint32 v) { if (!swap) return v; @@ -246,21 +217,22 @@ maybe_swap_endian_u32 (gboolean swap, } static inline guint64 -maybe_swap_endian_u64 (gboolean swap, - guint64 v) +maybe_swap_endian_u64 (gboolean swap, guint64 v) { if (!swap) return v; return GUINT64_SWAP_LE_BE (v); } -typedef enum { +typedef enum +{ OSTREE_DELTA_ENDIAN_BIG, OSTREE_DELTA_ENDIAN_LITTLE, OSTREE_DELTA_ENDIAN_INVALID } OstreeDeltaEndianness; -OstreeDeltaEndianness _ostree_delta_get_endianness (GVariant *superblock, gboolean *out_was_heuristic); +OstreeDeltaEndianness _ostree_delta_get_endianness (GVariant *superblock, + gboolean *out_was_heuristic); gboolean _ostree_delta_needs_byteswap (GVariant *superblock); |