summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ha/src/ha.h
blob: e732cfd08f0cd6e8f590b9b8a62bdb3bfdd0873e (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
/*
  Copyright (c) 2008-2012 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 __HA_H_
#define __HA_H_

#include "ha-mem-types.h"

typedef struct {
	call_stub_t *stub;
	int32_t op_ret, op_errno;
	int32_t active, tries, revalidate, revalidate_error;
	int32_t call_count;
	char *state, *pattern;
	dict_t *dict;
	loc_t loc;
	struct iatt buf;
        struct iatt postparent;
        struct iatt preparent;
	fd_t *fd;
	inode_t *inode;
	int32_t flags;
	int32_t first_success;
} ha_local_t;

typedef struct {
	char *state;
	xlator_t **children;
	int child_count, pref_subvol;
} ha_private_t;

typedef struct {
	char *fdstate;
	char *path;
	gf_lock_t lock;
	int active;
} hafd_t;

#define HA_ACTIVE_CHILD(this, local) (((ha_private_t *)this->private)->children[local->active])

extern int ha_alloc_init_fd (call_frame_t *frame, fd_t *fd);

extern int ha_handle_cbk (call_frame_t *frame, void *cookie, int op_ret, int op_errno) ;

extern int ha_alloc_init_inode (call_frame_t *frame, inode_t *inode);

#endif