summaryrefslogtreecommitdiff
path: root/lib/sqfs/write_inode.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-04 18:28:59 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-04 18:28:59 +0200
commit3b7f4dbb284462ef7065e19f1725f615973477da (patch)
tree2f1da14b33e69f4a73e49abf2fdec2dbd1844f23 /lib/sqfs/write_inode.c
parent407a2baae5622b05f1e9c4137448a973fd648736 (diff)
Store number of file blocks in generic inode struct
This simplifies things a little bit. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/write_inode.c')
-rw-r--r--lib/sqfs/write_inode.c16
1 files changed, 7 insertions, 9 deletions
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 = {