• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef RESTORE_H
2 #define RESTORE_H
3 #ifndef _GNU_SOURCE
4 #define _GNU_SOURCE
5 #endif
6 #include <fts.h>
7 #include <errno.h>
8 #include <string.h>
9 #include <stdio.h>
10 #include <syslog.h>
11 #include <sys/stat.h>
12 #include <sepol/sepol.h>
13 #include <selinux/selinux.h>
14 #include <selinux/label.h>
15 #include <selinux/restorecon.h>
16 #include <stdlib.h>
17 #include <limits.h>
18 #include <stdint.h>
19 
20 /*
21  * STAR_COUNT is also defined in libselinux/src/selinux_restorecon.c where it
22  * is used to output "*" for each number of files processed. Defined here for
23  * inclusion in man pages.
24 */
25 #define STAR_COUNT 1000
26 
27 /* Things that need to be init'd */
28 struct restore_opts {
29 	unsigned int nochange;
30 	unsigned int verbose;
31 	unsigned int progress;
32 	unsigned int set_specctx;
33 	unsigned int add_assoc;
34 	unsigned int ignore_digest;
35 	unsigned int recurse;
36 	unsigned int userealpath;
37 	unsigned int xdev;
38 	unsigned int abort_on_error;
39 	unsigned int syslog_changes;
40 	unsigned int log_matches;
41 	unsigned int ignore_noent;
42 	unsigned int ignore_mounts;
43 	/* restorecon_flags holds | of above for restore_init() */
44 	unsigned int restorecon_flags;
45 	char *rootpath;
46 	char *progname;
47 	struct selabel_handle *hnd;
48 	const char *selabel_opt_validate;
49 	const char *selabel_opt_path;
50 	const char *selabel_opt_digest;
51 	int debug;
52 	FILE *outfile;
53 };
54 
55 void restore_init(struct restore_opts *opts);
56 void restore_finish(void);
57 void add_exclude(const char *directory);
58 int process_glob(char *name, struct restore_opts *opts);
59 extern char **exclude_list;
60 
61 #endif
62