get rid of NR_OPEN and introduce a sysctl_nr_open
[linux-2.6-block.git] / include / linux / lockd / xdr.h
CommitLineData
1da177e4
LT
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
d343fce1
N
16struct svc_rqst;
17
1da177e4
LT
18#define NLM_MAXCOOKIELEN 32
19#define NLM_MAXSTRLEN 1024
20
21#define nlm_granted __constant_htonl(NLM_LCK_GRANTED)
22#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED)
23#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS)
24#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED)
25#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD)
26
d343fce1
N
27#define nlm_drop_reply __constant_htonl(30000)
28
1da177e4
LT
29/* Lock info passed via NLM */
30struct nlm_lock {
31 char * caller;
48df020a 32 unsigned int len; /* length of "caller" */
1da177e4
LT
33 struct nfs_fh fh;
34 struct xdr_netobj oh;
7bab377f 35 u32 svid;
1da177e4
LT
36 struct file_lock fl;
37};
38
39/*
40 * NLM cookies. Technically they can be 1K, but Linux only uses 8 bytes.
41 * FreeBSD uses 16, Apple Mac OS X 10.3 uses 20. Therefore we set it to
42 * 32 bytes.
43 */
44
45struct nlm_cookie
46{
47 unsigned char data[NLM_MAXCOOKIELEN];
48 unsigned int len;
49};
50
51/*
52 * Generic lockd arguments for all but sm_notify
53 */
54struct nlm_args {
55 struct nlm_cookie cookie;
56 struct nlm_lock lock;
57 u32 block;
58 u32 reclaim;
59 u32 state;
60 u32 monitor;
61 u32 fsm_access;
62 u32 fsm_mode;
63};
64
65typedef struct nlm_args nlm_args;
66
67/*
68 * Generic lockd result
69 */
70struct nlm_res {
71 struct nlm_cookie cookie;
e8c5c045 72 __be32 status;
1da177e4
LT
73 struct nlm_lock lock;
74};
75
76/*
77 * statd callback when client has rebooted
78 */
79struct nlm_reboot {
80 char * mon;
48df020a 81 unsigned int len;
1da177e4 82 u32 state;
e8c5c045
AV
83 __be32 addr;
84 __be32 vers;
85 __be32 proto;
1da177e4
LT
86};
87
88/*
89 * Contents of statd callback when monitored host rebooted
90 */
91#define NLMSVC_XDRSIZE sizeof(struct nlm_args)
92
52921e02
AV
93int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
94int nlmsvc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
95int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
96int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
97int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
98int nlmsvc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
99int nlmsvc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
100int nlmsvc_encode_void(struct svc_rqst *, __be32 *, void *);
101int nlmsvc_decode_void(struct svc_rqst *, __be32 *, void *);
102int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
103int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
104int nlmsvc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
105int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
1da177e4
LT
106/*
107int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
108int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
109int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *);
110int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
111 */
112
113#endif /* LOCKD_XDR_H */