summaryrefslogtreecommitdiff
path: root/mkfs/mkfs.h
blob: 63bfc107e6d882ad6929d88d72aa41c9278de992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef MKFS_H
#define MKFS_H

#include "meta_writer.h"
#include "highlevel.h"
#include "squashfs.h"
#include "compress.h"
#include "id_table.h"
#include "fstree.h"
#include "config.h"

#include <assert.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>

typedef struct {
	unsigned int def_uid;
	unsigned int def_gid;
	unsigned int def_mode;
	unsigned int def_mtime;
	int outmode;
	int compressor;
	int blksz;
	int devblksz;
	bool quiet;
	const char *infile;
	const char *packdir;
	const char *outfile;
	const char *selinux;
	char *comp_extra;
} options_t;

typedef struct data_writer_t data_writer_t;

typedef struct {
	int outfd;
	options_t opt;
	sqfs_super_t super;
	fstree_t fs;

	id_table_t idtbl;

	compressor_t *cmp;
} sqfs_info_t;

void process_command_line(options_t *opt, int argc, char **argv);

int write_xattr(sqfs_info_t *info);

data_writer_t *data_writer_create(sqfs_super_t *super, compressor_t *cmp,
				  int outfd);

void data_writer_destroy(data_writer_t *data);

int data_writer_write_fragment_table(data_writer_t *data);

int write_data_from_fd(data_writer_t *data, file_info_t *fi, int infd);

int data_writer_flush_fragments(data_writer_t *data);

int write_data_to_image(data_writer_t *data, sqfs_info_t *info);

#endif /* MKFS_H */