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> 17 #include <stdint.h> 18 19 #define STAR_COUNT 1024 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; 25 uint64_t count; /* Number of files processed so far */ 26 uint64_t nfile; /* Estimated total number of files */ 27 int debug; 28 int change; 29 int hard_links; 30 int verbose; 31 int logging; 32 int ignore_enoent; 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); 48 void restore_finish(void); 49 int add_exclude(const char *directory); 50 int exclude(const char *path); 51 void remove_exclude(const char *directory); 52 int process_one_realpath(char *name, int recurse); 53 int process_glob(char *name, int recurse); 54 int exclude_non_seclabel_mounts(void); 55 56 #endif 57