9 #ifndef LINUX_LOCKD_LOCKD_H
10 #define LINUX_LOCKD_LOCKD_H
15 #include <linux/in6.h>
19 #include <linux/utsname.h>
20 #include <linux/nfsd/nfsfh.h>
23 #ifdef CONFIG_LOCKD_V4
31 #define LOCKD_VERSION "0.5"
36 #define LOCKD_DFLT_TIMEO 10
51 unsigned short h_reclaiming : 1,
62 unsigned long h_nextrebind;
63 unsigned long h_expires;
68 struct nsm_handle *h_nsmhandle;
79 #define NSM_ADDRBUF ((8 * 4 + 7) + (1 + 10) + 1)
88 unsigned int sm_monitored : 1,
91 char sm_addrbuf[NSM_ADDRBUF];
97 static inline struct sockaddr_in *nlm_addr_in(
const struct nlm_host *
host)
102 static inline struct sockaddr *nlm_addr(
const struct nlm_host *host)
104 return (
struct sockaddr *)&host->h_addr;
107 static inline struct sockaddr_in *nlm_srcaddr_in(
const struct nlm_host *host)
112 static inline struct sockaddr *nlm_srcaddr(
const struct nlm_host *host)
114 return (
struct sockaddr *)&host->h_srcaddr;
120 struct nlm_lockowner {
124 struct nlm_host *host;
134 #define NLMCLNT_OHSIZE ((__NEW_UTS_LEN) + 10u)
137 unsigned int a_flags;
138 struct nlm_host * a_host;
141 struct nlm_block * a_block;
142 unsigned int a_retries;
143 u8 a_owner[NLMCLNT_OHSIZE];
153 struct file * f_file;
156 unsigned int f_locks;
157 unsigned int f_count;
158 struct mutex f_mutex;
165 #define NLM_NEVER (~(unsigned long) 0)
167 #define NLM_TIMEOUT (7 * HZ)
173 struct nlm_rqst * b_call;
175 struct nlm_host * b_host;
176 unsigned long b_when;
178 unsigned char b_granted;
179 struct nlm_file * b_file;
183 unsigned int b_flags;
185 #define B_GOT_CALLBACK 2
186 #define B_TIMED_OUT 4
194 #ifdef CONFIG_LOCKD_V4
197 extern int nlmsvc_grace_period;
225 const char *hostname,
230 const char *hostname,
248 const char *hostname,
257 typedef int (*nlm_host_match_fn_t)(
void *
cur,
struct nlm_host *ref);
263 struct nlm_host *,
struct nlm_lock *,
int,
267 struct nlm_host *,
struct nlm_lock *,
272 nlm_host_match_fn_t
match);
292 static inline struct inode *nlmsvc_file_inode(
struct nlm_file *
file)
294 return file->f_file->f_path.dentry->d_inode;
297 static inline int __nlm_privileged_request4(
const struct sockaddr *sap)
304 return ipv4_is_loopback(sin->
sin_addr.s_addr);
307 #if IS_ENABLED(CONFIG_IPV6)
308 static inline int __nlm_privileged_request6(
const struct sockaddr *sap)
316 return ipv4_is_loopback(sin6->
sin6_addr.s6_addr32[3]);
321 static inline int __nlm_privileged_request6(
const struct sockaddr *sap)
333 static inline int nlm_privileged_requester(
const struct svc_rqst *rqstp)
335 const struct sockaddr *sap = svc_addr(rqstp);
339 return __nlm_privileged_request4(sap);
341 return __nlm_privileged_request6(sap);
351 static inline int nlm_compare_locks(
const struct file_lock *fl1,