0001
0002
0003
0004
0005
0006 #ifndef __KSMBD_WORK_H__
0007 #define __KSMBD_WORK_H__
0008
0009 #include <linux/ctype.h>
0010 #include <linux/workqueue.h>
0011
0012 struct ksmbd_conn;
0013 struct ksmbd_session;
0014 struct ksmbd_tree_connect;
0015
0016 enum {
0017 KSMBD_WORK_ACTIVE = 0,
0018 KSMBD_WORK_CANCELLED,
0019 KSMBD_WORK_CLOSED,
0020 };
0021
0022
0023 struct ksmbd_work {
0024
0025 struct ksmbd_conn *conn;
0026 struct ksmbd_session *sess;
0027 struct ksmbd_tree_connect *tcon;
0028
0029
0030 void *request_buf;
0031
0032 void *response_buf;
0033
0034
0035 void *aux_payload_buf;
0036
0037
0038 int next_smb2_rcv_hdr_off;
0039
0040 int next_smb2_rsp_hdr_off;
0041
0042
0043
0044
0045
0046 u64 compound_fid;
0047 u64 compound_pfid;
0048 u64 compound_sid;
0049
0050 const struct cred *saved_cred;
0051
0052
0053 unsigned int credits_granted;
0054
0055
0056 unsigned int resp_hdr_sz;
0057 unsigned int response_sz;
0058
0059 unsigned int aux_payload_sz;
0060
0061 void *tr_buf;
0062
0063 unsigned char state;
0064
0065 bool multiRsp:1;
0066
0067 bool send_no_response:1;
0068
0069 bool encrypted:1;
0070
0071 bool syncronous:1;
0072 bool need_invalidate_rkey:1;
0073
0074 unsigned int remote_key;
0075
0076 int async_id;
0077 void **cancel_argv;
0078 void (*cancel_fn)(void **argv);
0079
0080 struct work_struct work;
0081
0082 struct list_head request_entry;
0083
0084 struct list_head async_request_entry;
0085 struct list_head fp_entry;
0086 struct list_head interim_entry;
0087 };
0088
0089
0090
0091
0092
0093 static inline void *ksmbd_resp_buf_next(struct ksmbd_work *work)
0094 {
0095 return work->response_buf + work->next_smb2_rsp_hdr_off + 4;
0096 }
0097
0098
0099
0100
0101
0102 static inline void *ksmbd_req_buf_next(struct ksmbd_work *work)
0103 {
0104 return work->request_buf + work->next_smb2_rcv_hdr_off + 4;
0105 }
0106
0107 struct ksmbd_work *ksmbd_alloc_work_struct(void);
0108 void ksmbd_free_work_struct(struct ksmbd_work *work);
0109
0110 void ksmbd_work_pool_destroy(void);
0111 int ksmbd_work_pool_init(void);
0112
0113 int ksmbd_workqueue_init(void);
0114 void ksmbd_workqueue_destroy(void);
0115 bool ksmbd_queue_work(struct ksmbd_work *work);
0116
0117 #endif