11832Swollman/* 21832Swollman * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 31832Swollman * unrestricted use provided that this legend is included on all tape 41832Swollman * media and as a part of the software program in whole or part. Users 51832Swollman * may copy or modify Sun RPC without charge, but are not authorized 61832Swollman * to license or distribute it to anyone else except as part of a product or 71832Swollman * program developed by the user. 81832Swollman * 91832Swollman * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 101832Swollman * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 111832Swollman * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 121832Swollman * 131832Swollman * Sun RPC is provided with no support and without any obligation on the 141832Swollman * part of Sun Microsystems, Inc. to assist in its use, correction, 151832Swollman * modification or enhancement. 161832Swollman * 171832Swollman * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 181832Swollman * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 191832Swollman * OR ANY PART THEREOF. 201832Swollman * 211832Swollman * In no event will Sun Microsystems, Inc. be liable for any lost revenue 221832Swollman * or profits or other special, indirect and consequential damages, even if 231832Swollman * Sun has been advised of the possibility of such damages. 241832Swollman * 251832Swollman * Sun Microsystems, Inc. 261832Swollman * 2550 Garcia Avenue 271832Swollman * Mountain View, California 94043 281832Swollman */ 291832Swollman 301832Swollman/* 311832Swollman * Kernel/lock manager protocol definition 321832Swollman * Copyright (C) 1986 Sun Microsystems, Inc. 331832Swollman * 341832Swollman * protocol used between the UNIX kernel (the "client") and the 351832Swollman * local lock manager. The local lock manager is a deamon running 361832Swollman * above the kernel. 371832Swollman */ 381832Swollman 391832Swollman#ifndef RPC_HDR 401832Swollman%#ifndef lint 411832Swollman%/*static char sccsid[] = "from: @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro";*/ 421832Swollman%/*static char sccsid[] = "from: @(#)klm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ 431832Swollman%#endif /* not lint */ 44114629Sobrien%#include <sys/cdefs.h> 45114629Sobrien%__FBSDID("$FreeBSD$"); 461832Swollman#endif 471832Swollman 481832Swollmanconst LM_MAXSTRLEN = 1024; 491832Swollman 501832Swollman/* 511832Swollman * lock manager status returns 521832Swollman */ 531832Swollmanenum klm_stats { 541832Swollman klm_granted = 0, /* lock is granted */ 551832Swollman klm_denied = 1, /* lock is denied */ 561832Swollman klm_denied_nolocks = 2, /* no lock entry available */ 571832Swollman klm_working = 3 /* lock is being processed */ 581832Swollman}; 591832Swollman 601832Swollman/* 611832Swollman * lock manager lock identifier 621832Swollman */ 631832Swollmanstruct klm_lock { 641832Swollman string server_name<LM_MAXSTRLEN>; 651832Swollman netobj fh; /* a counted file handle */ 661832Swollman int pid; /* holder of the lock */ 671832Swollman unsigned l_offset; /* beginning offset of the lock */ 681832Swollman unsigned l_len; /* byte length of the lock; 691832Swollman * zero means through end of file */ 701832Swollman}; 711832Swollman 721832Swollman/* 731832Swollman * lock holder identifier 741832Swollman */ 751832Swollmanstruct klm_holder { 761832Swollman bool exclusive; /* FALSE if shared lock */ 771832Swollman int svid; /* holder of the lock (pid) */ 781832Swollman unsigned l_offset; /* beginning offset of the lock */ 791832Swollman unsigned l_len; /* byte length of the lock; 801832Swollman * zero means through end of file */ 811832Swollman}; 821832Swollman 831832Swollman/* 841832Swollman * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL 851832Swollman */ 861832Swollmanstruct klm_stat { 871832Swollman klm_stats stat; 881832Swollman}; 891832Swollman 901832Swollman/* 911832Swollman * reply to a KLM_TEST call 921832Swollman */ 931832Swollmanunion klm_testrply switch (klm_stats stat) { 941832Swollman case klm_denied: 951832Swollman struct klm_holder holder; 961832Swollman default: /* All other cases return no arguments */ 971832Swollman void; 981832Swollman}; 991832Swollman 1001832Swollman 1011832Swollman/* 1021832Swollman * arguments to KLM_LOCK 1031832Swollman */ 1041832Swollmanstruct klm_lockargs { 1051832Swollman bool block; 1061832Swollman bool exclusive; 1071832Swollman struct klm_lock alock; 1081832Swollman}; 1091832Swollman 1101832Swollman/* 1111832Swollman * arguments to KLM_TEST 1121832Swollman */ 1131832Swollmanstruct klm_testargs { 1141832Swollman bool exclusive; 1151832Swollman struct klm_lock alock; 1161832Swollman}; 1171832Swollman 1181832Swollman/* 1191832Swollman * arguments to KLM_UNLOCK 1201832Swollman */ 1211832Swollmanstruct klm_unlockargs { 1221832Swollman struct klm_lock alock; 1231832Swollman}; 1241832Swollman 1251832Swollmanprogram KLM_PROG { 1261832Swollman version KLM_VERS { 1271832Swollman 1281832Swollman klm_testrply KLM_TEST (struct klm_testargs) = 1; 1291832Swollman 1301832Swollman klm_stat KLM_LOCK (struct klm_lockargs) = 2; 1311832Swollman 1321832Swollman klm_stat KLM_CANCEL (struct klm_lockargs) = 3; 1331832Swollman /* klm_granted=> the cancel request fails due to lock is already granted */ 1341832Swollman /* klm_denied=> the cancel request successfully aborts 1351832Swollmanlock request */ 1361832Swollman 1371832Swollman klm_stat KLM_UNLOCK (struct klm_unlockargs) = 4; 1381832Swollman } = 1; 1391832Swollman} = 100020; 140