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