summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nlm4.h
blob: 05c847c77380ed6327135e353d4d741526a020d4 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
  Copyright (c) 2012 Gluster, Inc. <http://www.gluster.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 _NLM4_H_
#define _NLM4_H_

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

#include <sys/types.h>
#include <signal.h>
#include "rpcsvc.h"
#include "dict.h"
#include "xlator.h"
#include "iobuf.h"
#include "nfs.h"
#include "list.h"
#include "xdr-nfs3.h"
#include "locking.h"
#include "nfs3-fh.h"
#include "uuid.h"
#include "nlm4-xdr.h"
#include "lkowner.h"

#define NLM4_NULL          0
#define NLM4_TEST          1
#define NLM4_LOCK          2
#define NLM4_CANCEL        3
#define NLM4_UNLOCK        4
#define NLM4_GRANTED       5
#define NLM4_TEST_MSG      6
#define NLM4_LOCK_MSG      7
#define NLM4_CANCEL_MSG    8
#define NLM4_UNLOCK_MSG    9
#define NLM4_GRANTED_MSG   10
#define NLM4_TEST_RES      11
#define NLM4_LOCK_RES      12
#define NLM4_CANCEL_RES    13
#define NLM4_UNLOCK_RES    14
#define NLM4_GRANTED_RES   15
#define NLM4_SM_NOTIFY     16
#define NLM4_SEVENTEEN     17
#define NLM4_EIGHTEEN      18
#define NLM4_NINETEEN      19
#define NLM4_SHARE         20
#define NLM4_UNSHARE       21
#define NLM4_NM_LOCK       22
#define NLM4_FREE_ALL      23
#define NLM4_PROC_COUNT    24

/* Registered with portmap */
#define GF_NLM4_PORT            38468
#define GF_NLM                  GF_NFS"-NLM"
#ifdef GF_DARWIN_HOST_OS
#define GF_RPC_STATD_PROG       "/usr/sbin/rpc.statd"
#define GF_RPC_STATD_PIDFILE    "/var/run/statd.pid"
#define GF_SM_NOTIFY_PIDFILE    "/var/run/statd.notify.pid"
#else
#define GF_RPC_STATD_PROG       "/sbin/rpc.statd"
#define GF_RPC_STATD_PIDFILE    "/var/run/rpc.statd.pid"
#define GF_SM_NOTIFY_PIDFILE    "/var/run/sm-notify.pid"
#endif

extern rpcsvc_program_t *
nlm4svc_init (xlator_t *nfsx);

extern int
nlm4_init_state (xlator_t *nfsx);

#define NLM_PROGRAM 100021
#define NLM_V4 4

typedef struct nlm4_lwowner {
        char temp[1024];
} nlm4_lkowner_t;

typedef struct nlm_client {
        struct sockaddr_storage sa;
        pid_t uniq;
        struct list_head nlm_clients;
        struct list_head fdes;
        struct list_head shares;
        struct rpc_clnt *rpc_clnt;
        char *caller_name;
        int nsm_monitor;
} nlm_client_t;

typedef struct nlm_share {
        struct list_head     client_list;
        struct list_head     inode_list;
        gf_lkowner_t         lkowner;
        inode_t             *inode;
        fsh_mode             mode;
        fsh_access           access;
} nlm_share_t;

typedef struct nlm_fde {
        struct list_head fde_list;
        fd_t *fd;
        int transit_cnt;
} nlm_fde_t;

#endif