Skip to contentSkip to conversation

erofs-utils: mkfs,oci: support tarindex mode with zinfo for OCI

PATCH New ChengyuZhu6 1 participant 2 messages Oct 9, 2025 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 erofs-utils: mkfs,oci: support tarindex mode with zinfo for OCI

From: Chengyu Zhu <[email protected]>

Introduce OCI tarindex mode and optional zinfo generation.

e.g.:

$ mkfs.erofs --oci=i,platform=linux/amd64,layer=3 \
   --gzinfo=golang.zinfo golang.erofs golang:1.22.8
---
 lib/liberofs_oci.h |  2 ++
 lib/remotes/oci.c  | 57 ++++++++++++++++++++++++++++++++---
 mkfs/main.c        | 74 +++++++++++++++++++++++++++++-----------------
 3 files changed, 102 insertions(+), 31 deletions(-)
lib/liberofs_oci.h +2 -0
index 71c8879..5298f18 100644
@@ -35,6 +35,8 @@ struct ocierofs_config {
 	char *password;
 	char *blob_digest;
 	int layer_index;
+	char *tarindex_path;
+	char *zinfo_path;
 };
 
 struct ocierofs_layer_info {
lib/remotes/oci.c +53 -4

104 lines not on this page · raw message

mkfs/main.c +47 -27

138 lines not on this page · raw message

Signature · 1 line
2.51.0
#1 lore raw

PATCH 2/2 erofs-utils: mount: add support for standard OCI targz blob access

From: Chengyu Zhu <[email protected]>

Add support for combining tarindex files with remote OCI blobs through a new source mechanism. This allows local metadata storage while keeping OCI tgz blob data in remote registries.

e.g.:

 $ mkfs.erofs --oci=i,platform=linux/amd64,layer=0 \
    --gzinfo=ubuntu.zinfo ubuntu.erofs ubuntu:20.04
 $ mount.erofs -t erofs.nbd -o oci.layer=0,\
    oci.platform=linux/amd64,oci.tarindex=ubuntu.erofs,\
    oci.zinfo=ubuntu.zinfo ubuntu:20.04 mnt
---
 lib/remotes/oci.c |  20 ---
 mount/main.c      | 378 ++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 369 insertions(+), 29 deletions(-)
lib/remotes/oci.c +0 -20
index d5ae4d8..25f991d 100644
@@ -1510,19 +1510,6 @@ static void ocierofs_io_close(struct erofs_vfile *vfile)
 	*(struct ocierofs_iostream **)vfile->payload = NULL;
 }
 
-static int ocierofs_is_erofs_native_image(struct ocierofs_ctx *ctx)
-{
-	if (ctx->layer_count > 0 && ctx->layers[0] &&
-	    ctx->layers[0]->media_type) {
-		const char *media_type = ctx->layers[0]->media_type;
-		size_t len = strlen(media_type);
-
-		if (len >= 6 && strcmp(media_type + len - 6, ".erofs") == 0)
-			return 0;
-	}
-	return -ENOENT;
-}
-
 static struct erofs_vfops ocierofs_io_vfops = {
 	.pread = ocierofs_io_pread,
 	.read = ocierofs_io_read,
@@ -1546,13 +1533,6 @@ int ocierofs_io_open(struct erofs_vfile *vfile, const struct ocierofs_config *cf
 		return err;
 	}
 
-	err = ocierofs_is_erofs_native_image(ctx);
-	if (err) {
-		ocierofs_ctx_cleanup(ctx);
-		free(ctx);
-		return err;
-	}
-
 	oci_iostream = calloc(1, sizeof(*oci_iostream));
 	if (!oci_iostream) {
 		ocierofs_ctx_cleanup(ctx);
mount/main.c +369 -9

444 lines not on this page · raw message

Signature · 1 line
2.51.0