0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __LINUX_FS_NFS_CALLBACK_H
0010 #define __LINUX_FS_NFS_CALLBACK_H
0011 #include <linux/sunrpc/svc.h>
0012
0013 #define NFS4_CALLBACK 0x40000000
0014 #define NFS4_CALLBACK_XDRSIZE 2048
0015 #define NFS4_CALLBACK_BUFSIZE (1024 + NFS4_CALLBACK_XDRSIZE)
0016
0017 enum nfs4_callback_procnum {
0018 CB_NULL = 0,
0019 CB_COMPOUND = 1,
0020 };
0021
0022 enum nfs4_callback_opnum {
0023 OP_CB_GETATTR = 3,
0024 OP_CB_RECALL = 4,
0025
0026 OP_CB_LAYOUTRECALL = 5,
0027 OP_CB_NOTIFY = 6,
0028 OP_CB_PUSH_DELEG = 7,
0029 OP_CB_RECALL_ANY = 8,
0030 OP_CB_RECALLABLE_OBJ_AVAIL = 9,
0031 OP_CB_RECALL_SLOT = 10,
0032 OP_CB_SEQUENCE = 11,
0033 OP_CB_WANTS_CANCELLED = 12,
0034 OP_CB_NOTIFY_LOCK = 13,
0035 OP_CB_NOTIFY_DEVICEID = 14,
0036
0037 OP_CB_OFFLOAD = 15,
0038 OP_CB_ILLEGAL = 10044,
0039 };
0040
0041 struct nfs4_slot;
0042 struct cb_process_state {
0043 __be32 drc_status;
0044 struct nfs_client *clp;
0045 struct nfs4_slot *slot;
0046 u32 minorversion;
0047 struct net *net;
0048 };
0049
0050 struct cb_compound_hdr_arg {
0051 unsigned int taglen;
0052 const char *tag;
0053 unsigned int minorversion;
0054 unsigned int cb_ident;
0055 unsigned nops;
0056 };
0057
0058 struct cb_compound_hdr_res {
0059 __be32 *status;
0060 unsigned int taglen;
0061 const char *tag;
0062 __be32 *nops;
0063 };
0064
0065 struct cb_getattrargs {
0066 struct nfs_fh fh;
0067 uint32_t bitmap[2];
0068 };
0069
0070 struct cb_getattrres {
0071 __be32 status;
0072 uint32_t bitmap[2];
0073 uint64_t size;
0074 uint64_t change_attr;
0075 struct timespec64 ctime;
0076 struct timespec64 mtime;
0077 };
0078
0079 struct cb_recallargs {
0080 struct nfs_fh fh;
0081 nfs4_stateid stateid;
0082 uint32_t truncate;
0083 };
0084
0085 #if defined(CONFIG_NFS_V4_1)
0086
0087 struct referring_call {
0088 uint32_t rc_sequenceid;
0089 uint32_t rc_slotid;
0090 };
0091
0092 struct referring_call_list {
0093 struct nfs4_sessionid rcl_sessionid;
0094 uint32_t rcl_nrefcalls;
0095 struct referring_call *rcl_refcalls;
0096 };
0097
0098 struct cb_sequenceargs {
0099 struct sockaddr *csa_addr;
0100 struct nfs4_sessionid csa_sessionid;
0101 uint32_t csa_sequenceid;
0102 uint32_t csa_slotid;
0103 uint32_t csa_highestslotid;
0104 uint32_t csa_cachethis;
0105 uint32_t csa_nrclists;
0106 struct referring_call_list *csa_rclists;
0107 };
0108
0109 struct cb_sequenceres {
0110 __be32 csr_status;
0111 struct nfs4_sessionid csr_sessionid;
0112 uint32_t csr_sequenceid;
0113 uint32_t csr_slotid;
0114 uint32_t csr_highestslotid;
0115 uint32_t csr_target_highestslotid;
0116 };
0117
0118 extern __be32 nfs4_callback_sequence(void *argp, void *resp,
0119 struct cb_process_state *cps);
0120
0121 #define RCA4_TYPE_MASK_RDATA_DLG 0
0122 #define RCA4_TYPE_MASK_WDATA_DLG 1
0123 #define RCA4_TYPE_MASK_DIR_DLG 2
0124 #define RCA4_TYPE_MASK_FILE_LAYOUT 3
0125 #define RCA4_TYPE_MASK_BLK_LAYOUT 4
0126 #define RCA4_TYPE_MASK_OBJ_LAYOUT_MIN 8
0127 #define RCA4_TYPE_MASK_OBJ_LAYOUT_MAX 9
0128 #define RCA4_TYPE_MASK_OTHER_LAYOUT_MIN 12
0129 #define RCA4_TYPE_MASK_OTHER_LAYOUT_MAX 15
0130 #define PNFS_FF_RCA4_TYPE_MASK_READ 16
0131 #define PNFS_FF_RCA4_TYPE_MASK_RW 17
0132 #define RCA4_TYPE_MASK_ALL 0x3f31f
0133
0134 struct cb_recallanyargs {
0135 uint32_t craa_objs_to_keep;
0136 uint32_t craa_type_mask;
0137 };
0138
0139 extern __be32 nfs4_callback_recallany(void *argp, void *resp,
0140 struct cb_process_state *cps);
0141
0142 struct cb_recallslotargs {
0143 uint32_t crsa_target_highest_slotid;
0144 };
0145 extern __be32 nfs4_callback_recallslot(void *argp, void *resp,
0146 struct cb_process_state *cps);
0147
0148 struct cb_layoutrecallargs {
0149 uint32_t cbl_recall_type;
0150 uint32_t cbl_layout_type;
0151 uint32_t cbl_layoutchanged;
0152 union {
0153 struct {
0154 struct nfs_fh cbl_fh;
0155 struct pnfs_layout_range cbl_range;
0156 nfs4_stateid cbl_stateid;
0157 };
0158 struct nfs_fsid cbl_fsid;
0159 };
0160 };
0161
0162 extern __be32 nfs4_callback_layoutrecall(void *argp, void *resp,
0163 struct cb_process_state *cps);
0164
0165 struct cb_devicenotifyitem {
0166 uint32_t cbd_notify_type;
0167 uint32_t cbd_layout_type;
0168 struct nfs4_deviceid cbd_dev_id;
0169 uint32_t cbd_immediate;
0170 };
0171
0172 struct cb_devicenotifyargs {
0173 uint32_t ndevs;
0174 struct cb_devicenotifyitem *devs;
0175 };
0176
0177 extern __be32 nfs4_callback_devicenotify(void *argp, void *resp,
0178 struct cb_process_state *cps);
0179
0180 struct cb_notify_lock_args {
0181 struct nfs_fh cbnl_fh;
0182 struct nfs_lowner cbnl_owner;
0183 bool cbnl_valid;
0184 };
0185
0186 extern __be32 nfs4_callback_notify_lock(void *argp, void *resp,
0187 struct cb_process_state *cps);
0188 #endif
0189 #ifdef CONFIG_NFS_V4_2
0190 struct cb_offloadargs {
0191 struct nfs_fh coa_fh;
0192 nfs4_stateid coa_stateid;
0193 uint32_t error;
0194 uint64_t wr_count;
0195 struct nfs_writeverf wr_writeverf;
0196 };
0197
0198 extern __be32 nfs4_callback_offload(void *args, void *dummy,
0199 struct cb_process_state *cps);
0200 #endif
0201 extern int check_gss_callback_principal(struct nfs_client *, struct svc_rqst *);
0202 extern __be32 nfs4_callback_getattr(void *argp, void *resp,
0203 struct cb_process_state *cps);
0204 extern __be32 nfs4_callback_recall(void *argp, void *resp,
0205 struct cb_process_state *cps);
0206 #if IS_ENABLED(CONFIG_NFS_V4)
0207 extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt);
0208 extern void nfs_callback_down(int minorversion, struct net *net);
0209 #endif
0210
0211
0212
0213
0214
0215 #define NFS41_BC_MIN_CALLBACKS 1
0216 #define NFS41_BC_MAX_CALLBACKS 1
0217
0218 #define NFS4_MIN_NR_CALLBACK_THREADS 1
0219
0220 extern unsigned int nfs_callback_set_tcpport;
0221 extern unsigned short nfs_callback_nr_threads;
0222
0223 #endif