erofs-utils: introduce `payload` field in `struct erofs_vfile`
authorGao Xiang <hsiangkao@linux.alibaba.com>
Mon, 24 Jun 2024 11:59:23 +0000 (19:59 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Mon, 24 Jun 2024 13:08:42 +0000 (21:08 +0800)
Allow customized `vfile` with non-NULL `ops` utilizing `payload`
for additional information.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240624115923.4090196-2-hsiangkao@linux.alibaba.com
include/erofs/io.h

index 6167bdf14ae21d6b5c2b7aba4cfd30940c0b55b0..f53abed93754d2eeb4b8bbf53a7443b7b307fc39 100644 (file)
@@ -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);