blob: b55de81f2480872079543468c41ff9df2853c23b [file] [log] [blame]
Thomas Liu2a1933d2009-09-10 14:54:35 -04001#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 Reiser960d6ee2012-02-03 11:56:39 -050017#include <stdint.h>
Thomas Liu2a1933d2009-09-10 14:54:35 -040018
Dan Walsh6020fb02013-10-11 10:42:06 -040019#define STAR_COUNT 1024
Thomas Liu2a1933d2009-09-10 14:54:35 -040020
21/* Things that need to be init'd */
22struct restore_opts {
23 int add_assoc; /* Track inode associations for conflict detection. */
24 int progress;
John Reiser960d6ee2012-02-03 11:56:39 -050025 uint64_t count; /* Number of files processed so far */
26 uint64_t nfile; /* Estimated total number of files */
Thomas Liu2a1933d2009-09-10 14:54:35 -040027 int debug;
28 int change;
29 int hard_links;
30 int verbose;
31 int logging;
Eric Paris30ad11f2011-07-10 16:38:41 +020032 int ignore_enoent;
Thomas Liu2a1933d2009-09-10 14:54:35 -040033 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
47void restore_init(struct restore_opts *opts);
Nicolas Ioossc4a4a1a2014-09-14 23:41:49 +020048void restore_finish(void);
Thomas Liu2a1933d2009-09-10 14:54:35 -040049int add_exclude(const char *directory);
Eric Paris66564a62011-07-10 17:35:24 +020050int exclude(const char *path);
Thomas Liu2a1933d2009-09-10 14:54:35 -040051void remove_exclude(const char *directory);
52int process_one_realpath(char *name, int recurse);
Eric Paris17c577a2011-07-10 17:06:00 +020053int process_glob(char *name, int recurse);
Nicolas Ioossc4a4a1a2014-09-14 23:41:49 +020054int exclude_non_seclabel_mounts(void);
Thomas Liu2a1933d2009-09-10 14:54:35 -040055
56#endif