]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/filed/xattr.h
131e6c6c5f3f561b3aa630829d4a83c29ae46b2f
[bacula/bacula] / bacula / src / filed / xattr.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from many
7    others, a complete list can be found in the file AUTHORS.
8
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13
14    Bacula® is a registered trademark of Kern Sibbald.
15 */
16
17 #ifndef __XATTR_H
18 #define __XATTR_H
19
20 #if defined(HAVE_LINUX_OS)
21 #define BXATTR_ENOTSUP EOPNOTSUPP
22 #elif defined(HAVE_DARWIN_OS)
23 #define BXATTR_ENOTSUP ENOTSUP
24 #elif defined(HAVE_HURD_OS)
25 #define BXATTR_ENOTSUP ENOTSUP
26 #endif
27
28 /*
29  * Magic used in the magic field of the xattr struct.
30  * This way we can see we encounter a valid xattr struct.
31  */
32 #define XATTR_MAGIC 0x5C5884
33
34 /*
35  * Internal representation of an extended attribute.
36  */
37 struct xattr_t {
38    uint32_t magic;
39    uint32_t name_length;
40    char *name;
41    uint32_t value_length;
42    char *value;
43 };
44
45 /*
46  * Internal representation of an extended attribute hardlinked file.
47  */
48 struct xattr_link_cache_entry_t {
49    uint32_t inum;
50    char *target;
51 };
52
53 #define BXATTR_FLAG_SAVE_NATIVE    0x01
54 #define BXATTR_FLAG_RESTORE_NATIVE 0x02
55
56 struct xattr_build_data_t {
57    uint32_t nr_errors;
58    uint32_t nr_saved;
59    POOLMEM *content;
60    uint32_t content_length;
61    alist *link_cache;
62 };
63
64 struct xattr_parse_data_t {
65    uint32_t nr_errors;
66 };
67
68 /*
69  * Internal tracking data.
70  */
71 struct xattr_data_t {
72    uint32_t flags;              /* See BXATTR_FLAG_* */
73    uint32_t current_dev;
74    union {
75       struct xattr_build_data_t *build;
76       struct xattr_parse_data_t *parse;
77    } u;
78 };
79
80 /*
81  * Maximum size of the XATTR stream this prevents us from blowing up the filed.
82  */
83 #define MAX_XATTR_STREAM  (1 * 1024 * 1024) /* 1 Mb */
84
85 /*
86  * Upperlimit on a xattr internal buffer
87  */
88 #define XATTR_BUFSIZ    1024
89
90 #endif