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