FreeBSD/sys/nlm/nlm_prot_impl.c
/*
 * This async callback after when an async lock request has been
 * granted. We notify the host which initiated the request.
 */
This async callback after when an async lock request has been
granted. We notify the host which initiated the request.
This async callback after when an async lock request has been granted . We notify the host which initiated the request .
static void
nlm_lock_callback(void *arg, int pending)
{
	struct nlm_async_lock *af = (struct nlm_async_lock *) arg;
	struct rpc_callextra ext;
	NLM_DEBUG(2, "NLM: async lock %p for %s (sysid %d) granted,"
	    " cookie %d:%d\n", af, af->af_host->nh_caller_name,
	    af->af_host->nh_sysid, ng_sysid(&af->af_granted.cookie),
	    ng_cookie(&af->af_granted.cookie));
	memset(&ext, 0, sizeof(ext));
	ext.rc_auth = nlm_auth;
	if (af->af_host->nh_vers == NLM_VERS4) {
		nlm4_granted_msg_4(&af->af_granted,
		    NULL, af->af_rpc, &ext, nlm_zero_tv);
	} else {
		nlm_testargs granted;
		granted.cookie = af->af_granted.cookie;
		granted.exclusive = af->af_granted.exclusive;
		granted.alock.caller_name =
			af->af_granted.alock.caller_name;
		granted.alock.fh = af->af_granted.alock.fh;
		granted.alock.oh = af->af_granted.alock.oh;
		granted.alock.svid = af->af_granted.alock.svid;
		granted.alock.l_offset =
			af->af_granted.alock.l_offset;
		granted.alock.l_len =
			af->af_granted.alock.l_len;
		nlm_granted_msg_1(&granted,
		    NULL, af->af_rpc, &ext, nlm_zero_tv);
	}
	af->af_expiretime = time_uptime + NLM_EXPIRE_TIMEOUT;
	mtx_lock(&af->af_host->nh_lock);
	TAILQ_REMOVE(&af->af_host->nh_pending, af, af_link);
	TAILQ_INSERT_TAIL(&af->af_host->nh_granted, af, af_link);
	mtx_unlock(&af->af_host->nh_lock);
}
static void nlm_lock_callback ( void * arg , int pending ) { struct nlm_async_lock * af = ( struct nlm_async_lock * ) arg ; struct rpc_callextra ext ; NLM_DEBUG ( 2 , " " " \n " , af , af -> af_host -> nh_caller_name , af -> af_host -> nh_sysid , ng_sysid ( & af -> af_granted . cookie ) , ng_cookie ( & af -> af_granted . cookie ) ) ; memset ( & ext , 0 , sizeof ( ext ) ) ; ext . rc_auth = nlm_auth ; if ( af -> af_host -> nh_vers == NLM_VERS4 ) { nlm4_granted_msg_4 ( & af -> af_granted , NULL , af -> af_rpc , & ext , nlm_zero_tv ) ; } else { nlm_testargs granted ; granted . cookie = af -> af_granted . cookie ; granted . exclusive = af -> af_granted . exclusive ; granted . alock . caller_name = af -> af_granted . alock . caller_name ; granted . alock . fh = af -> af_granted . alock . fh ; granted . alock . oh = af -> af_granted . alock . oh ; granted . alock . svid = af -> af_granted . alock . svid ; granted . alock . l_offset = af -> af_granted . alock . l_offset ; granted . alock . l_len = af -> af_granted . alock . l_len ; nlm_granted_msg_1 ( & granted , NULL , af -> af_rpc , & ext , nlm_zero_tv ) ; } af -> af_expiretime = time_uptime + NLM_EXPIRE_TIMEOUT ; mtx_lock ( & af -> af_host -> nh_lock ) ; TAILQ_REMOVE ( & af -> af_host -> nh_pending , af , af_link ) ; TAILQ_INSERT_TAIL ( & af -> af_host -> nh_granted , af , af_link ) ; mtx_unlock ( & af -> af_host -> nh_lock ) ; }
This async callback after when an async lock request has been
 granted.
This async callback after when an async lock request has been granted .
/*
	 * Send the results back to the host.
	 *
	 * Note: there is a possible race here with nlm_host_notify
	 * destroying the RPC client. To avoid problems, the first
	 * thing nlm_host_notify does is to cancel pending async lock
	 * requests.
	 */ /*
		 * Back-convert to legacy protocol
		 */ /*
	 * Move this entry to the nh_granted list.
	 */