]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/filed/xattr.h
62742a82e2137ce89c22029614187f67c8debea3
[bacula/bacula] / bacula / src / filed / xattr.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2015 Kern Sibbald
5    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
6
7    The original author of Bacula is Kern Sibbald, with contributions
8    from many others, a complete list can be found in the file AUTHORS.
9
10    You may use this file and others of this release according to the
11    license defined in the LICENSE file, which includes the Affero General
12    Public License, v3.0 ("AGPLv3") and some additional permissions and
13    terms pursuant to its AGPLv3 Section 7.
14
15    This notice must be preserved when any source code is 
16    conveyed and/or propagated.
17
18    Bacula(R) is a registered trademark of Kern Sibbald.
19 */
20
21 #ifndef BACULA_XATTR_H_
22 #define BACULA_XATTR_H_
23
24 #if defined(HAVE_LINUX_OS)
25 #define BXATTR_ENOTSUP EOPNOTSUPP
26 #elif defined(HAVE_DARWIN_OS)
27 #define BXATTR_ENOTSUP ENOTSUP
28 #elif defined(HAVE_HURD_OS)
29 #define BXATTR_ENOTSUP ENOTSUP
30 #endif
31
32 /*
33  * Magic used in the magic field of the xattr struct.
34  * This way we can see we encounter a valid xattr struct.
35  */
36 #define XATTR_MAGIC 0x5C5884
37
38 /*
39  * Internal representation of an extended attribute.
40  */
41 struct xattr_t {
42    uint32_t magic;
43    uint32_t name_length;
44    char *name;
45    uint32_t value_length;
46    char *value;
47 };
48
49 /*
50  * Internal representation of an extended attribute hardlinked file.
51  */
52 struct xattr_link_cache_entry_t {
53    uint32_t inum;
54    char *target;
55 };
56
57 #define BXATTR_FLAG_SAVE_NATIVE    0x01
58 #define BXATTR_FLAG_RESTORE_NATIVE 0x02
59
60 /*
61  * Internal tracking data.
62  */
63 struct xattr_ctx_t {
64    uint32_t flags;              /* See BXATTR_FLAG_* */
65    uint32_t current_dev;
66    uint32_t nr_errors;
67    uint32_t nr_saved;
68    POOLMEM *content;
69    uint32_t content_length;
70    alist *link_cache;
71 };
72
73 #define MAX_XATTR_LENGTH  (1 * 1024 * 1024) /* 1 Mb */
74
75 #define XATTR_BUFSIZ    1024
76
77 #endif /* BACULA_XATTR_H_ */