nlm_rpc_svc.c revision bbaa8b60dd95d714741fc474adad3cf710ef4efd
/*
* Copyright (c) 2008 Isilon Inc http://www.isilon.com/
* Authors: Doug Rabson <dfr@rabson.org>
* Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* NFS Lock Manager, RPC service functions (nlm_..._svc)
* Called via nlm_dispatch.c tables.
*
* Source code derived from FreeBSD nlm_prot_server.c
*
* The real service functions all use nlm4_... args and return
* data types. These wrappers convert older forms to and from
* the new forms and call the nlm_do_... service functions.
*/
#include <rpcsvc/nlm_prot.h>
#include "nlm_impl.h"
/*
* Convert between various versions of the protocol structures.
*/
/*
* Down-convert, for granted_1 call
*
* This converts a 64-bit lock to 32-bit form for our granted
* call-back when we're dealing with a 32-bit NLM client.
* Our NLM_LOCK handler ensures that any lock we grant to a
* 32-bit client can be represented in 32-bits. If the
* ASSERTs here fire, then the call to nlm_init_flock in
* nlm_do_lock has failed to restrict a 32-bit client to
* 32-bit lock ranges.
*/
static void
{
}
/*
* Up-convert for v1 svc functions with a 32-bit lock range arg.
* Note that lock range checks (like overflow) are done later,
* in nlm_init_flock().
*/
static void
{
}
static void
{
}
/*
* Down-convert for v1 NLM_TEST or NLM_TEST_MSG response.
* Note that nlm_do_test is careful to give us lock ranges
* that can be represented with 32-bit values. If the
* ASSERTs here fire, then the code in nlm_do_test that
* builds an nlm4_holder for a 32-bit client has failed to
* restrict the reported conflicting lock range so it's a
* valid 32-bit lock range.
*/
static void
{
}
static enum nlm_stats
{
if (src > nlm4_deadlck)
return (nlm_denied);
}
static void
{
}
/* ******************************************************************** */
/*
* Version 1 svc functions
*/
{
return (TRUE);
}
/*
* Callback functions for nlm_lock_1_svc
*/
{
/* NLM_LOCK */
/* for freeresult */
/* above does its own reply */
return (FALSE);
}
static bool_t
{
}
static enum clnt_stat
{
int rv;
/* NB: We have a result our caller will not free. */
(void) resp;
return (rv);
}
{
return (TRUE);
}
{
return (TRUE);
}
{
return (TRUE);
}
/*
* The _msg_ calls get no reply. Instead, these callers
* expect an RPC call to the corresponding _res function.
* We pass this callback function to nlm_do_test so it will
* use it to do the RPC callback, with the correct res type.
*
* The callback functions have nearly the same arg signature
* as the client call functions so that many of those can be
* optimized to nothing by the compiler. Also, passing the
* null result arg for these just to reduce warnings.
*
* See similar callbacks for other _msg functions below.
*/
{
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
static enum clnt_stat
{
}
/*
* Callback functions for nlm_lock_msg_1_svc
*/
{
/* NLM_LOCK_MSG */
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
static enum clnt_stat
{
}
static enum clnt_stat
{
}
{
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
static enum clnt_stat
{
}
{
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
static enum clnt_stat
{
}
{
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
static enum clnt_stat
{
}
/*
* The _res_ calls get no reply. These RPC calls are
* "call backs" in response to RPC _msg_ calls.
* We don't care about these responses.
*/
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/*
* Version 2 svc functions (used by local statd)
*/
{
return (TRUE);
}
{
return (TRUE);
}
/*
* Version 3 svc functions
*/
{
return (TRUE);
}
{
return (TRUE);
}
{
/*
* Don't allow blocking for non-monitored (nm_lock) calls.
* These clients don't handle any callbacks, including
* the granted call we make after a blocking lock.
* Same reply callback as nlm_lock_1_svc
*/
/* NLM_NM_LOCK */
NULL); /* indicates non-monitored */
/* for freeresult */
/* above does its own reply */
return (FALSE);
}
{
struct nlm4_notify args4;
return (TRUE);
}
/*
* Version 4 svc functions
*/
{
return (TRUE);
}
/*
* Callback functions for nlm4_lock_4_svc
*/
{
/* NLM4_LOCK */
/* above does its own reply */
return (FALSE);
}
static bool_t
{
}
static enum clnt_stat
{
int rv;
/* NB: We have a result our caller will not free. */
(void) resp;
return (rv);
}
{
return (TRUE);
}
{
return (TRUE);
}
{
return (TRUE);
}
{
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
/*
* Callback functions for nlm4_lock_msg_4_svc
* (using the RPC client stubs directly)
*/
{
/* NLM4_LOCK_MSG */
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
{
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
{
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
{
/* NB: We have a result our caller will not free. */
(void) resp;
/* The _msg_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
/* The _res_ calls get no reply. */
return (FALSE);
}
/* ARGSUSED */
{
return (TRUE);
}
/* ARGSUSED */
{
return (TRUE);
}
{
/*
* Don't allow blocking for non-monitored (nm_lock) calls.
* These clients don't handle any callbacks, including
* the granted call we make after a blocking lock.
* Same reply callback as nlm4_lock_4_svc
*/
/* NLM4_NM_LOCK */
NULL); /* indicates non-monitored */
/* above does its own reply */
return (FALSE);
}
{
return (TRUE);
}