aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/read_inode.c2
-rw-r--r--lib/sqfs/write_inode.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/sqfs/read_inode.c b/lib/sqfs/read_inode.c
index 10337a7..6da9653 100644
--- a/lib/sqfs/read_inode.c
+++ b/lib/sqfs/read_inode.c
@@ -100,6 +100,7 @@ static sqfs_inode_generic_t *read_inode_file(meta_reader_t *ir,
out->base = *base;
out->data.file = file;
out->block_sizes = (uint32_t *)out->extra;
+ out->num_file_blocks = count;
if (meta_reader_read(ir, out->block_sizes, count * sizeof(uint32_t))) {
free(out);
@@ -143,6 +144,7 @@ static sqfs_inode_generic_t *read_inode_file_ext(meta_reader_t *ir,
out->base = *base;
out->data.file_ext = file;
out->block_sizes = (uint32_t *)out->extra;
+ out->num_file_blocks = count;
if (meta_reader_read(ir, out->block_sizes, count * sizeof(uint32_t))) {
free(out);
diff --git a/lib/sqfs/write_inode.c b/lib/sqfs/write_inode.c
index a2d87f9..258f516 100644
--- a/lib/sqfs/write_inode.c
+++ b/lib/sqfs/write_inode.c
@@ -8,21 +8,19 @@
#include "sqfs/inode.h"
-static int write_block_sizes(meta_writer_t *ir, sqfs_inode_generic_t *n,
- size_t file_num_blocks)
+static int write_block_sizes(meta_writer_t *ir, sqfs_inode_generic_t *n)
{
- uint32_t sizes[file_num_blocks];
+ uint32_t sizes[n->num_file_blocks];
size_t i;
- for (i = 0; i < file_num_blocks; ++i)
+ for (i = 0; i < n->num_file_blocks; ++i)
sizes[i] = htole32(n->block_sizes[i]);
return meta_writer_append(ir, sizes,
- sizeof(uint32_t) * file_num_blocks);
+ sizeof(uint32_t) * n->num_file_blocks);
}
-int meta_writer_write_inode(meta_writer_t *ir, sqfs_inode_generic_t *n,
- size_t file_num_blocks)
+int meta_writer_write_inode(meta_writer_t *ir, sqfs_inode_generic_t *n)
{
sqfs_inode_t base;
@@ -57,7 +55,7 @@ int meta_writer_write_inode(meta_writer_t *ir, sqfs_inode_generic_t *n,
};
if (meta_writer_append(ir, &file, sizeof(file)))
return -1;
- return write_block_sizes(ir, n, file_num_blocks);
+ return write_block_sizes(ir, n);
}
case SQFS_INODE_SLINK: {
sqfs_inode_slink_t slink = {
@@ -109,7 +107,7 @@ int meta_writer_write_inode(meta_writer_t *ir, sqfs_inode_generic_t *n,
};
if (meta_writer_append(ir, &file, sizeof(file)))
return -1;
- return write_block_sizes(ir, n, file_num_blocks);
+ return write_block_sizes(ir, n);
}
case SQFS_INODE_EXT_SLINK: {
sqfs_inode_slink_t slink = {