summaryrefslogtreecommitdiff
path: root/fs/smb/server/smb_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/smb/server/smb_common.c')
-rw-r--r--fs/smb/server/smb_common.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/smb/server/smb_common.c b/fs/smb/server/smb_common.c
index 1cd7e738434d..741aabdfcef5 100644
--- a/fs/smb/server/smb_common.c
+++ b/fs/smb/server/smb_common.c
@@ -98,6 +98,30 @@ inline int ksmbd_max_protocol(void)
return SMB311_PROT;
}
+static const struct {
+ int version;
+ const char *string;
+} version_strings[] = {
+#ifdef CONFIG_SMB_INSECURE_SERVER
+ {SMB1_PROT, SMB1_VERSION_STRING},
+#endif
+ {SMB2_PROT, SMB20_VERSION_STRING},
+ {SMB21_PROT, SMB21_VERSION_STRING},
+ {SMB30_PROT, SMB30_VERSION_STRING},
+ {SMB302_PROT, SMB302_VERSION_STRING},
+ {SMB311_PROT, SMB311_VERSION_STRING},
+};
+
+const char *ksmbd_get_protocol_string(int version)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(version_strings); i++) {
+ if (version_strings[i].version == version)
+ return version_strings[i].string;
+ }
+ return "";
+}
int ksmbd_lookup_protocol_idx(char *str)
{
int offt = ARRAY_SIZE(smb1_protos) - 1;