nlm_prot.x 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /* @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC */
  2. /*
  3. * Network lock manager protocol definition
  4. * Copyright (c) 2010, Oracle America, Inc.
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are
  7. * met:
  8. *
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * * Redistributions in binary form must reproduce the above
  12. * copyright notice, this list of conditions and the following
  13. * disclaimer in the documentation and/or other materials
  14. * provided with the distribution.
  15. * * Neither the name of the "Oracle America, Inc." nor the names of its
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  24. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  26. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  29. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. * protocol used between local lock manager and remote lock manager
  33. */
  34. #ifdef RPC_HDR
  35. %#define LM_MAXSTRLEN 1024
  36. %#define MAXNAMELEN LM_MAXSTRLEN+1
  37. #endif
  38. /*
  39. * status of a call to the lock manager
  40. */
  41. enum nlm_stats {
  42. nlm_granted = 0,
  43. nlm_denied = 1,
  44. nlm_denied_nolocks = 2,
  45. nlm_blocked = 3,
  46. nlm_denied_grace_period = 4
  47. };
  48. struct nlm_holder {
  49. bool exclusive;
  50. int svid;
  51. netobj oh;
  52. unsigned l_offset;
  53. unsigned l_len;
  54. };
  55. union nlm_testrply switch (nlm_stats stat) {
  56. case nlm_denied:
  57. struct nlm_holder holder;
  58. default:
  59. void;
  60. };
  61. struct nlm_stat {
  62. nlm_stats stat;
  63. };
  64. struct nlm_res {
  65. netobj cookie;
  66. nlm_stat stat;
  67. };
  68. struct nlm_testres {
  69. netobj cookie;
  70. nlm_testrply stat;
  71. };
  72. struct nlm_lock {
  73. string caller_name<LM_MAXSTRLEN>;
  74. netobj fh; /* identify a file */
  75. netobj oh; /* identify owner of a lock */
  76. int svid; /* generated from pid for svid */
  77. unsigned l_offset;
  78. unsigned l_len;
  79. };
  80. struct nlm_lockargs {
  81. netobj cookie;
  82. bool block;
  83. bool exclusive;
  84. struct nlm_lock alock;
  85. bool reclaim; /* used for recovering locks */
  86. int state; /* specify local status monitor state */
  87. };
  88. struct nlm_cancargs {
  89. netobj cookie;
  90. bool block;
  91. bool exclusive;
  92. struct nlm_lock alock;
  93. };
  94. struct nlm_testargs {
  95. netobj cookie;
  96. bool exclusive;
  97. struct nlm_lock alock;
  98. };
  99. struct nlm_unlockargs {
  100. netobj cookie;
  101. struct nlm_lock alock;
  102. };
  103. #ifdef RPC_HDR
  104. %/*
  105. % * The following enums are actually bit encoded for efficient
  106. % * boolean algebra.... DON'T change them.....
  107. % */
  108. #endif
  109. enum fsh_mode {
  110. fsm_DN = 0, /* deny none */
  111. fsm_DR = 1, /* deny read */
  112. fsm_DW = 2, /* deny write */
  113. fsm_DRW = 3 /* deny read/write */
  114. };
  115. enum fsh_access {
  116. fsa_NONE = 0, /* for completeness */
  117. fsa_R = 1, /* read only */
  118. fsa_W = 2, /* write only */
  119. fsa_RW = 3 /* read/write */
  120. };
  121. struct nlm_share {
  122. string caller_name<LM_MAXSTRLEN>;
  123. netobj fh;
  124. netobj oh;
  125. fsh_mode mode;
  126. fsh_access access;
  127. };
  128. struct nlm_shareargs {
  129. netobj cookie;
  130. nlm_share share;
  131. bool reclaim;
  132. };
  133. struct nlm_shareres {
  134. netobj cookie;
  135. nlm_stats stat;
  136. int sequence;
  137. };
  138. struct nlm_notify {
  139. string name<MAXNAMELEN>;
  140. long state;
  141. };
  142. /*
  143. * Over-the-wire protocol used between the network lock managers
  144. */
  145. program NLM_PROG {
  146. version NLM_VERS {
  147. nlm_testres NLM_TEST(struct nlm_testargs) = 1;
  148. nlm_res NLM_LOCK(struct nlm_lockargs) = 2;
  149. nlm_res NLM_CANCEL(struct nlm_cancargs) = 3;
  150. nlm_res NLM_UNLOCK(struct nlm_unlockargs) = 4;
  151. /*
  152. * remote lock manager call-back to grant lock
  153. */
  154. nlm_res NLM_GRANTED(struct nlm_testargs)= 5;
  155. /*
  156. * message passing style of requesting lock
  157. */
  158. void NLM_TEST_MSG(struct nlm_testargs) = 6;
  159. void NLM_LOCK_MSG(struct nlm_lockargs) = 7;
  160. void NLM_CANCEL_MSG(struct nlm_cancargs) =8;
  161. void NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
  162. void NLM_GRANTED_MSG(struct nlm_testargs) = 10;
  163. void NLM_TEST_RES(nlm_testres) = 11;
  164. void NLM_LOCK_RES(nlm_res) = 12;
  165. void NLM_CANCEL_RES(nlm_res) = 13;
  166. void NLM_UNLOCK_RES(nlm_res) = 14;
  167. void NLM_GRANTED_RES(nlm_res) = 15;
  168. } = 1;
  169. version NLM_VERSX {
  170. nlm_shareres NLM_SHARE(nlm_shareargs) = 20;
  171. nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21;
  172. nlm_res NLM_NM_LOCK(nlm_lockargs) = 22;
  173. void NLM_FREE_ALL(nlm_notify) = 23;
  174. } = 3;
  175. } = 100021;