~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/smb/server/ksmbd_work.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  *   Copyright (C) 2019 Samsung Electronics Co., Ltd.
  4  */
  5 
  6 #ifndef __KSMBD_WORK_H__
  7 #define __KSMBD_WORK_H__
  8 
  9 #include <linux/ctype.h>
 10 #include <linux/workqueue.h>
 11 
 12 struct ksmbd_conn;
 13 struct ksmbd_session;
 14 struct ksmbd_tree_connect;
 15 
 16 enum {
 17         KSMBD_WORK_ACTIVE = 0,
 18         KSMBD_WORK_CANCELLED,
 19         KSMBD_WORK_CLOSED,
 20 };
 21 
 22 struct aux_read {
 23         void *buf;
 24         struct list_head entry;
 25 };
 26 
 27 /* one of these for every pending CIFS request at the connection */
 28 struct ksmbd_work {
 29         /* Server corresponding to this mid */
 30         struct ksmbd_conn               *conn;
 31         struct ksmbd_session            *sess;
 32         struct ksmbd_tree_connect       *tcon;
 33 
 34         /* Pointer to received SMB header */
 35         void                            *request_buf;
 36         /* Response buffer */
 37         void                            *response_buf;
 38 
 39         struct list_head                aux_read_list;
 40 
 41         struct kvec                     *iov;
 42         int                             iov_alloc_cnt;
 43         int                             iov_cnt;
 44         int                             iov_idx;
 45 
 46         /* Next cmd hdr in compound req buf*/
 47         int                             next_smb2_rcv_hdr_off;
 48         /* Next cmd hdr in compound rsp buf*/
 49         int                             next_smb2_rsp_hdr_off;
 50         /* Current cmd hdr in compound rsp buf*/
 51         int                             curr_smb2_rsp_hdr_off;
 52 
 53         /*
 54          * Current Local FID assigned compound response if SMB2 CREATE
 55          * command is present in compound request
 56          */
 57         u64                             compound_fid;
 58         u64                             compound_pfid;
 59         u64                             compound_sid;
 60 
 61         const struct cred               *saved_cred;
 62 
 63         /* Number of granted credits */
 64         unsigned int                    credits_granted;
 65 
 66         /* response smb header size */
 67         unsigned int                    response_sz;
 68 
 69         void                            *tr_buf;
 70 
 71         unsigned char                   state;
 72         /* No response for cancelled request */
 73         bool                            send_no_response:1;
 74         /* Request is encrypted */
 75         bool                            encrypted:1;
 76         /* Is this SYNC or ASYNC ksmbd_work */
 77         bool                            asynchronous:1;
 78         bool                            need_invalidate_rkey:1;
 79 
 80         unsigned int                    remote_key;
 81         /* cancel works */
 82         int                             async_id;
 83         void                            **cancel_argv;
 84         void                            (*cancel_fn)(void **argv);
 85 
 86         struct work_struct              work;
 87         /* List head at conn->requests */
 88         struct list_head                request_entry;
 89         /* List head at conn->async_requests */
 90         struct list_head                async_request_entry;
 91         struct list_head                fp_entry;
 92         struct list_head                interim_entry;
 93 };
 94 
 95 /**
 96  * ksmbd_resp_buf_next - Get next buffer on compound response.
 97  * @work: smb work containing response buffer
 98  */
 99 static inline void *ksmbd_resp_buf_next(struct ksmbd_work *work)
100 {
101         return work->response_buf + work->next_smb2_rsp_hdr_off + 4;
102 }
103 
104 /**
105  * ksmbd_resp_buf_curr - Get current buffer on compound response.
106  * @work: smb work containing response buffer
107  */
108 static inline void *ksmbd_resp_buf_curr(struct ksmbd_work *work)
109 {
110         return work->response_buf + work->curr_smb2_rsp_hdr_off + 4;
111 }
112 
113 /**
114  * ksmbd_req_buf_next - Get next buffer on compound request.
115  * @work: smb work containing response buffer
116  */
117 static inline void *ksmbd_req_buf_next(struct ksmbd_work *work)
118 {
119         return work->request_buf + work->next_smb2_rcv_hdr_off + 4;
120 }
121 
122 struct ksmbd_work *ksmbd_alloc_work_struct(void);
123 void ksmbd_free_work_struct(struct ksmbd_work *work);
124 
125 void ksmbd_work_pool_destroy(void);
126 int ksmbd_work_pool_init(void);
127 
128 int ksmbd_workqueue_init(void);
129 void ksmbd_workqueue_destroy(void);
130 bool ksmbd_queue_work(struct ksmbd_work *work);
131 int ksmbd_iov_pin_rsp_read(struct ksmbd_work *work, void *ib, int len,
132                            void *aux_buf, unsigned int aux_size);
133 int ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len);
134 int allocate_interim_rsp_buf(struct ksmbd_work *work);
135 #endif /* __KSMBD_WORK_H__ */
136 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php