Thomas Liu | 2a1933d | 2009-09-10 14:54:35 -0400 | [diff] [blame] | 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 <stdlib.h> |
| 16 | #include <limits.h> |
John Reiser | 960d6ee | 2012-02-03 11:56:39 -0500 | [diff] [blame] | 17 | #include <stdint.h> |
Thomas Liu | 2a1933d | 2009-09-10 14:54:35 -0400 | [diff] [blame] | 18 | |
Dan Walsh | 6020fb0 | 2013-10-11 10:42:06 -0400 | [diff] [blame] | 19 | #define STAR_COUNT 1024 |
Thomas Liu | 2a1933d | 2009-09-10 14:54:35 -0400 | [diff] [blame] | 20 | |
| 21 | /* Things that need to be init'd */ |
| 22 | struct restore_opts { |
| 23 | int add_assoc; /* Track inode associations for conflict detection. */ |
| 24 | int progress; |
John Reiser | 960d6ee | 2012-02-03 11:56:39 -0500 | [diff] [blame] | 25 | uint64_t count; /* Number of files processed so far */ |
| 26 | uint64_t nfile; /* Estimated total number of files */ |
Thomas Liu | 2a1933d | 2009-09-10 14:54:35 -0400 | [diff] [blame] | 27 | int debug; |
| 28 | int change; |
| 29 | int hard_links; |
| 30 | int verbose; |
| 31 | int logging; |
Eric Paris | 30ad11f | 2011-07-10 16:38:41 +0200 | [diff] [blame] | 32 | int ignore_enoent; |
Thomas Liu | 2a1933d | 2009-09-10 14:54:35 -0400 | [diff] [blame] | 33 | char *rootpath; |
| 34 | int rootpathlen; |
| 35 | char *progname; |
| 36 | FILE *outfile; |
| 37 | int force; |
| 38 | struct selabel_handle *hnd; |
| 39 | int expand_realpath; /* Expand paths via realpath. */ |
| 40 | int abort_on_error; /* Abort the file tree walk upon an error. */ |
| 41 | int quiet; |
| 42 | int fts_flags; /* Flags to fts, e.g. follow links, follow mounts */ |
| 43 | const char *selabel_opt_validate; |
| 44 | const char *selabel_opt_path; |
| 45 | }; |
| 46 | |
| 47 | void restore_init(struct restore_opts *opts); |
Nicolas Iooss | c4a4a1a | 2014-09-14 23:41:49 +0200 | [diff] [blame] | 48 | void restore_finish(void); |
Thomas Liu | 2a1933d | 2009-09-10 14:54:35 -0400 | [diff] [blame] | 49 | int add_exclude(const char *directory); |
Eric Paris | 66564a6 | 2011-07-10 17:35:24 +0200 | [diff] [blame] | 50 | int exclude(const char *path); |
Thomas Liu | 2a1933d | 2009-09-10 14:54:35 -0400 | [diff] [blame] | 51 | void remove_exclude(const char *directory); |
| 52 | int process_one_realpath(char *name, int recurse); |
Eric Paris | 17c577a | 2011-07-10 17:06:00 +0200 | [diff] [blame] | 53 | int process_glob(char *name, int recurse); |
Nicolas Iooss | c4a4a1a | 2014-09-14 23:41:49 +0200 | [diff] [blame] | 54 | int exclude_non_seclabel_mounts(void); |
Thomas Liu | 2a1933d | 2009-09-10 14:54:35 -0400 | [diff] [blame] | 55 | |
| 56 | #endif |