[PATCH 2/2] erofs-utils: introduce `payload` field in `struct erofs_vfile`

Gao Xiang hsiangkao at linux.alibaba.com
Mon Jun 24 21:59:23 AEST 2024


Allow customized `vfile` with non-NULL `ops` utilizing `payload`
for additional information.

Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 include/erofs/io.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/erofs/io.h b/include/erofs/io.h
index 6167bdf..f53abed 100644
--- a/include/erofs/io.h
+++ b/include/erofs/io.h
@@ -37,10 +37,16 @@ struct erofs_vfops {
 		     struct erofs_vfile *vin, int len, bool noseek);
 };
 
+/* don't extend this; instead, use payload for any extra information */
 struct erofs_vfile {
 	struct erofs_vfops *ops;
-	u64 offset;
-	int fd;
+	union {
+		struct {
+			u64 offset;
+			int fd;
+		};
+		u8 payload[16];
+	};
 };
 
 int erofs_io_fstat(struct erofs_vfile *vf, struct stat *buf);
-- 
2.39.3



More information about the Linux-erofs mailing list