summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/lock-table.h
blob: 4a9083873f3d68bfa258afaa4d3a13275fe08a79 (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 _LOCK_TABLE_H
#define _LOCK_TABLE_H

#ifndef _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif

#include "xlator.h"

struct _locker {
        struct list_head  lockers;
        char             *volume;
        loc_t             loc;
        fd_t             *fd;
        gf_lkowner_t      owner;
        pid_t             pid;
};

struct _lock_table {
        struct list_head  inodelk_lockers;
        struct list_head  entrylk_lockers;
        gf_lock_t         lock;
};

int32_t
gf_add_locker (struct _lock_table *table, const char *volume,
               loc_t *loc,
               fd_t *fd,
               pid_t pid,
               gf_lkowner_t *owner,
               glusterfs_fop_t type);

int32_t
gf_del_locker (struct _lock_table *table, const char *volume,
               loc_t *loc,
               fd_t *fd,
               gf_lkowner_t *owner,
               glusterfs_fop_t type);

struct _lock_table *
gf_lock_table_new (void);

#endif /* _LOCK_TABLE_H */