]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - SQUASHFS/squashfs-tools-4.4/squashfs-tools/action.h
4 * Create a squashfs filesystem. This is a highly compressed read only
7 * Copyright (c) 2011, 2012, 2013, 2014
8 * Phillip Lougher <phillip@squashfs.org.uk>
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2,
13 * or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 * Lexical analyser definitions
30 #define TOK_OPEN_BRACKET 0
31 #define TOK_CLOSE_BRACKET 1
37 #define TOK_WHITE_SPACE 7
41 #define TOK_TO_STR(OP, S) ({ \
51 s = token_table[OP].string; \
65 * Expression parser definitions
71 #define SYNTAX_ERROR(S, ARGS...) { \
72 char *src = strdup(source); \
73 src[cur_ptr - source] = '\0'; \
74 fprintf(stderr, "Failed to parse action \"%s\"\n", source); \
75 fprintf(stderr, "Syntax error: "S, ##ARGS); \
76 fprintf(stderr, "Got here \"%s\"\n", src); \
80 #define TEST_SYNTAX_ERROR(TEST, ARG, S, ARGS...) { \
81 char *src = strdup(source); \
82 src[cur_ptr - source] = '\0'; \
83 fprintf(stderr, "Failed to parse action \"%s\"\n", source); \
84 fprintf(stderr, "Syntax error in \"%s()\", arg %d: "S, TEST->name, \
86 fprintf(stderr, "Got here \"%s\"\n", src); \
100 struct test_entry
*test
;
117 struct expr_op expr_op
;
118 struct unary_op unary_op
;
123 * Test operation definitions
127 #define NUM_GREATER 3
129 struct test_number_arg
{
134 struct test_range_args
{
145 int (*fn
)(struct atom
*, struct action_data
*);
146 int (*parse_args
)(struct test_entry
*, struct atom
*);
153 * Type test specific definitions
164 #define FRAGMENT_ACTION 0
165 #define EXCLUDE_ACTION 1
166 #define FRAGMENTS_ACTION 2
167 #define NO_FRAGMENTS_ACTION 3
168 #define ALWAYS_FRAGS_ACTION 4
169 #define NO_ALWAYS_FRAGS_ACTION 5
170 #define COMPRESSED_ACTION 6
171 #define UNCOMPRESSED_ACTION 7
174 #define GUID_ACTION 10
175 #define MODE_ACTION 11
176 #define EMPTY_ACTION 12
177 #define MOVE_ACTION 13
178 #define PRUNE_ACTION 14
179 #define NOOP_ACTION 15
182 * Define what file types each action operates over
186 #define ACTION_ALL_LNK 3
192 * Action logging requested, specified by the various
193 * -action, -true-action, -false-action and -verbose-action
196 #define ACTION_LOG_NONE 0
197 #define ACTION_LOG_TRUE 1
198 #define ACTION_LOG_FALSE 2
199 #define ACTION_LOG_VERBOSE ACTION_LOG_TRUE | ACTION_LOG_FALSE
201 struct action_entry
{
206 int (*parse_args
)(struct action_entry
*, int, char **, void **);
207 void (*run_action
)(struct action
*, struct dir_ent
*);
217 struct dir_ent
*dir_ent
;
218 struct dir_info
*root
;
224 struct action_entry
*action
;
234 * Uid/gid action specific definitions
251 * Mode action specific definitions
253 #define ACTION_MODE_SET 0
254 #define ACTION_MODE_ADD 1
255 #define ACTION_MODE_REM 2
256 #define ACTION_MODE_OCT 3
259 struct mode_data
*next
;
268 * Empty action specific definitions
271 #define EMPTY_SOURCE 1
272 #define EMPTY_EXCLUDED 2
280 * Move action specific definitions
282 #define ACTION_MOVE_RENAME 1
283 #define ACTION_MOVE_MOVE 2
287 struct dir_ent
*dir_ent
;
289 struct dir_info
*dest
;
290 struct move_ent
*next
;
295 * Perm test function specific definitions
308 * External function definitions
310 extern int parse_action(char *, int verbose
);
311 extern void dump_actions();
312 extern void *eval_frag_actions(struct dir_info
*, struct dir_ent
*);
313 extern void *get_frag_action(void *);
314 extern int eval_exclude_actions(char *, char *, char *, struct stat
*, int,
316 extern void eval_actions(struct dir_info
*, struct dir_ent
*);
317 extern int eval_empty_actions(struct dir_info
*, struct dir_ent
*dir_ent
);
318 extern void eval_move_actions(struct dir_info
*, struct dir_ent
*);
319 extern int eval_prune_actions(struct dir_info
*, struct dir_ent
*);
320 extern void do_move_actions();
321 extern int read_bytes(int, void *, int);
322 extern int actions();
323 extern int move_actions();
324 extern int empty_actions();
325 extern int read_action_file(char *, int);
326 extern int exclude_actions();
327 extern int prune_actions();