Documentation / sunrpc / xdr / nlm3.x


Based on kernel version 7.2. Page generated on 2026-08-20 08:41 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
/*
 * This file was extracted by hand from
 * https://pubs.opengroup.org/onlinepubs/9629799/chap10.htm#tagcjh_11_03
 */

/*
 * The NLMv3 protocol
 */

pragma header nlm3;

const LM_MAXSTRLEN = 1024;

const LM_MAXNAMELEN = 1025;

const MAXNETOBJ_SZ = 1024;

typedef opaque netobj<MAXNETOBJ_SZ>;

enum nlm_stats {
	LCK_GRANTED = 0,
	LCK_DENIED = 1,
	LCK_DENIED_NOLOCKS = 2,
	LCK_BLOCKED = 3,
	LCK_DENIED_GRACE_PERIOD = 4
};

pragma big_endian nlm_stats;

struct nlm_stat {
	nlm_stats	stat;
};

struct nlm_res {
	netobj		cookie;
	nlm_stat	stat;
};

struct nlm_holder {
	bool		exclusive;
	int		uppid;
	netobj		oh;
	unsigned int	l_offset;
	unsigned int	l_len;
};

union nlm_testrply switch (nlm_stats stat) {
	case LCK_DENIED:
		nlm_holder	holder;
	default:
		void;
};

struct nlm_testres {
	netobj		cookie;
	nlm_testrply	test_stat;
};

struct nlm_lock {
	string		caller_name<LM_MAXSTRLEN>;
	netobj		fh;
	netobj		oh;
	int		uppid;
	unsigned int	l_offset;
	unsigned int	l_len;
};

struct nlm_lockargs {
	netobj		cookie;
	bool		block;
	bool		exclusive;
	nlm_lock	alock;
	bool		reclaim;
	int		state;
};

struct nlm_cancargs {
	netobj		cookie;
	bool		block;
	bool		exclusive;
	nlm_lock	alock;
};

struct nlm_testargs {
	netobj		cookie;
	bool		exclusive;
	nlm_lock	alock;
};

struct nlm_unlockargs {
	netobj		cookie;
	nlm_lock	alock;
};

enum fsh_mode {
	fsm_DN = 0,
	fsm_DR = 1,
	fsm_DW = 2,
	fsm_DRW = 3
};

enum fsh_access {
	fsa_NONE = 0,
	fsa_R = 1,
	fsa_W = 2,
	fsa_RW = 3
};

struct nlm_share {
	string		caller_name<LM_MAXSTRLEN>;
	netobj		fh;
	netobj		oh;
	fsh_mode	mode;
	fsh_access	access;
};

struct nlm_shareargs {
	netobj		cookie;
	nlm_share	share;
	bool		reclaim;
};

struct nlm_shareres {
	netobj		cookie;
	nlm_stats	stat;
	int		sequence;
};

struct nlm_notify {
	string		name<LM_MAXNAMELEN>;
	long		state;
};

/*
 * Argument for the Linux-private SM_NOTIFY procedure
 */
const SM_PRIV_SIZE = 16;

struct nlm_notifyargs {
	nlm_notify	notify;
	opaque		private[SM_PRIV_SIZE];
};

program NLM_PROG {
	version NLM_VERS {
		void		NLM_NULL(void)				= 0;
		nlm_testres	NLM_TEST(nlm_testargs)			= 1;
		nlm_res		NLM_LOCK(nlm_lockargs)			= 2;
		nlm_res		NLM_CANCEL(nlm_cancargs)		= 3;
		nlm_res		NLM_UNLOCK(nlm_unlockargs)		= 4;
		nlm_res		NLM_GRANTED(nlm_testargs)		= 5;
		void		NLM_TEST_MSG(nlm_testargs)		= 6;
		void		NLM_LOCK_MSG(nlm_lockargs)		= 7;
		void		NLM_CANCEL_MSG(nlm_cancargs)		= 8;
		void		NLM_UNLOCK_MSG(nlm_unlockargs)		= 9;
		void		NLM_GRANTED_MSG(nlm_testargs)		= 10;
		void		NLM_TEST_RES(nlm_testres)		= 11;
		void		NLM_LOCK_RES(nlm_res)			= 12;
		void		NLM_CANCEL_RES(nlm_res)			= 13;
		void		NLM_UNLOCK_RES(nlm_res)			= 14;
		void		NLM_GRANTED_RES(nlm_res)		= 15;
		void		NLM_SM_NOTIFY(nlm_notifyargs)		= 16;
		nlm_shareres	NLM_SHARE(nlm_shareargs)		= 20;
		nlm_shareres	NLM_UNSHARE(nlm_shareargs)		= 21;
		nlm_res		NLM_NM_LOCK(nlm_lockargs)		= 22;
		void		NLM_FREE_ALL(nlm_notify)		= 23;
	} = 3;
} = 100021;