[PATCH v2 008/127] smb: smbdirect: introduce smbdirect_connection.c with the first helper function
Stefan Metzmacher
metze at samba.org
Wed Oct 29 13:19:46 UTC 2025
This is a very basic start in order to introduce smbdirect_connection.c
with common functions, which will be shared by client and server.
Over time smbdirect_connection.c will get more and more functions
which will be included in fs/smb/client/smbdirect.c and
fs/smb/server/transport_rdma.c via
fs/smb/common/smbdirect/smbdirect_all_c_files.c
in order to allow tiny steps in the direction of moving to
a few exported functions from an smbdirect.ko.
That's why __maybe_unused is added for now it will
be removed at the end of the road to common code.
Note the Copyright (C) 2017, Microsoft Corporation is added
as a lot of functions from fs/smb/client/smbdirect.c will
be moved into this file soon and I don't want to forget
about adding it.
Cc: Steve French <smfrench at gmail.com>
Cc: Tom Talpey <tom at talpey.com>
Cc: Long Li <longli at microsoft.com>
Cc: Namjae Jeon <linkinjeon at kernel.org>
Cc: linux-cifs at vger.kernel.org
Cc: samba-technical at lists.samba.org
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Steve French <stfrench at microsoft.com>
---
.../common/smbdirect/smbdirect_all_c_files.c | 1 +
.../common/smbdirect/smbdirect_connection.c | 26 +++++++++++++++++++
2 files changed, 27 insertions(+)
create mode 100644 fs/smb/common/smbdirect/smbdirect_connection.c
diff --git a/fs/smb/common/smbdirect/smbdirect_all_c_files.c b/fs/smb/common/smbdirect/smbdirect_all_c_files.c
index 610556fb7931..ba92f0813932 100644
--- a/fs/smb/common/smbdirect/smbdirect_all_c_files.c
+++ b/fs/smb/common/smbdirect/smbdirect_all_c_files.c
@@ -15,3 +15,4 @@
#ifndef SMBDIRECT_USE_INLINE_C_FILES
#error SMBDIRECT_USE_INLINE_C_FILES define needed
#endif
+#include "smbdirect_connection.c"
diff --git a/fs/smb/common/smbdirect/smbdirect_connection.c b/fs/smb/common/smbdirect/smbdirect_connection.c
new file mode 100644
index 000000000000..ca6508705be8
--- /dev/null
+++ b/fs/smb/common/smbdirect/smbdirect_connection.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2017, Microsoft Corporation.
+ * Copyright (c) 2025, Stefan Metzmacher
+ */
+
+#include "smbdirect_internal.h"
+
+__maybe_unused /* this is temporary while this file is included in orders */
+static void smbdirect_socket_prepare_create(struct smbdirect_socket *sc,
+ const struct smbdirect_socket_parameters *sp,
+ struct workqueue_struct *workqueue)
+{
+ smbdirect_socket_init(sc);
+
+ /*
+ * Make a copy of the callers parameters
+ * from here we only work on the copy
+ */
+ sc->parameters = *sp;
+
+ /*
+ * Remember the callers workqueue
+ */
+ sc->workqueue = workqueue;
+}
--
2.43.0
More information about the samba-technical
mailing list