From d2e97bf6901e98cd8c6c4ce9dabe9b6357be3f78 Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Mon, 24 Jun 2024 19:59:23 +0800 Subject: [PATCH] erofs-utils: introduce `payload` field in `struct erofs_vfile` Allow customized `vfile` with non-NULL `ops` utilizing `payload` for additional information. Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20240624115923.4090196-2-hsiangkao@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.34.1