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