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
60
61
62
63
64
65
66
67
68
69
70
71
72
  | 
/*
   Copyright (c) 2013 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 _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif
#include "xlator.h"
#include "defaults.h"
#include "logging.h"
#include "changelog-rt.h"
#include "changelog-mem-types.h"
int
changelog_rt_init (xlator_t *this, changelog_dispatcher_t *cd)
{
        changelog_rt_t *crt = NULL;
        crt = GF_CALLOC (1, sizeof (*crt),
                         gf_changelog_mt_rt_t);
        if (!crt)
                return -1;
        LOCK_INIT (&crt->lock);
        cd->cd_data = crt;
        cd->dispatchfn = &changelog_rt_enqueue;
        return 0;
}
int
changelog_rt_fini (xlator_t *this, changelog_dispatcher_t *cd)
{
        changelog_rt_t *crt = NULL;
        crt = cd->cd_data;
        LOCK_DESTROY (&crt->lock);
        GF_FREE (crt);
        return 0;
}
int
changelog_rt_enqueue (xlator_t *this, changelog_priv_t *priv, void *cbatch,
                      changelog_log_data_t *cld_0, changelog_log_data_t *cld_1)
{
        int             ret = 0;
        changelog_rt_t *crt = NULL;
        crt = (changelog_rt_t *) cbatch;
        LOCK (&crt->lock);
        {
                ret = changelog_handle_change (this, priv, cld_0);
                if (!ret && cld_1)
                        ret = changelog_handle_change (this, priv, cld_1);
        }
        UNLOCK (&crt->lock);
        return ret;
}
  |