Skip to content

Commit 1a017f8

Browse files
metze-sambaintel-lab-lkp
authored andcommitted
smb: smbdirect: introduce smbdirect_public.h with prototypes
smbdirect_public.h contains functions which will be still be eported when we move to an smbdirect.ko. For now this uses the SMBDIRECT_USE_INLINE_C_FILES code path and marks all function as '__maybe_unused static', but this will make further changes easier. Note this generates the following things from checkpatch.pl, so I passed --ignore=FILE_PATH_CHANGES,EXPORT_SYMBOL,COMPLEX_MACRO ERROR: Macros with complex values should be enclosed in parentheses torvalds#514: FILE: fs/smb/common/smbdirect/smbdirect_public.h:18: +#define __SMBDIRECT_PUBLIC__ __maybe_unused static WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable torvalds#515: FILE: fs/smb/common/smbdirect/smbdirect_public.h:19: +#define __SMBDIRECT_EXPORT_SYMBOL__(__sym) WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable torvalds#518: FILE: fs/smb/common/smbdirect/smbdirect_public.h:22: +#define __SMBDIRECT_EXPORT_SYMBOL__(__sym) EXPORT_SYMBOL_FOR_MODULES(__sym, "cifs,ksmbd") This is exactly what we want here, so we should ignore the checkpatch.pl problems. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher <metze@samba.org>
1 parent aec2a10 commit 1a017f8

File tree

9 files changed

+263
-98
lines changed

9 files changed

+263
-98
lines changed

fs/smb/common/smbdirect/smbdirect_accept.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ static int smbdirect_accept_init_params(struct smbdirect_socket *sc);
1313
static void smbdirect_accept_negotiate_recv_done(struct ib_cq *cq, struct ib_wc *wc);
1414
static void smbdirect_accept_negotiate_send_done(struct ib_cq *cq, struct ib_wc *wc);
1515

16-
__maybe_unused /* this is temporary while this file is included in orders */
17-
static int smbdirect_accept_connect_request(struct smbdirect_socket *sc,
18-
const struct rdma_conn_param *param)
16+
__SMBDIRECT_PUBLIC__
17+
int smbdirect_accept_connect_request(struct smbdirect_socket *sc,
18+
const struct rdma_conn_param *param)
1919
{
2020
struct smbdirect_socket_parameters *sp = &sc->parameters;
2121
struct smbdirect_recv_io *recv_io;
@@ -154,6 +154,7 @@ static int smbdirect_accept_connect_request(struct smbdirect_socket *sc,
154154
init_params_failed:
155155
return ret;
156156
}
157+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_accept_connect_request);
157158

