nlm_prot.x 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /* @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC */
  2. /* @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro */
  3. /*
  4. * Network lock manager protocol definition
  5. * Copyright (C) 1986 Sun Microsystems, Inc.
  6. *
  7. * protocol used between local lock manager and remote lock manager
  8. */
  9. #ifdef RPC_HDR
  10. %#define LM_MAXSTRLEN 1024
  11. %#define MAXNAMELEN LM_MAXSTRLEN+1
  12. #endif
  13. /*
  14. * status of a call to the lock manager
  15. */
  16. enum nlm_stats {
  17. nlm_granted = 0,
  18. nlm_denied = 1,
  19. nlm_denied_nolocks = 2,
  20. nlm_blocked = 3,
  21. nlm_denied_grace_period = 4
  22. };
  23. struct nlm_holder {
  24. bool exclusive;
  25. int svid;
  26. netobj oh;
  27. unsigned l_offset;
  28. unsigned l_len;
  29. };
  30. union nlm_testrply switch (nlm_stats stat) {
  31. case nlm_denied:
  32. struct nlm_holder holder;
  33. default:
  34. void;
  35. };
  36. struct nlm_stat {
  37. nlm_stats stat;
  38. };
  39. struct nlm_res {
  40. netobj cookie;
  41. nlm_stat stat;
  42. };
  43. struct nlm_testres {
  44. netobj cookie;
  45. nlm_testrply stat;
  46. };
  47. struct nlm_lock {
  48. string caller_name<LM_MAXSTRLEN>;
  49. netobj fh; /* identify a file */
  50. netobj oh; /* identify owner of a lock */
  51. int svid; /* generated from pid for svid */
  52. unsigned l_offset;
  53. unsigned l_len;
  54. };
  55. struct nlm_lockargs {
  56. netobj cookie;
  57. bool block;
  58. bool exclusive;
  59. struct nlm_lock alock;
  60. bool reclaim; /* used for recovering locks */
  61. int state; /* specify local status monitor state */
  62. };
  63. struct nlm_cancargs {
  64. netobj cookie;
  65. bool block;
  66. bool exclusive;
  67. struct nlm_lock alock;
  68. };
  69. struct nlm_testargs {
  70. netobj cookie;
  71. bool exclusive;
  72. struct nlm_lock alock;
  73. };
  74. struct nlm_unlockargs {
  75. netobj cookie;
  76. struct nlm_lock alock;
  77. };
  78. #ifdef RPC_HDR
  79. %/*
  80. % * The following enums are actually bit encoded for efficient
  81. % * boolean algebra.... DON'T change them.....
  82. % */
  83. #endif
  84. enum fsh_mode {
  85. fsm_DN = 0, /* deny none */
  86. fsm_DR = 1, /* deny read */
  87. fsm_DW = 2, /* deny write */
  88. fsm_DRW = 3 /* deny read/write */
  89. };
  90. enum fsh_access {
  91. fsa_NONE = 0, /* for completeness */
  92. fsa_R = 1, /* read only */
  93. fsa_W = 2, /* write only */
  94. fsa_RW = 3 /* read/write */
  95. };
  96. struct nlm_share {
  97. string caller_name<LM_MAXSTRLEN>;
  98. netobj fh;
  99. netobj oh;
  100. fsh_mode mode;
  101. fsh_access access;
  102. };
  103. struct nlm_shareargs {
  104. netobj cookie;
  105. nlm_share share;
  106. bool reclaim;
  107. };
  108. struct nlm_shareres {
  109. netobj cookie;
  110. nlm_stats stat;
  111. int sequence;
  112. };
  113. struct nlm_notify {
  114. string name<MAXNAMELEN>;
  115. long state;
  116. };
  117. /*
  118. * Over-the-wire protocol used between the network lock managers
  119. */
  120. program NLM_PROG {
  121. version NLM_VERS {
  122. nlm_testres NLM_TEST(struct nlm_testargs) = 1;
  123. nlm_res NLM_LOCK(struct nlm_lockargs) = 2;
  124. nlm_res NLM_CANCEL(struct nlm_cancargs) = 3;
  125. nlm_res NLM_UNLOCK(struct nlm_unlockargs) = 4;
  126. /*
  127. * remote lock manager call-back to grant lock
  128. */
  129. nlm_res NLM_GRANTED(struct nlm_testargs)= 5;
  130. /*
  131. * message passing style of requesting lock
  132. */
  133. void NLM_TEST_MSG(struct nlm_testargs) = 6;
  134. void NLM_LOCK_MSG(struct nlm_lockargs) = 7;
  135. void NLM_CANCEL_MSG(struct nlm_cancargs) =8;
  136. void NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
  137. void NLM_GRANTED_MSG(struct nlm_testargs) = 10;
  138. void NLM_TEST_RES(nlm_testres) = 11;
  139. void NLM_LOCK_RES(nlm_res) = 12;
  140. void NLM_CANCEL_RES(nlm_res) = 13;
  141. void NLM_UNLOCK_RES(nlm_res) = 14;
  142. void NLM_GRANTED_RES(nlm_res) = 15;
  143. } = 1;
  144. version NLM_VERSX {
  145. nlm_shareres NLM_SHARE(nlm_shareargs) = 20;
  146. nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21;
  147. nlm_res NLM_NM_LOCK(nlm_lockargs) = 22;
  148. void NLM_FREE_ALL(nlm_notify) = 23;
  149. } = 3;
  150. } = 100021;