klm_prot.x revision 1832
113901Salanb/*
213901Salanb * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
313901Salanb * unrestricted use provided that this legend is included on all tape
413901Salanb * media and as a part of the software program in whole or part.  Users
513901Salanb * may copy or modify Sun RPC without charge, but are not authorized
613901Salanb * to license or distribute it to anyone else except as part of a product or
713901Salanb * program developed by the user.
813901Salanb *
913901Salanb * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
1013901Salanb * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
1113901Salanb * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
1213901Salanb *
1313901Salanb * Sun RPC is provided with no support and without any obligation on the
1413901Salanb * part of Sun Microsystems, Inc. to assist in its use, correction,
1513901Salanb * modification or enhancement.
1613901Salanb *
1713901Salanb * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
1813901Salanb * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
1913901Salanb * OR ANY PART THEREOF.
2013901Salanb *
2113901Salanb * In no event will Sun Microsystems, Inc. be liable for any lost revenue
2213901Salanb * or profits or other special, indirect and consequential damages, even if
2313901Salanb * Sun has been advised of the possibility of such damages.
2413901Salanb *
2513901Salanb * Sun Microsystems, Inc.
2613901Salanb * 2550 Garcia Avenue
2713901Salanb * Mountain View, California  94043
2813901Salanb */
2913901Salanb
3013901Salanb/*
3113901Salanb * Kernel/lock manager protocol definition
3213901Salanb * Copyright (C) 1986 Sun Microsystems, Inc.
3313901Salanb *
34 * protocol used between the UNIX kernel (the "client") and the
35 * local lock manager.  The local lock manager is a deamon running
36 * above the kernel.
37 */
38
39#ifndef RPC_HDR
40%#ifndef lint
41%/*static char sccsid[] = "from: @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro";*/
42%/*static char sccsid[] = "from: @(#)klm_prot.x	2.1 88/08/01 4.0 RPCSRC";*/
43%static char rcsid[] = "$Id: klm_prot.x,v 1.1 1993/09/14 17:42:42 jtc Exp $";
44%#endif /* not lint */
45#endif
46
47const	LM_MAXSTRLEN = 1024;
48
49/*
50 * lock manager status returns
51 */
52enum klm_stats {
53	klm_granted = 0,	/* lock is granted */
54	klm_denied = 1,		/* lock is denied */
55	klm_denied_nolocks = 2, /* no lock entry available */
56	klm_working = 3 	/* lock is being processed */
57};
58
59/*
60 * lock manager lock identifier
61 */
62struct klm_lock {
63	string server_name<LM_MAXSTRLEN>;
64	netobj fh;		/* a counted file handle */
65	int pid;		/* holder of the lock */
66	unsigned l_offset;	/* beginning offset of the lock */
67	unsigned l_len;		/* byte length of the lock;
68				 * zero means through end of file */
69};
70
71/*
72 * lock holder identifier
73 */
74struct klm_holder {
75	bool exclusive;		/* FALSE if shared lock */
76	int svid;		/* holder of the lock (pid) */
77	unsigned l_offset;	/* beginning offset of the lock */
78	unsigned l_len;		/* byte length of the lock;
79				 * zero means through end of file */
80};
81
82/*
83 * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL
84 */
85struct klm_stat {
86	klm_stats stat;
87};
88
89/*
90 * reply to a KLM_TEST call
91 */
92union klm_testrply switch (klm_stats stat) {
93	case klm_denied:
94		struct klm_holder holder;
95	default: /* All other cases return no arguments */
96		void;
97};
98
99
100/*
101 * arguments to KLM_LOCK
102 */
103struct klm_lockargs {
104	bool block;
105	bool exclusive;
106	struct klm_lock alock;
107};
108
109/*
110 * arguments to KLM_TEST
111 */
112struct klm_testargs {
113	bool exclusive;
114	struct klm_lock alock;
115};
116
117/*
118 * arguments to KLM_UNLOCK
119 */
120struct klm_unlockargs {
121	struct klm_lock alock;
122};
123
124program KLM_PROG {
125	version KLM_VERS {
126
127		klm_testrply	KLM_TEST (struct klm_testargs) =	1;
128
129		klm_stat	KLM_LOCK (struct klm_lockargs) =	2;
130
131		klm_stat	KLM_CANCEL (struct klm_lockargs) =	3;
132		/* klm_granted=> the cancel request fails due to lock is already granted */
133		/* klm_denied=> the cancel request successfully aborts
134lock request  */
135
136		klm_stat	KLM_UNLOCK (struct klm_unlockargs) =	4;
137	} = 1;
138} = 100020;
139