summaryrefslogtreecommitdiff
path: root/bin/gensquashfs/mkfs.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-04-27 11:59:02 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-04-27 11:59:02 +0200
commit20b0d509f67dea802706cd6b80b5e20d14988931 (patch)
tree3a87ea358b1206f6823777693d109896d6908283 /bin/gensquashfs/mkfs.h
parent9e332a2d3eddcc262476ac263e03df021b3c44b4 (diff)
Cleanup directory structure of the binary programs
Instead of having the binary programs in randomly named subdirectories, move all of them to a "bin" subdirectory, similar to the utility libraries that have subdirectories within "lib" and give the subdirectories the propper names (e.g. have gensquashfs source in a directory *actually* named "gensquashfs"). Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/gensquashfs/mkfs.h')
-rw-r--r--bin/gensquashfs/mkfs.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/bin/gensquashfs/mkfs.h b/bin/gensquashfs/mkfs.h
new file mode 100644
index 0000000..1b767aa
--- /dev/null
+++ b/bin/gensquashfs/mkfs.h
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * mkfs.h
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef MKFS_H
+#define MKFS_H
+
+#include "config.h"
+
+#include "common.h"
+#include "fstree.h"
+
+#ifdef HAVE_SYS_XATTR_H
+#include <sys/xattr.h>
+
+#if defined(__APPLE__) && defined(__MACH__)
+#define llistxattr(path, list, size) \
+ listxattr(path, list, size, XATTR_NOFOLLOW)
+
+#define lgetxattr(path, name, value, size) \
+ getxattr(path, name, value, size, 0, XATTR_NOFOLLOW)
+#endif
+#endif
+
+#ifdef WITH_SELINUX
+#include <selinux/selinux.h>
+#include <selinux/label.h>
+#endif
+
+#include <getopt.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <dirent.h>
+#include <stdio.h>
+#include <errno.h>
+#include <ctype.h>
+
+typedef struct {
+ sqfs_writer_cfg_t cfg;
+ unsigned int dirscan_flags;
+ const char *infile;
+ const char *packdir;
+ const char *selinux;
+ bool no_tail_packing;
+} options_t;
+
+enum {
+ DIR_SCAN_KEEP_TIME = 0x01,
+
+ DIR_SCAN_ONE_FILESYSTEM = 0x02,
+
+ DIR_SCAN_READ_XATTR = 0x04,
+};
+
+void process_command_line(options_t *opt, int argc, char **argv);
+
+int fstree_from_dir(fstree_t *fs, const char *path, void *selinux_handle,
+ sqfs_xattr_writer_t *xwr, unsigned int flags);
+
+
+void *selinux_open_context_file(const char *filename);
+
+int selinux_relable_node(void *sehnd, sqfs_xattr_writer_t *xwr,
+ tree_node_t *node, const char *path);
+
+void selinux_close_context_file(void *sehnd);
+
+#endif /* MKFS_H */