blob: ac27222e2b9930522c137f018184885faf1eb45a [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>
17
18#define STAR_COUNT 1000
19
20/* Things that need to be init'd */
21struct restore_opts {
22 int add_assoc; /* Track inode associations for conflict detection. */
23 int progress;
24 unsigned long long count;
25 int debug;
26 int change;
27 int hard_links;
28 int verbose;
29 int logging;
Eric Paris30ad11f2011-07-10 16:38:41 +020030 int ignore_enoent;
Thomas Liu2a1933d2009-09-10 14:54:35 -040031 char *rootpath;
32 int rootpathlen;
33 char *progname;
34 FILE *outfile;
35 int force;
36 struct selabel_handle *hnd;
37 int expand_realpath; /* Expand paths via realpath. */
38 int abort_on_error; /* Abort the file tree walk upon an error. */
39 int quiet;
40 int fts_flags; /* Flags to fts, e.g. follow links, follow mounts */
41 const char *selabel_opt_validate;
42 const char *selabel_opt_path;
43};
44
45void restore_init(struct restore_opts *opts);
46void restore_finish();
47int add_exclude(const char *directory);
Eric Paris66564a62011-07-10 17:35:24 +020048int exclude(const char *path);
Thomas Liu2a1933d2009-09-10 14:54:35 -040049void remove_exclude(const char *directory);
50int process_one_realpath(char *name, int recurse);
Eric Paris17c577a2011-07-10 17:06:00 +020051int process_glob(char *name, int recurse);
Eric Paris5ffa2962011-07-10 16:46:38 +020052void exclude_non_seclabel_mounts();
Thomas Liu2a1933d2009-09-10 14:54:35 -040053
54#endif