Lines Matching refs:nsm
63 static inline struct sockaddr *nsm_addr(const struct nsm_handle *nsm) in nsm_addr() argument
65 return (struct sockaddr *)&nsm->sm_addr; in nsm_addr()
90 static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res, in nsm_mon_unmon() argument
96 .priv = &nsm->sm_priv, in nsm_mon_unmon()
100 .mon_name = nsm->sm_mon_name, in nsm_mon_unmon()
149 struct nsm_handle *nsm = host->h_nsmhandle; in nsm_monitor() local
153 dprintk("lockd: nsm_monitor(%s)\n", nsm->sm_name); in nsm_monitor()
155 if (nsm->sm_monitored) in nsm_monitor()
162 nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf; in nsm_monitor()
164 status = nsm_mon_unmon(nsm, NSMPROC_MON, &res, host); in nsm_monitor()
168 pr_notice_ratelimited("lockd: cannot monitor %s\n", nsm->sm_name); in nsm_monitor()
172 nsm->sm_monitored = 1; in nsm_monitor()
190 struct nsm_handle *nsm = host->h_nsmhandle; in nsm_unmonitor() local
194 if (refcount_read(&nsm->sm_count) == 1 in nsm_unmonitor()
195 && nsm->sm_monitored && !nsm->sm_sticky) { in nsm_unmonitor()
196 dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name); in nsm_unmonitor()
198 status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res, host); in nsm_unmonitor()
203 nsm->sm_name); in nsm_unmonitor()
205 nsm->sm_monitored = 0; in nsm_unmonitor()
212 struct nsm_handle *nsm; in nsm_lookup_hostname() local
214 list_for_each_entry(nsm, nsm_handles, sm_link) in nsm_lookup_hostname()
215 if (strlen(nsm->sm_name) == len && in nsm_lookup_hostname()
216 memcmp(nsm->sm_name, hostname, len) == 0) in nsm_lookup_hostname()
217 return nsm; in nsm_lookup_hostname()
224 struct nsm_handle *nsm; in nsm_lookup_addr() local
226 list_for_each_entry(nsm, nsm_handles, sm_link) in nsm_lookup_addr()
227 if (rpc_cmp_addr(nsm_addr(nsm), sap)) in nsm_lookup_addr()
228 return nsm; in nsm_lookup_addr()
235 struct nsm_handle *nsm; in nsm_lookup_priv() local
237 list_for_each_entry(nsm, nsm_handles, sm_link) in nsm_lookup_priv()
238 if (memcmp(nsm->sm_priv.data, priv->data, in nsm_lookup_priv()
240 return nsm; in nsm_lookup_priv()
261 static void nsm_init_private(struct nsm_handle *nsm) in nsm_init_private() argument
263 u64 *p = (u64 *)&nsm->sm_priv.data; in nsm_init_private()
268 put_unaligned((unsigned long)nsm, p + 1); in nsm_init_private()
408 void nsm_release(struct nsm_handle *nsm) in nsm_release() argument
410 if (refcount_dec_and_lock(&nsm->sm_count, &nsm_lock)) { in nsm_release()
411 list_del(&nsm->sm_link); in nsm_release()
414 nsm->sm_name, nsm->sm_addrbuf); in nsm_release()
415 kfree(nsm); in nsm_release()