X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=nlm%2Fnlm.x;h=0f934212281f62dba21cad3d2d9d814ad015e011;hb=2f5c161b4456e5f77bf9beccd8dcb3739898b1cf;hp=ee86df5f4626f32a6a009995a0a09a4d2bfed0c5;hpb=6916a66546035da5c1c82c3c85e387061a758b74;p=deb_libnfs.git diff --git a/nlm/nlm.x b/nlm/nlm.x index ee86df5..0f93421 100644 --- a/nlm/nlm.x +++ b/nlm/nlm.x @@ -1,7 +1,43 @@ -/* based on rfc1813 and wireshark */ +/* +Copyright (c) 2014, Ronnie Sahlberg +All rights reserved. + +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 documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + +typedef unsigned hyper uint64; + +struct nlm_fh4 { + opaque data<>; +}; + +typedef string nlm4_oh<>; -const COOKIESIZE = 4; -typedef opaque nlm_cookie[COOKIESIZE]; +struct nlm_cookie { + opaque data<>; +}; enum nlmstat4 { NLM4_GRANTED = 0, @@ -17,99 +53,149 @@ enum nlmstat4 { }; struct nlm4_holder { - bool exclusive; - unsigned int svid; - netobj oh; - unsigned hyper l_offset; - unsigned hyper l_len; + bool exclusive; + unsigned int svid; + nlm4_oh oh; + uint64 l_offset; + uint64 l_len; }; const NLM_MAXNAME = 256; struct nlm4_lock { - string caller_name; - netobj fh; - netobj oh; - unsigned int svid; - unsigned hyper l_offset; - unsigned hyper l_len; + string caller_name; + struct nlm_fh4 fh; + nlm4_oh oh; + unsigned int svid; + uint64 l_offset; + uint64 l_len; }; struct nlm4_share { - string caller_name; - netobj fh; - netobj oh; - unsigned int mode; - unsigned int access; + string caller_name; + struct nlm_fh4 fh; + nlm4_oh oh; + unsigned int mode; + unsigned int access; }; - -struct nlm4_testres_ok { - nlm_cookie cookie; +struct nlm4_testres_denied { nlm4_holder holder; }; -union nlm4_testres switch (nlmstat4 nlm_status) { - case NLM4_GRANTED: - nlm4_testres_ok lock; +union nlm4_testreply switch (nlmstat4 status) { + case NLM4_DENIED: + nlm4_testres_denied lock; default: void; }; -struct nlm4_testargs { +struct NLM4_TESTres { + nlm_cookie cookie; + nlm4_testreply reply; +}; + +struct NLM4_TESTargs { nlm_cookie cookie; bool exclusive; nlm4_lock lock; }; +struct NLM4_CANCres { + nlm_cookie cookie; + nlmstat4 status; +}; + +struct NLM4_CANCargs { + nlm_cookie cookie; + bool block; + bool exclusive; + nlm4_lock lock; +}; + +struct NLM4_UNLOCKres { + nlm_cookie cookie; + nlmstat4 status; +}; + +struct NLM4_UNLOCKargs { + nlm_cookie cookie; + nlm4_lock lock; +}; + +struct NLM4_LOCKres { + nlm_cookie cookie; + nlmstat4 status; +}; + +struct NLM4_LOCKargs { + nlm_cookie cookie; + bool block; + bool exclusive; + nlm4_lock lock; + bool reclaim; + int state; +}; + +struct NLM4_GRANTEDargs { + nlm_cookie cookie; + bool exclusive; + nlm4_lock lock; +}; + +struct NLM4_GRANTEDres { + nlm_cookie cookie; + nlmstat4 status; +}; + program NLM_PROGRAM { version NLM_V4 { void NLM4_NULL(void) = 0; - nlm4_testres - NLM4_TEST(nlm4_testargs) = 1; + NLM4_TESTres + NLM4_TEST(NLM4_TESTargs) = 1; -/* nlm4_res */ -/* NLM4_LOCK(nlm4_lockargs) = 2; */ + NLM4_LOCKres + NLM4_LOCK(NLM4_LOCKargs) = 2; -/* nlm4_res */ -/* NLM4_CANCEL(nlm4_cancargs) = 3; */ + NLM4_CANCres + NLM4_CANCEL(NLM4_CANCargs) = 3; -/* nlm4_res */ -/* NLM4_UNLOCK(nlm4_unlockargs) = 4; */ + NLM4_UNLOCKres + NLM4_UNLOCK(NLM4_UNLOCKargs) = 4; -/* nlm4_res */ -/* NLM4_GRANTED(nlm4_testargs) = 5; */ + NLM4_GRANTEDres + NLM4_GRANT(NLM4_GRANTEDargs) = 5; -/* void */ -/* NLM4_TEST_MSG(nlm4_testargs) = 6; */ + void + NLM4_TEST_MSG(NLM4_TESTargs) = 6; -/* void */ -/* NLM4_LOCK_MSG(nlm4_lockargs) = 7; */ + void + NLM4_LOCK_MSG(NLM4_LOCKargs) = 7; -/* void */ -/* NLM4_CANCEL_MSG(nlm4_cancargs) = 8; */ + void + NLM4_CANCEL_MSG(NLM4_CANCargs) = 8; -/* void */ -/* NLM4_UNLOCK_MSG(nlm4_unlockargs) = 9; */ + void + NLM4_UNLOCK_MSG(NLM4_UNLOCKargs) = 9; -/* void */ -/* NLM4_GRANTED_MSG(nlm4_testargs) = 10; */ + void + NLM4_GRANT_MSG(NLM4_GRANTEDargs) = 10; -/* void */ -/* NLM4_TEST_RES(nlm4_testres) = 11; */ + void + NLM4_TEST_RES(NLM4_TESTres) = 11; -/* void */ -/* NLM4_LOCK_RES(nlm4_res) = 12; */ + void + NLM4_LOCK_RES(NLM4_LOCKres) = 12; -/* void */ -/* NLM4_CANCEL_RES(nlm4_res) = 13; */ + void + NLM4_CANCEL_RES(NLM4_CANCres) = 13; -/* void */ -/* NLM4_UNLOCK_RES(nlm4_res) = 14; */ + void + NLM4_UNLOCK_RES(NLM4_UNLOCKres) = 14; -/* void */ -/* NLM4_GRANTED_RES(nlm4_res) = 15; */ + void + NLM4_GRANT_RES(NLM4_GRANTEDres) = 15; /* nlm4_shareres */ /* NLM4_SHARE(nlm4_shareargs) = 20; */