Debian Codegraph @

restore/restore.h

raw symbols SCIP
1 /*
2 * Ported to Linux's Second Extended File System as part of the
3 * dump and restore backup suit
4 * Remy Card <[email protected]>, 1994-1997
5 * Stelian Pop <[email protected]>, 1999-2000
6 * Stelian Pop <[email protected]> - AlcĂ´ve <www.alcove.com>, 2000-2002
7 * Tim Woodall <[email protected]> - 2024-
8 */
9
10 /*
11 * Copyright (c) 1983, 1993
12 * The Regents of the University of California. All rights reserved.
13 * (c) UNIX System Laboratories, Inc.
14 * All or some portions of this file are derived from material licensed
15 * to the University of California by American Telephone and Telegraph
16 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
17 * the permission of UNIX System Laboratories, Inc.
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 * 3. Neither the name of the University nor the names of its contributors
28 * may be used to endorse or promote products derived from this software
29 * without specific prior written permission.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
32 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 * SUCH DAMAGE.
42 */
43
44 #pragma once
45
46 #include <sys/types.h>
47 #include "compat/include/bsdcompat.h"
48 #include "compat/include/protocols/dumprestore.h"
49
50 long listfile(const char *name, dump_ino_t ino, int type);
51 long addfile(const char *name, dump_ino_t ino, int type);
52 long deletefile(const char *name, dump_ino_t ino, UNUSED(int type));
53 void removeoldleaves(void);
54 long nodeupdates(const char *name, dump_ino_t ino, int type);
55 void findunreflinks(void);
56 void removeoldnodes(void);
57 void compareleaves(void);
58 void createleaves(const char *symtabfile);
59 void createfiles(void);
60 void createlinks(void);
61 void checkrestore(void);
62 long verifyfile(const char *name, dump_ino_t ino, int type);
63
64 /*
65 * Each file in the file system is described by one of these entries
66 */
67 struct entry {
68 char *e_name; /* the current name of this entry */
69 u_char e_namlen; /* length of this name */
70 char e_type; /* type of this entry, see below */
71 short e_flags; /* status flags, see below */
72 dump_ino_t e_ino; /* inode number in previous file sys */
73 long e_index; /* unique index (for dumpped table) */
74 struct entry *e_parent; /* pointer to parent directory (..) */
75 struct entry *e_sibling; /* next element in this directory (.) */
76 struct entry *e_links; /* hard links to this inode */
77 struct entry **e_entries; /* for directories, their entries */
78 struct entry *e_next; /* hash chain list */
79 };
80 /* types */
81 #define LEAF 1 /* non-directory entry */
82 #define NODE 2 /* directory entry */
83 #define LINK 4 /* synthesized type, stripped by addentry */
84 /* flags */
85 #define EXTRACT 0x0001 /* entry is to be replaced from the tape */
86 #define NEW 0x0002 /* a new entry to be extracted */
87 #define KEEP 0x0004 /* entry is not to change */
88 #define REMOVED 0x0010 /* entry has been removed */
89 #define TMPNAME 0x0020 /* entry has been given a temporary name */
90 #define EXISTED 0x0040 /* directory already existed during extract */
91
92 /*
93 * Constants associated with entry structs
94 */
95 #define HARDLINK 1
96 #define SYMLINK 2
97
98 /*
99 * Useful macros
100 */
101 #define TSTINO(ino, map) \
102 (map[(u_int)((ino) - 1) / NBBY] & (1 << ((u_int)((ino) - 1) % NBBY)))
103 #define SETINO(ino, map) \
104 map[(u_int)((ino) - 1) / NBBY] |= 1 << ((u_int)((ino) - 1) % NBBY)
105
106 #define GOOD 1
107 #define FAIL 0