summaryrefslogtreecommitdiff
path: root/mkfs/mksquashfs.h
blob: 677dad4c60e954ced7e2da3e01735f1b949aaa70 (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
/* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef MKSQUASHFS_H
#define MKSQUASHFS_H

#include "squashfs.h"
#include "compress.h"
#include "fstree.h"
#include "config.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;
	const char *infile;
	const char *outfile;
} options_t;

typedef struct {
	uint8_t data[SQFS_META_BLOCK_SIZE + 2];
	size_t offset;
	size_t block_offset;
	int outfd;
	compressor_t *cmp;
} meta_writer_t;

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

int sqfs_super_init(sqfs_super_t *s, const options_t *opt);

int sqfs_padd_file(sqfs_super_t *s, const options_t *opt, int outfd);

int sqfs_super_write(const sqfs_super_t *super, int outfd);

meta_writer_t *meta_writer_create(int fd, compressor_t *cmp);

void meta_writer_destroy(meta_writer_t *m);

int meta_writer_flush(meta_writer_t *m);

int meta_writer_append(meta_writer_t *m, const void *data, size_t size);

#endif /* MKSQUASHFS_H */