aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lockd/xdr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/lockd/xdr.h')
-rw-r--r--include/linux/lockd/xdr.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
new file mode 100644
index 000000000000..d7a5cc4cfa97
--- /dev/null
+++ b/include/linux/lockd/xdr.h
@@ -0,0 +1,108 @@
1/*
2 * linux/include/linux/lockd/xdr.h
3 *
4 * XDR types for the NLM protocol
5 *
6 * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef LOCKD_XDR_H
10#define LOCKD_XDR_H
11
12#include <linux/fs.h>
13#include <linux/nfs.h>
14#include <linux/sunrpc/xdr.h>
15
16#define NLM_MAXCOOKIELEN 32
17#define NLM_MAXSTRLEN 1024
18
19#define nlm_granted __constant_htonl(NLM_LCK_GRANTED)
20#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED)
21#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS)
22#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED)
23#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD)
24
25/* Lock info passed via NLM */
26struct nlm_lock {
27 char * caller;
28 int len; /* length of "caller" */
29 struct nfs_fh fh;
30 struct xdr_netobj oh;
31 struct file_lock fl;
32};
33
34/*
35 * NLM cookies. Technically they can be 1K, but Linux only uses 8 bytes.
36 * FreeBSD uses 16, Apple Mac OS X 10.3 uses 20. Therefore we set it to
37 * 32 bytes.
38 */
39
40struct nlm_cookie
41{
42 unsigned char data[NLM_MAXCOOKIELEN];
43 unsigned int len;
44};
45
46/*
47 * Generic lockd arguments for all but sm_notify
48 */
49struct nlm_args {
50 struct nlm_cookie cookie;
51 struct nlm_lock lock;
52 u32 block;
53 u32 reclaim;
54 u32 state;
55 u32 monitor;
56 u32 fsm_access;
57 u32 fsm_mode;
58};
59
60typedef struct nlm_args nlm_args;
61
62/*
63 * Generic lockd result
64 */
65struct nlm_res {
66 struct nlm_cookie cookie;
67 u32 status;
68 struct nlm_lock lock;
69};
70
71/*
72 * statd callback when client has rebooted
73 */
74struct nlm_reboot {
75 char * mon;
76 int len;
77 u32 state;
78 u32 addr;
79 u32 vers;
80 u32 proto;
81};
82
83/*
84 * Contents of statd callback when monitored host rebooted
85 */
86#define NLMSVC_XDRSIZE sizeof(struct nlm_args)
87
88int nlmsvc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *);
89int nlmsvc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *);
90int nlmsvc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *);
91int nlmsvc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *);
92int nlmsvc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *);
93int nlmsvc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *);
94int nlmsvc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *);
95int nlmsvc_encode_void(struct svc_rqst *, u32 *, void *);
96int nlmsvc_decode_void(struct svc_rqst *, u32 *, void *);
97int nlmsvc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *);
98int nlmsvc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *);
99int nlmsvc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *);
100int nlmsvc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *);
101/*
102int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
103int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
104int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *);
105int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
106 */
107
108#endif /* LOCKD_XDR_H */