xref: /linux/Documentation/sunrpc/xdr/nlm3.x (revision efe86f088f48f18c27b648e5724048947f3b7fb4)
1 /*
2  * This file was extracted by hand from
3  * https://pubs.opengroup.org/onlinepubs/9629799/chap10.htm#tagcjh_11_03
4  */
5 
6 /*
7  * The NLMv3 protocol
8  */
9 
10 pragma header nlm3;
11 
12 const LM_MAXSTRLEN = 1024;
13 
14 const LM_MAXNAMELEN = 1025;
15 
16 const MAXNETOBJ_SZ = 1024;
17 
18 typedef opaque netobj<MAXNETOBJ_SZ>;
19 
20 enum nlm_stats {
21 	LCK_GRANTED = 0,
22 	LCK_DENIED = 1,
23 	LCK_DENIED_NOLOCKS = 2,
24 	LCK_BLOCKED = 3,
25 	LCK_DENIED_GRACE_PERIOD = 4
26 };
27 
28 pragma big_endian nlm_stats;
29 
30 struct nlm_stat {
31 	nlm_stats	stat;
32 };
33 
34 struct nlm_res {
35 	netobj		cookie;
36 	nlm_stat	stat;
37 };
38 
39 struct nlm_holder {
40 	bool		exclusive;
41 	int		uppid;
42 	netobj		oh;
43 	unsigned int	l_offset;
44 	unsigned int	l_len;
45 };
46 
47 union nlm_testrply switch (nlm_stats stat) {
48 	case LCK_DENIED:
49 		nlm_holder	holder;
50 	default:
51 		void;
52 };
53 
54 struct nlm_testres {
55 	netobj		cookie;
56 	nlm_testrply	test_stat;
57 };
58 
59 struct nlm_lock {
60 	string		caller_name<LM_MAXSTRLEN>;
61 	netobj		fh;
62 	netobj		oh;
63 	int		uppid;
64 	unsigned int	l_offset;
65 	unsigned int	l_len;
66 };
67 
68 struct nlm_lockargs {
69 	netobj		cookie;
70 	bool		block;
71 	bool		exclusive;
72 	nlm_lock	alock;
73 	bool		reclaim;
74 	int		state;
75 };
76 
77 struct nlm_cancargs {
78 	netobj		cookie;
79 	bool		block;
80 	bool		exclusive;
81 	nlm_lock	alock;
82 };
83 
84 struct nlm_testargs {
85 	netobj		cookie;
86 	bool		exclusive;
87 	nlm_lock	alock;
88 };
89 
90 struct nlm_unlockargs {
91 	netobj		cookie;
92 	nlm_lock	alock;
93 };
94 
95 enum fsh_mode {
96 	fsm_DN = 0,
97 	fsm_DR = 1,
98 	fsm_DW = 2,
99 	fsm_DRW = 3
100 };
101 
102 enum fsh_access {
103 	fsa_NONE = 0,
104 	fsa_R = 1,
105 	fsa_W = 2,
106 	fsa_RW = 3
107 };
108 
109 struct nlm_share {
110 	string		caller_name<LM_MAXSTRLEN>;
111 	netobj		fh;
112 	netobj		oh;
113 	fsh_mode	mode;
114 	fsh_access	access;
115 };
116 
117 struct nlm_shareargs {
118 	netobj		cookie;
119 	nlm_share	share;
120 	bool		reclaim;
121 };
122 
123 struct nlm_shareres {
124 	netobj		cookie;
125 	nlm_stats	stat;
126 	int		sequence;
127 };
128 
129 struct nlm_notify {
130 	string		name<LM_MAXNAMELEN>;
131 	long		state;
132 };
133 
134 /*
135  * Argument for the Linux-private SM_NOTIFY procedure
136  */
137 const SM_PRIV_SIZE = 16;
138 
139 struct nlm_notifyargs {
140 	nlm_notify	notify;
141 	opaque		private[SM_PRIV_SIZE];
142 };
143 
144 program NLM_PROG {
145 	version NLM_VERS {
146 		void		NLM_NULL(void)				= 0;
147 		nlm_testres	NLM_TEST(nlm_testargs)			= 1;
148 		nlm_res		NLM_LOCK(nlm_lockargs)			= 2;
149 		nlm_res		NLM_CANCEL(nlm_cancargs)		= 3;
150 		nlm_res		NLM_UNLOCK(nlm_unlockargs)		= 4;
151 		nlm_res		NLM_GRANTED(nlm_testargs)		= 5;
152 		void		NLM_TEST_MSG(nlm_testargs)		= 6;
153 		void		NLM_LOCK_MSG(nlm_lockargs)		= 7;
154 		void		NLM_CANCEL_MSG(nlm_cancargs)		= 8;
155 		void		NLM_UNLOCK_MSG(nlm_unlockargs)		= 9;
156 		void		NLM_GRANTED_MSG(nlm_testargs)		= 10;
157 		void		NLM_TEST_RES(nlm_testres)		= 11;
158 		void		NLM_LOCK_RES(nlm_res)			= 12;
159 		void		NLM_CANCEL_RES(nlm_res)			= 13;
160 		void		NLM_UNLOCK_RES(nlm_res)			= 14;
161 		void		NLM_GRANTED_RES(nlm_res)		= 15;
162 		void		NLM_SM_NOTIFY(nlm_notifyargs)		= 16;
163 		nlm_shareres	NLM_SHARE(nlm_shareargs)		= 20;
164 		nlm_shareres	NLM_UNSHARE(nlm_shareargs)		= 21;
165 		nlm_res		NLM_NM_LOCK(nlm_lockargs)		= 22;
166 		void		NLM_FREE_ALL(nlm_notify)		= 23;
167 	} = 3;
168 } = 100021;
169