158159
static int smbdirect_accept_init_params(struct smbdirect_socket *sc)
159160
{

fs/smb/common/smbdirect/smbdirect_connect.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ static int smbdirect_connect_negotiate_start(struct smbdirect_socket *sc);
1515
static void smbdirect_connect_negotiate_send_done(struct ib_cq *cq, struct ib_wc *wc);
1616
static void smbdirect_connect_negotiate_recv_done(struct ib_cq *cq, struct ib_wc *wc);
1717

18-
__maybe_unused /* this is temporary while this file is included in orders */
19-
static int smbdirect_connect(struct smbdirect_socket *sc,
20-
const struct sockaddr *dst)
18+
__SMBDIRECT_PUBLIC__
19+
int smbdirect_connect(struct smbdirect_socket *sc, const struct sockaddr *dst)
2120
{
2221
const struct sockaddr *src = NULL;
2322
union {
@@ -61,6 +60,7 @@ static int smbdirect_connect(struct smbdirect_socket *sc,
6160
*/
6261
return 0;
6362
}
63+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connect);
6464

6565
static int smbdirect_connect_setup_connection(struct smbdirect_socket *sc)
6666
{
@@ -770,9 +770,9 @@ static void smbdirect_connect_negotiate_recv_done(struct ib_cq *cq, struct ib_wc
770770
smbdirect_connection_schedule_disconnect(sc, -ECONNABORTED);
771771
}
772772

773-
__maybe_unused /* this is temporary while this file is included in orders */
774-
static int smbdirect_connect_sync(struct smbdirect_socket *sc,
775-
const struct sockaddr *dst)
773+
__SMBDIRECT_PUBLIC__
774+
int smbdirect_connect_sync(struct smbdirect_socket *sc,
775+
const struct sockaddr *dst)
776776
{
777777
int ret;
778778

@@ -794,3 +794,4 @@ static int smbdirect_connect_sync(struct smbdirect_socket *sc,
794794

795795
return 0;
796796
}
797+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connect_sync);

fs/smb/common/smbdirect/smbdirect_connection.c

Lines changed: 75 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ static void smbdirect_connection_send_immediate_work(struct work_struct *work);
2828

2929
static void smbdirect_connection_destroy_mr_list(struct smbdirect_socket *sc);
3030

31-
__maybe_unused /* this is temporary while this file is included in orders */
32-
static bool smbdirect_frwr_is_supported(const struct ib_device_attr *attrs)
31+
__SMBDIRECT_PUBLIC__
32+
bool smbdirect_frwr_is_supported(const struct ib_device_attr *attrs)
3333
{
3434
/*
3535
* Test if FRWR (Fast Registration Work Requests) is supported on the
@@ -43,6 +43,7 @@ static bool smbdirect_frwr_is_supported(const struct ib_device_attr *attrs)
4343
return false;
4444
return true;
4545
}
46+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_frwr_is_supported);
4647

4748
__maybe_unused /* this is temporary while this file is included in orders */
4849
static void smbdirect_socket_prepare_create(struct smbdirect_socket *sc,
@@ -117,8 +118,8 @@ static int smbdirect_socket_init_new(struct net *net, struct smbdirect_socket *s
117118
return 0;
118119
}
119120

120-
__maybe_unused /* this is temporary while this file is included in orders */
121-
static int smbdirect_socket_create_kern(struct net *net, struct smbdirect_socket **_sc)
121+
__SMBDIRECT_PUBLIC__
122+
int smbdirect_socket_create_kern(struct net *net, struct smbdirect_socket **_sc)
122123
{
123124
struct smbdirect_socket *sc;
124125
int ret;
@@ -142,6 +143,7 @@ static int smbdirect_socket_create_kern(struct net *net, struct smbdirect_socket
142143
alloc_failed:
143144
return ret;
144145
}
146+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_create_kern);
145147

146148
static int smbdirect_socket_init_accepting(struct rdma_cm_id *id, struct smbdirect_socket *sc)
147149
{
@@ -158,8 +160,8 @@ static int smbdirect_socket_init_accepting(struct rdma_cm_id *id, struct smbdire
158160
return 0;
159161
}
160162

161-
__maybe_unused /* this is temporary while this file is included in orders */
162-
static int smbdirect_socket_create_accepting(struct rdma_cm_id *id, struct smbdirect_socket **_sc)
163+
__SMBDIRECT_PUBLIC__
164+
int smbdirect_socket_create_accepting(struct rdma_cm_id *id, struct smbdirect_socket **_sc)
163165
{
164166
struct smbdirect_socket *sc;
165167
int ret;
@@ -183,10 +185,11 @@ static int smbdirect_socket_create_accepting(struct rdma_cm_id *id, struct smbdi
183185
alloc_failed:
184186
return ret;
185187
}
188+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_create_accepting);
186189

187-
__maybe_unused /* this is temporary while this file is included in orders */
188-
static int smbdirect_socket_set_initial_parameters(struct smbdirect_socket *sc,
189-
const struct smbdirect_socket_parameters *sp)
190+
__SMBDIRECT_PUBLIC__
191+
int smbdirect_socket_set_initial_parameters(struct smbdirect_socket *sc,
192+
const struct smbdirect_socket_parameters *sp)
190193
{
191194
/*
192195
* This is only allowed before connect or accept
@@ -208,18 +211,20 @@ static int smbdirect_socket_set_initial_parameters(struct smbdirect_socket *sc,
208211

209212
return 0;
210213
}
214+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_set_initial_parameters);
211215

212-
__maybe_unused /* this is temporary while this file is included in orders */
213-
static const struct smbdirect_socket_parameters *
216+
__SMBDIRECT_PUBLIC__
217+
const struct smbdirect_socket_parameters *
214218
smbdirect_socket_get_current_parameters(struct smbdirect_socket *sc)
215219
{
216220
return &sc->parameters;
217221
}
222+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_get_current_parameters);
218223

219-
__maybe_unused /* this is temporary while this file is included in orders */
220-
static int smbdirect_socket_set_kernel_settings(struct smbdirect_socket *sc,
221-
enum ib_poll_context poll_ctx,
222-
gfp_t gfp_mask)
224+
__SMBDIRECT_PUBLIC__
225+
int smbdirect_socket_set_kernel_settings(struct smbdirect_socket *sc,
226+
enum ib_poll_context poll_ctx,
227+
gfp_t gfp_mask)
223228
{
224229
/*
225230
* This is only allowed before connect or accept
@@ -239,10 +244,11 @@ static int smbdirect_socket_set_kernel_settings(struct smbdirect_socket *sc,
239244

240245
return 0;
241246
}
247+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_set_kernel_settings);
242248

243-
__maybe_unused /* this is temporary while this file is included in orders */
244-
static int smbdirect_socket_set_custom_workqueue(struct smbdirect_socket *sc,
245-
struct workqueue_struct *workqueue)
249+
__SMBDIRECT_PUBLIC__
250+
int smbdirect_socket_set_custom_workqueue(struct smbdirect_socket *sc,
251+
struct workqueue_struct *workqueue)
246252
{
247253
/*
248254
* This is only allowed before connect or accept
@@ -261,26 +267,28 @@ static int smbdirect_socket_set_custom_workqueue(struct smbdirect_socket *sc,
261267

262268
return 0;
263269
}
264-
265-
__maybe_unused /* this is temporary while this file is included in orders */
266-
static void smbdirect_socket_set_logging(struct smbdirect_socket *sc,
267-
void *private_ptr,
268-
bool (*needed)(struct smbdirect_socket *sc,
269-
void *private_ptr,
270-
unsigned int lvl,
271-
unsigned int cls),
272-
void (*vaprintf)(struct smbdirect_socket *sc,
273-
const char *func,
274-
unsigned int line,
275-
void *private_ptr,
276-
unsigned int lvl,
277-
unsigned int cls,
278-
struct va_format *vaf))
270+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_set_custom_workqueue);
271+
272+
__SMBDIRECT_PUBLIC__
273+
void smbdirect_socket_set_logging(struct smbdirect_socket *sc,
274+
void *private_ptr,
275+
bool (*needed)(struct smbdirect_socket *sc,
276+
void *private_ptr,
277+
unsigned int lvl,
278+
unsigned int cls),
279+
void (*vaprintf)(struct smbdirect_socket *sc,
280+
const char *func,
281+
unsigned int line,
282+
void *private_ptr,
283+
unsigned int lvl,
284+
unsigned int cls,
285+
struct va_format *vaf))
279286
{
280287
sc->logging.private_ptr = private_ptr;
281288
sc->logging.needed = needed;
282289
sc->logging.vaprintf = vaprintf;
283290
}
291+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_set_logging);
284292

285293
__maybe_unused /* this is temporary while this file is included in orders */
286294
static void smbdirect_connection_wake_up_all(struct smbdirect_socket *sc)
@@ -1095,16 +1103,17 @@ static void smbdirect_connection_disconnect_work(struct work_struct *work)
10951103
smbdirect_connection_wake_up_all(sc);
10961104
}
10971105

1098-
__maybe_unused /* this is temporary while this file is included in orders */
1099-
static bool smbdirect_connection_is_connected(struct smbdirect_socket *sc)
1106+
__SMBDIRECT_PUBLIC__
1107+
bool smbdirect_connection_is_connected(struct smbdirect_socket *sc)
11001108
{
11011109
if (unlikely(!sc || sc->first_error || sc->status != SMBDIRECT_SOCKET_CONNECTED))
11021110
return false;
11031111
return true;
11041112
}
1113+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_is_connected);
11051114

1106-
__maybe_unused /* this is temporary while this file is included in orders */
1107-
static int smbdirect_connection_wait_for_connected(struct smbdirect_socket *sc)
1115+
__SMBDIRECT_PUBLIC__
1116+
int smbdirect_connection_wait_for_connected(struct smbdirect_socket *sc)
11081117
{
11091118
struct smbdirect_socket_parameters *sp = &sc->parameters;
11101119
union {
@@ -1170,6 +1179,7 @@ static int smbdirect_connection_wait_for_connected(struct smbdirect_socket *sc)
11701179

11711180
return 0;
11721181
}
1182+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_wait_for_connected);
11731183

11741184
static void smbdirect_connection_destroy(struct smbdirect_socket *sc)
11751185
{
@@ -1295,11 +1305,12 @@ static void smbdirect_connection_destroy_sync(struct smbdirect_socket *sc)
12951305
SMBDIRECT_DEBUG_ERR_PTR(sc->first_error));
12961306
}
12971307

1298-
__maybe_unused /* this is temporary while this file is included in orders */
1299-
static void smbdirect_socket_shutdown(struct smbdirect_socket *sc)
1308+
__SMBDIRECT_PUBLIC__
1309+
void smbdirect_socket_shutdown(struct smbdirect_socket *sc)
13001310
{
13011311
smbdirect_connection_schedule_disconnect(sc, -ECONNABORTED);
13021312
}
1313+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_shutdown);
13031314

13041315
__maybe_unused /* this is temporary while this file is included in orders */
13051316
static void smbdirect_socket_release_disconnect(struct kref *kref)
@@ -1327,8 +1338,8 @@ static void smbdirect_socket_release_destroy(struct kref *kref)
13271338
kfree(sc);
13281339
}
13291340

1330-
__maybe_unused /* this is temporary while this file is included in orders */
1331-
static void smbdirect_socket_release(struct smbdirect_socket *sc)
1341+
__SMBDIRECT_PUBLIC__
1342+
void smbdirect_socket_release(struct smbdirect_socket *sc)
13321343
{
13331344
/*
13341345
* We expect only 1 disconnect reference
@@ -1344,6 +1355,7 @@ static void smbdirect_socket_release(struct smbdirect_socket *sc)
13441355
*/
13451356
kref_put(&sc->refs.destroy, smbdirect_socket_release_destroy);
13461357
}
1358+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_socket_release);
13471359

