File: /usr/include/linux/lockd/xdr.h
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_MAXSTRLEN 1024
17
18 #define QUADLEN(len) (((len) + 3) >> 2)
19
20 #define nlm_granted __constant_htonl(NLM_LCK_GRANTED)
21 #define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED)
22 #define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS)
23 #define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED)
24 #define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD)
25
26 /* Lock info passed via NLM */
27 struct nlm_lock {
28 char * 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, Nobody uses over 8 bytes
36 * however.
37 */
38
39 struct nlm_cookie
40 {
41 unsigned char data[8];
42 unsigned int len;
43 };
44
45 /*
46 * Generic lockd arguments for all but sm_notify
47 */
48 struct nlm_args {
49 struct nlm_cookie cookie;
50 struct nlm_lock lock;
51 u32 block;
52 u32 reclaim;
53 u32 state;
54 u32 monitor;
55 u32 fsm_access;
56 u32 fsm_mode;
57 };
58
59 typedef struct nlm_args nlm_args;
60
61 /*
62 * Generic lockd result
63 */
64 struct nlm_res {
65 struct nlm_cookie cookie;
66 u32 status;
67 struct nlm_lock lock;
68 };
69
70 /*
71 * statd callback when client has rebooted
72 */
73 struct nlm_reboot {
74 char * mon;
75 int len;
76 u32 state;
77 u32 addr;
78 };
79
80 /*
81 * Contents of statd callback when monitored host rebooted
82 */
83 #define NLMSVC_XDRSIZE sizeof(struct nlm_args)
84
85 void nlmxdr_init(void);
86 int nlmsvc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *);
87 int nlmsvc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *);
88 int nlmsvc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *);
89 int nlmsvc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *);
90 int nlmsvc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *);
91 int nlmsvc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *);
92 int nlmsvc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *);
93 int nlmsvc_encode_void(struct svc_rqst *, u32 *, void *);
94 int nlmsvc_decode_void(struct svc_rqst *, u32 *, void *);
95 int nlmsvc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *);
96 int nlmsvc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *);
97 int nlmsvc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *);
98 int nlmsvc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *);
99 /*
100 int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
101 int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
102 int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *);
103 int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
104 */
105
106 #endif /* LOCKD_XDR_H */
107