summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChloe M. <chloe@faracom.org>2026-07-28 06:56:55 +0000
committerChloe M. <chloe@faracom.org>2026-07-28 06:56:55 +0000
commit78fc052118815421e574127dd019915c4edcd65e (patch)
treea8d515053a32efeb00c2532648188eb18e92250a
parent06a022610e2bb23c7b774f38beb2490fffaa4a1f (diff)
packer: Add length field to data descriptor
Signed-off-by: Chloe M. <chloe@faracom.org>
-rw-r--r--core/rdar.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/rdar.c b/core/rdar.c
index 7cd53ef..2f7cea8 100644
--- a/core/rdar.c
+++ b/core/rdar.c
@@ -87,16 +87,18 @@ struct file_view {
* file along with an offset to which it is located at
* in the offset.
*
- * @magic: Format magic
- * @path: File path
- * @off: File data offset
- * @flags: File flags
+ * @magic: Format magic
+ * @path: File path
+ * @off: File data offset
+ * @flags: File flags
+ * @length: File length in bytes
*/
struct data_desc {
char magic[RDAR_MAGIC_LEN];
char path[RDAR_MAX_PATHLEN];
off_t off;
uint16_t flags;
+ size_t length;
};
/*
@@ -248,12 +250,15 @@ static int
idata_push_root(void)
{
struct idata_desc *root;
+ struct data_desc *desc;
root = idata_from_file("%root%", true);
if (root == NULL) {
return -1;
}
+ desc = &root->data;
+ desc->length = sizeof(struct root_data_region);
IDATA_PUSH(root);
return 0;
}
@@ -320,6 +325,7 @@ idata_table_flush(void)
}
d_desc->off = lseek(fd, 0, SEEK_CUR);
+ d_desc->length = view->length;
write(fd, view->data, view->length);
}