From 118f1f7e40004b079beea0a29f92cd51dc32f81f Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 2 Feb 2018 13:58:40 +0100 Subject: [PATCH] ostree: introduce PAYLOAD_LINK object type It will be used by successive commits to keep track of the payload checksum for objects stored in the repository. The goal is that files having the same payload but different xattrs can take advantage of reflinks where supported. Signed-off-by: Giuseppe Scrivano Closes: #1443 Approved by: cgwalters --- src/libostree/ostree-core.c | 5 +++++ src/libostree/ostree-core.h | 4 +++- src/libostree/ostree-repo.c | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index ba790dc7..33d6a48b 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -1239,6 +1239,8 @@ ostree_object_type_to_string (OstreeObjectType objtype) return "tombstone-commit"; case OSTREE_OBJECT_TYPE_COMMIT_META: return "commitmeta"; + case OSTREE_OBJECT_TYPE_PAYLOAD_LINK: + return "payload-link"; default: g_assert_not_reached (); return NULL; @@ -1266,6 +1268,8 @@ ostree_object_type_from_string (const char *str) return OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT; else if (!strcmp (str, "commitmeta")) return OSTREE_OBJECT_TYPE_COMMIT_META; + else if (!strcmp (str, "payload-link")) + return OSTREE_OBJECT_TYPE_PAYLOAD_LINK; g_assert_not_reached (); return 0; } @@ -2122,6 +2126,7 @@ _ostree_validate_structureof_metadata (OstreeObjectType objtype, break; case OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT: case OSTREE_OBJECT_TYPE_COMMIT_META: + case OSTREE_OBJECT_TYPE_PAYLOAD_LINK: /* TODO */ break; case OSTREE_OBJECT_TYPE_FILE: diff --git a/src/libostree/ostree-core.h b/src/libostree/ostree-core.h index 018f5070..b65c9ba9 100644 --- a/src/libostree/ostree-core.h +++ b/src/libostree/ostree-core.h @@ -68,6 +68,7 @@ G_BEGIN_DECLS * @OSTREE_OBJECT_TYPE_COMMIT: Toplevel object, refers to tree and dirmeta for root * @OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT: Toplevel object, refers to a deleted commit * @OSTREE_OBJECT_TYPE_COMMIT_META: Detached metadata for a commit + * @OSTREE_OBJECT_TYPE_PAYLOAD_LINK: Symlink to a .file given its checksum on the payload only. * * Enumeration for core object types; %OSTREE_OBJECT_TYPE_FILE is for * content, the other types are metadata. @@ -79,6 +80,7 @@ typedef enum { OSTREE_OBJECT_TYPE_COMMIT = 4, /* .commit */ OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT = 5, /* .commit-tombstone */ OSTREE_OBJECT_TYPE_COMMIT_META = 6, /* .commitmeta */ + OSTREE_OBJECT_TYPE_PAYLOAD_LINK = 7, /* .payload-link */ } OstreeObjectType; /** @@ -94,7 +96,7 @@ typedef enum { * * Last valid object type; use this to validate ranges. */ -#define OSTREE_OBJECT_TYPE_LAST OSTREE_OBJECT_TYPE_COMMIT_META +#define OSTREE_OBJECT_TYPE_LAST OSTREE_OBJECT_TYPE_PAYLOAD_LINK /** * OSTREE_DIRMETA_GVARIANT_FORMAT: diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 20a8839b..8d94f71a 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -3278,6 +3278,8 @@ list_loose_objects_at (OstreeRepo *self, objtype = OSTREE_OBJECT_TYPE_DIR_META; else if (strcmp (dot, ".commit") == 0) objtype = OSTREE_OBJECT_TYPE_COMMIT; + else if (strcmp (dot, ".payload-link") == 0) + objtype = OSTREE_OBJECT_TYPE_PAYLOAD_LINK; else continue;