summaryrefslogtreecommitdiffstats
path: root/xlators/features/thin-arbiter/src/thin-arbiter.h
blob: e5f914b84bf2b0b885bc3bc43652e01d856e7097 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
  Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
  This file is part of GlusterFS.

  This file is licensed to you under your choice of the GNU Lesser
  General Public License, version 3 or any later version (LGPLv3 or
  later), or the GNU General Public License, version 2 (GPLv2), in all
  cases as published by the Free Software Foundation.
*/

#ifndef _THIN_ARBITER_H
#define _THIN_ARBITER_H

#include <glusterfs/locking.h>
#include <glusterfs/common-utils.h>
#include <glusterfs/glusterfs.h>
#include <glusterfs/xlator.h>
#include <glusterfs/defaults.h>
#include <glusterfs/list.h>

#define THIN_ARBITER_SOURCE_XATTR "trusted.ta.source"
#define THIN_ARBITER_SOURCE_SIZE 2

#define TA_FAILED_FOP(fop, frame, op_errno)                                    \
    do {                                                                       \
        default_##fop##_failure_cbk(frame, op_errno);                          \
    } while (0)

#define TA_STACK_UNWIND(fop, frame, op_ret, op_errno, params...)               \
    do {                                                                       \
        ta_fop_t *__local = NULL;                                              \
        int32_t __op_ret = 0;                                                  \
        int32_t __op_errno = 0;                                                \
                                                                               \
        __local = frame->local;                                                \
        __op_ret = op_ret;                                                     \
        __op_errno = op_errno;                                                 \
        if (__local) {                                                         \
            ta_release_fop(__local);                                           \
            frame->local = NULL;                                               \
        }                                                                      \
        STACK_UNWIND_STRICT(fop, frame, __op_ret, __op_errno, params);         \
                                                                               \
    } while (0)

struct _ta_fop;
typedef struct _ta_fop ta_fop_t;

struct _ta_fop {
    gf_xattrop_flags_t xattrop_flags;
    loc_t loc;
    fd_t *fd;
    dict_t *dict;
    dict_t *brick_xattr;
    int32_t on_disk[2];
    int32_t idx;
};

#endif /* _THIN_ARBITER_H */