aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/src/write_super.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-01-31 11:21:30 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-01-31 13:51:49 +0100
commitcdccc69c62579b0c13b35fad0728079652b8f3c9 (patch)
tree9fa54c710f73c5e08a9c8466e7a712eb63ee07ac /lib/sqfs/src/write_super.c
parent2182129c8f359c4fa1390eaba7a65b595ccd4182 (diff)
Move library source into src sub-directory
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/src/write_super.c')
-rw-r--r--lib/sqfs/src/write_super.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/sqfs/src/write_super.c b/lib/sqfs/src/write_super.c
new file mode 100644
index 0000000..35127da
--- /dev/null
+++ b/lib/sqfs/src/write_super.c
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
+/*
+ * write_super.c
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#define SQFS_BUILDING_DLL
+#include "config.h"
+
+#include "sqfs/super.h"
+#include "sqfs/io.h"
+#include "compat.h"
+
+int sqfs_super_write(const sqfs_super_t *super, sqfs_file_t *file)
+{
+ sqfs_super_t copy;
+
+ copy.magic = htole32(super->magic);
+ copy.inode_count = htole32(super->inode_count);
+ copy.modification_time = htole32(super->modification_time);
+ copy.block_size = htole32(super->block_size);
+ copy.fragment_entry_count = htole32(super->fragment_entry_count);
+ copy.compression_id = htole16(super->compression_id);
+ copy.block_log = htole16(super->block_log);
+ copy.flags = htole16(super->flags);
+ copy.id_count = htole16(super->id_count);
+ copy.version_major = htole16(super->version_major);
+ copy.version_minor = htole16(super->version_minor);
+ copy.root_inode_ref = htole64(super->root_inode_ref);
+ copy.bytes_used = htole64(super->bytes_used);
+ copy.id_table_start = htole64(super->id_table_start);
+ copy.xattr_id_table_start = htole64(super->xattr_id_table_start);
+ copy.inode_table_start = htole64(super->inode_table_start);
+ copy.directory_table_start = htole64(super->directory_table_start);
+ copy.fragment_table_start = htole64(super->fragment_table_start);
+ copy.export_table_start = htole64(super->export_table_start);
+
+ return file->write_at(file, 0, &copy, sizeof(copy));
+}