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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
/*
* rdsquashfs.h
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#ifndef RDSQUASHFS_H
#define RDSQUASHFS_H
#include "config.h"
#include "sqfs/meta_reader.h"
#include "sqfs/compress.h"
#include "sqfs/id_table.h"
#include "sqfs/xattr.h"
#include "sqfs/data.h"
#include "data_reader.h"
#include "highlevel.h"
#include "fstree.h"
#include "util.h"
#include <sys/sysmacros.h>
#include <sys/types.h>
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
#endif
#include <sys/prctl.h>
#include <sys/wait.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
enum UNPACK_FLAGS {
UNPACK_CHMOD = 0x01,
UNPACK_CHOWN = 0x02,
UNPACK_QUIET = 0x04,
UNPACK_NO_SPARSE = 0x08,
UNPACK_SET_XATTR = 0x10,
UNPACK_SET_TIMES = 0x20,
};
enum {
OP_NONE = 0,
OP_LS,
OP_CAT,
OP_UNPACK,
OP_DESCRIBE,
OP_RDATTR,
};
typedef struct {
int op;
int rdtree_flags;
int flags;
char *cmdpath;
const char *unpack_root;
const char *image_name;
} options_t;
void list_files(const sqfs_tree_node_t *node);
int restore_fstree(sqfs_tree_node_t *root, int flags);
int update_tree_attribs(sqfs_xattr_reader_t *xattr,
const sqfs_tree_node_t *root, int flags);
int fill_unpacked_files(size_t blk_sz, const sqfs_tree_node_t *root,
sqfs_data_reader_t *data, int flags);
int describe_tree(const sqfs_tree_node_t *root, const char *unpack_root);
int dump_xattrs(sqfs_xattr_reader_t *xattr, const sqfs_inode_generic_t *inode);
void process_command_line(options_t *opt, int argc, char **argv);
#endif /* RDSQUASHFS_H */
|