summaryrefslogtreecommitdiff
path: root/lib/sqfs/dir_writer.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 17:10:33 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 17:12:04 +0200
commitdd5d7adaa914982e8947bfe76fa3f195ed11cdb1 (patch)
tree541325774fa90814fbef1e9f9c5677c8330ef8c1 /lib/sqfs/dir_writer.c
parentd5f89c52d219332c48a46aa297bb4896e8c159aa (diff)
Cleanup: add sqfs_* prefix to meta writer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/dir_writer.c')
-rw-r--r--lib/sqfs/dir_writer.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/sqfs/dir_writer.c b/lib/sqfs/dir_writer.c
index 3ef3bc7..2fb655a 100644
--- a/lib/sqfs/dir_writer.c
+++ b/lib/sqfs/dir_writer.c
@@ -43,7 +43,7 @@ struct sqfs_dir_writer_t {
uint64_t dir_ref;
size_t dir_size;
size_t idx_size;
- meta_writer_t *dm;
+ sqfs_meta_writer_t *dm;
};
static int get_type(mode_t mode)
@@ -85,7 +85,7 @@ static void writer_reset(sqfs_dir_writer_t *writer)
writer->idx_size = 0;
}
-sqfs_dir_writer_t *sqfs_dir_writer_create(meta_writer_t *dm)
+sqfs_dir_writer_t *sqfs_dir_writer_create(sqfs_meta_writer_t *dm)
{
sqfs_dir_writer_t *writer = calloc(1, sizeof(*writer));
@@ -111,7 +111,7 @@ int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer)
writer_reset(writer);
- meta_writer_get_position(writer->dm, &block, &offset);
+ sqfs_meta_writer_get_position(writer->dm, &block, &offset);
writer->dir_ref = (block << 16) | offset;
return 0;
}
@@ -185,7 +185,7 @@ static int add_header(sqfs_dir_writer_t *writer, size_t count,
hdr.start_block = htole32(ref->inode_ref >> 16);
hdr.inode_number = htole32(ref->inode_num);
- if (meta_writer_append(writer->dm, &hdr, sizeof(hdr)))
+ if (sqfs_meta_writer_append(writer->dm, &hdr, sizeof(hdr)))
return -1;
idx = calloc(1, sizeof(*idx));
@@ -220,7 +220,7 @@ int sqfs_dir_writer_end(sqfs_dir_writer_t *writer)
uint64_t block;
for (it = writer->list; it != NULL; ) {
- meta_writer_get_position(writer->dm, &block, &offset);
+ sqfs_meta_writer_get_position(writer->dm, &block, &offset);
count = get_conseq_entry_count(offset, it);
if (add_header(writer, count, it, block))
@@ -237,11 +237,15 @@ int sqfs_dir_writer_end(sqfs_dir_writer_t *writer)
diff_u16 = (uint16_t *)&ent.inode_diff;
*diff_u16 = htole16(*diff_u16);
- if (meta_writer_append(writer->dm, &ent, sizeof(ent)))
+ if (sqfs_meta_writer_append(writer->dm, &ent,
+ sizeof(ent))) {
return -1;
+ }
- if (meta_writer_append(writer->dm, it->name, it->name_len))
+ if (sqfs_meta_writer_append(writer->dm, it->name,
+ it->name_len)) {
return -1;
+ }
it = it->next;
}
@@ -266,7 +270,7 @@ size_t sqfs_dir_writer_get_index_size(sqfs_dir_writer_t *writer)
}
int sqfs_dir_writer_write_index(sqfs_dir_writer_t *writer,
- meta_writer_t *im)
+ sqfs_meta_writer_t *im)
{
sqfs_dir_index_t ent;
index_ent_t *idx;
@@ -276,11 +280,13 @@ int sqfs_dir_writer_write_index(sqfs_dir_writer_t *writer,
ent.index = htole32(idx->index);
ent.size = htole32(idx->ent->name_len - 1);
- if (meta_writer_append(im, &ent, sizeof(ent)))
+ if (sqfs_meta_writer_append(im, &ent, sizeof(ent)))
return -1;
- if (meta_writer_append(im, idx->ent->name, idx->ent->name_len))
+ if (sqfs_meta_writer_append(im, idx->ent->name,
+ idx->ent->name_len)) {
return -1;
+ }
}
return 0;