13481360
static void smbdirect_connection_idle_timer_work(struct work_struct *work)
13491361
{
@@ -1600,11 +1612,12 @@ static int smbdirect_connection_post_send_io(struct smbdirect_socket *sc,
16001612
return smbdirect_connection_post_send_wr(sc, &msg->wr);
16011613
}
16021614

1603-
static int smbdirect_connection_send_single_iter(struct smbdirect_socket *sc,
1604-
struct smbdirect_send_batch *batch,
1605-
struct iov_iter *iter,
1606-
unsigned int flags,
1607-
u32 remaining_data_length)
1615+
__SMBDIRECT_PUBLIC__
1616+
int smbdirect_connection_send_single_iter(struct smbdirect_socket *sc,
1617+
struct smbdirect_send_batch *batch,
1618+
struct iov_iter *iter,
1619+
unsigned int flags,
1620+
u32 remaining_data_length)
16081621
{
16091622
const struct smbdirect_socket_parameters *sp = &sc->parameters;
16101623
struct smbdirect_send_io *msg;
@@ -1735,9 +1748,10 @@ static int smbdirect_connection_send_single_iter(struct smbdirect_socket *sc,
17351748
lcredit_failed:
17361749
return ret;
17371750
}
1751+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_send_single_iter);
17381752

1739-
__maybe_unused /* this is temporary while this file is included in orders */
1740-
static int smbdirect_connection_send_wait_zero_pending(struct smbdirect_socket *sc)
1753+
__SMBDIRECT_PUBLIC__
1754+
int smbdirect_connection_send_wait_zero_pending(struct smbdirect_socket *sc)
17411755
{
17421756
/*
17431757
* As an optimization, we don't wait for individual I/O to finish
@@ -1760,13 +1774,14 @@ static int smbdirect_connection_send_wait_zero_pending(struct smbdirect_socket *
17601774

17611775
return 0;
17621776
}
1777+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_send_wait_zero_pending);
17631778

1764-
__maybe_unused /* this is temporary while this file is included in orders */
1765-
static int smbdirect_connection_send_iter(struct smbdirect_socket *sc,
1766-
struct iov_iter *iter,
1767-
unsigned int flags,
1768-
bool need_invalidate,
1769-
unsigned int remote_key)
1779+
__SMBDIRECT_PUBLIC__
1780+
int smbdirect_connection_send_iter(struct smbdirect_socket *sc,
1781+
struct iov_iter *iter,
1782+
unsigned int flags,
1783+
bool need_invalidate,
1784+
unsigned int remote_key)
17701785
{
17711786
struct smbdirect_socket_parameters *sp = &sc->parameters;
17721787
struct smbdirect_send_batch batch;
@@ -1845,6 +1860,7 @@ static int smbdirect_connection_send_iter(struct smbdirect_socket *sc,
18451860

18461861
return total_count;
18471862
}
1863+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_send_iter);
18481864

18491865
static void smbdirect_connection_send_io_done(struct ib_cq *cq, struct ib_wc *wc)
18501866
{
@@ -2223,10 +2239,10 @@ static void smbdirect_connection_recv_io_refill_work(struct work_struct *work)
22232239
}
22242240
}
22252241

2226-
__maybe_unused /* this is temporary while this file is included in orders */
2227-
static int smbdirect_connection_recvmsg(struct smbdirect_socket *sc,
2228-
struct msghdr *msg,
2229-
unsigned int flags)
2242+
__SMBDIRECT_PUBLIC__
2243+
int smbdirect_connection_recvmsg(struct smbdirect_socket *sc,
2244+
struct msghdr *msg,
2245+
unsigned int flags)
22302246
{
22312247
struct smbdirect_recv_io *response;
22322248
struct smbdirect_data_transfer *data_transfer;
@@ -2373,6 +2389,7 @@ static int smbdirect_connection_recvmsg(struct smbdirect_socket *sc,
23732389

23742390
goto again;
23752391
}
2392+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_recvmsg);
23762393

23772394
static bool smbdirect_map_sges_single_page(struct smbdirect_map_sges *state,
23782395
struct page *page, size_t off, size_t len)

fs/smb/common/smbdirect/smbdirect_debug.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#include "smbdirect_internal.h"
88
#include <linux/seq_file.h>
99

10-
__maybe_unused /* this is temporary while this file is included in orders */
11-
static void smbdirect_connection_legacy_debug_proc_show(struct smbdirect_socket *sc,
12-
unsigned int rdma_readwrite_threshold,
13-
struct seq_file *m)
10+
__SMBDIRECT_PUBLIC__
11+
void smbdirect_connection_legacy_debug_proc_show(struct smbdirect_socket *sc,
12+
unsigned int rdma_readwrite_threshold,
13+
struct seq_file *m)
1414
{
1515
const struct smbdirect_socket_parameters *sp;
1616

@@ -86,3 +86,4 @@ static void smbdirect_connection_legacy_debug_proc_show(struct smbdirect_socket
8686
atomic_read(&sc->mr_io.ready.count),
8787
atomic_read(&sc->mr_io.used.count));
8888
}
89+
__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_legacy_debug_proc_show);

fs/smb/common/smbdirect/smbdirect_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/errname.h>
1414
#include "smbdirect.h"
1515
#include "smbdirect_pdu.h"
16+
#include "smbdirect_public.h"
1617
#include "smbdirect_socket.h"
1718

1819
#endif /* __FS_SMB_COMMON_SMBDIRECT_INTERNAL_H__ */

0 commit comments

Comments
 (0)