at v2.6.21 3.1 kB view raw
1/* 2 * linux/include/linux/lockd/xdr.h 3 * 4 * XDR types for the NLM protocol 5 * 6 * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de> 7 */ 8 9#ifndef LOCKD_XDR_H 10#define LOCKD_XDR_H 11 12#include <linux/fs.h> 13#include <linux/nfs.h> 14#include <linux/sunrpc/xdr.h> 15 16struct svc_rqst; 17 18#define NLM_MAXCOOKIELEN 32 19#define NLM_MAXSTRLEN 1024 20 21#define nlm_granted __constant_htonl(NLM_LCK_GRANTED) 22#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED) 23#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS) 24#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) 25#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) 26 27#define nlm_drop_reply __constant_htonl(30000) 28 29/* Lock info passed via NLM */ 30struct nlm_lock { 31 char * caller; 32 int len; /* length of "caller" */ 33 struct nfs_fh fh; 34 struct xdr_netobj oh; 35 u32 svid; 36 struct file_lock fl; 37}; 38 39/* 40 * NLM cookies. Technically they can be 1K, but Linux only uses 8 bytes. 41 * FreeBSD uses 16, Apple Mac OS X 10.3 uses 20. Therefore we set it to 42 * 32 bytes. 43 */ 44 45struct nlm_cookie 46{ 47 unsigned char data[NLM_MAXCOOKIELEN]; 48 unsigned int len; 49}; 50 51/* 52 * Generic lockd arguments for all but sm_notify 53 */ 54struct nlm_args { 55 struct nlm_cookie cookie; 56 struct nlm_lock lock; 57 u32 block; 58 u32 reclaim; 59 u32 state; 60 u32 monitor; 61 u32 fsm_access; 62 u32 fsm_mode; 63}; 64 65typedef struct nlm_args nlm_args; 66 67/* 68 * Generic lockd result 69 */ 70struct nlm_res { 71 struct nlm_cookie cookie; 72 __be32 status; 73 struct nlm_lock lock; 74}; 75 76/* 77 * statd callback when client has rebooted 78 */ 79struct nlm_reboot { 80 char * mon; 81 int len; 82 u32 state; 83 __be32 addr; 84 __be32 vers; 85 __be32 proto; 86}; 87 88/* 89 * Contents of statd callback when monitored host rebooted 90 */ 91#define NLMSVC_XDRSIZE sizeof(struct nlm_args) 92 93int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *); 94int nlmsvc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *); 95int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *); 96int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *); 97int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *); 98int nlmsvc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *); 99int nlmsvc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *); 100int nlmsvc_encode_void(struct svc_rqst *, __be32 *, void *); 101int nlmsvc_decode_void(struct svc_rqst *, __be32 *, void *); 102int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *); 103int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *); 104int nlmsvc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *); 105int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *); 106/* 107int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 108int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 109int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *); 110int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 111 */ 112 113#endif /* LOCKD_XDR_H */