Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2218403/?format=api
{ "id": 2218403, "url": "http://patchwork.ozlabs.org/api/patches/2218403/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260401072912.355072-8-huiwen.he@linux.dev/", "project": { "id": 12, "url": "http://patchwork.ozlabs.org/api/projects/12/?format=api", "name": "Linux CIFS Client", "link_name": "linux-cifs-client", "list_id": "linux-cifs.vger.kernel.org", "list_email": "linux-cifs@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260401072912.355072-8-huiwen.he@linux.dev>", "list_archive_url": null, "date": "2026-04-01T07:29:07", "name": "[v2,07/12] smb/client: introduce KUnit test to check ntstatus_to_dos_map search", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "19e0b9640dad56c15a86ee947001cb29da49a2d1", "submitter": { "id": 93029, "url": "http://patchwork.ozlabs.org/api/people/93029/?format=api", "name": null, "email": "huiwen.he@linux.dev" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260401072912.355072-8-huiwen.he@linux.dev/mbox/", "series": [ { "id": 498285, "url": "http://patchwork.ozlabs.org/api/series/498285/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=498285", "date": "2026-04-01T07:29:08", "name": "smb: improve search speed of SMB1 maperror", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/498285/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2218403/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2218403/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-cifs+bounces-10612-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-cifs@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256\n header.s=key1 header.b=C35aEpEX;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10612-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev\n header.b=\"C35aEpEX\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=91.218.175.178", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.dev", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.dev" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4flxcx47qpz1yGH\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 18:36:33 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 51D473101627\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 1 Apr 2026 07:33:45 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 93962393DDA;\n\tWed, 1 Apr 2026 07:30:46 +0000 (UTC)", "from out-178.mta0.migadu.com (out-178.mta0.migadu.com\n [91.218.175.178])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 702DB392831\n\tfor <linux-cifs@vger.kernel.org>; Wed, 1 Apr 2026 07:30:43 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775028646; cv=none;\n b=gXeAihk7kh1k9FmsWTKUynS6YhNLF29CQ9Bp/FLkghv5AQjZL5fJ1B9s9+2uW7UqzWxNCLc7GEW8fEly628P7ZEf+P7n2uhiyXU0RKkxDjEfyd/MCfMhUUCp0ZJw1FN3pH8rEYqrZFZVsc4EmpvwRQvU1jvRNBz9W1E/f/Iy7BI=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775028646; c=relaxed/simple;\n\tbh=st4C/cBGhk8MKmrYagwk87BxAXsbMaAuWlRqovxNzTM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=X4P1v5im/gKgB3EON3PNuXFsb/DPRFbK9E6e9TtpZ1EFm7iqFXsmknmlxgCIWAuBwBejGX7rur9ND+2PozOCsbT/23m7XCm5K0nQj0n5NcSSjqtRhT8MCvC7Q1q4Ldk/vciL6PIqfzA5ODblIeeHaPjptPy8bzN/IZBsh0WbNso=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.dev;\n spf=pass smtp.mailfrom=linux.dev;\n dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev\n header.b=C35aEpEX; arc=none smtp.client-ip=91.218.175.178", "X-Report-Abuse": "Please report any abuse attempt to abuse@migadu.com and\n include these headers.", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1;\n\tt=1775028641;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=XEzLybUS5lcDFiRN3A6zVpOULAsL4wmmfKPB8azXdXo=;\n\tb=C35aEpEXSf+ASKar4qSFqFA1X/mBAsqcDL3aGvKWo+QmsvjqlTNRbucsvPpNnPXtz4yYpl\n\tkhX2+ypuyt4kl67U3aLGB+AF/NgEgOa8fWk7oIwEGqLuLRMSzlcQw+8lLvWopz0XCfxBxW\n\tAXwld0BJnbw2/+dYZHp1STOS52f1RdE=", "From": "huiwen.he@linux.dev", "To": "smfrench@gmail.com,\n\tlinkinjeon@kernel.org,\n\tpc@manguebit.org,\n\tronniesahlberg@gmail.com,\n\tsprasad@microsoft.com,\n\ttom@talpey.com,\n\tbharathsm@microsoft.com,\n\tsenozhatsky@chromium.org,\n\tdhowells@redhat.com,\n\tchenxiaosong@kylinos.cn,\n\tchenxiaosong@chenxiaosong.com,\n\ttangyouling@kylinos.cn", "Cc": "linux-cifs@vger.kernel.org", "Subject": "[PATCH v2 07/12] smb/client: introduce KUnit test to check\n ntstatus_to_dos_map search", "Date": "Wed, 1 Apr 2026 07:29:07 +0000", "Message-ID": "<20260401072912.355072-8-huiwen.he@linux.dev>", "In-Reply-To": "<20260401072912.355072-1-huiwen.he@linux.dev>", "References": "<20260401072912.355072-1-huiwen.he@linux.dev>", "Precedence": "bulk", "X-Mailing-List": "linux-cifs@vger.kernel.org", "List-Id": "<linux-cifs.vger.kernel.org>", "List-Subscribe": "<mailto:linux-cifs+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-cifs+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Migadu-Flow": "FLOW_OUT" }, "content": "From: Youling Tang <tangyouling@kylinos.cn>\n\nCheck whether all elements can be correctly found in the array.\n\nIntroduce CONFIG_SMB1_KUNIT_TESTS for smb1maperror_test.ko since\nsmb1maperror.o is only built when CONFIG_CIFS_ALLOW_INSECURE_LEGACY\nis enabled.\n\nWe are going to define 3 functions to check the search results, introduce\nthe macro DEFINE_CHECK_SEARCH_FUNC() to reduce duplicate code.\n\nSigned-off-by: Youling Tang <tangyouling@kylinos.cn>\nReviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>\n---\n fs/smb/client/Kconfig | 11 ++++++\n fs/smb/client/Makefile | 1 +\n fs/smb/client/smb1maperror.c | 19 ++++++++++\n fs/smb/client/smb1maperror_test.c | 61 +++++++++++++++++++++++++++++++\n fs/smb/client/smb1proto.h | 4 ++\n 5 files changed, 96 insertions(+)\n create mode 100644 fs/smb/client/smb1maperror_test.c", "diff": "diff --git a/fs/smb/client/Kconfig b/fs/smb/client/Kconfig\nindex 17bd368574e9..2e72d3c8423f 100644\n--- a/fs/smb/client/Kconfig\n+++ b/fs/smb/client/Kconfig\n@@ -217,4 +217,15 @@ config CIFS_COMPRESSION\n \t Say Y here if you want SMB traffic to be compressed.\n \t If unsure, say N.\n \n+config SMB1_KUNIT_TESTS\n+\ttristate \"KUnit tests for SMB1\"\n+\tdepends on SMB_KUNIT_TESTS && CIFS_ALLOW_INSECURE_LEGACY\n+\tdefault SMB_KUNIT_TESTS\n+\thelp\n+\t This builds the SMB1-specific KUnit tests.\n+\n+\t These tests are only enabled when legacy insecure SMB1 support\n+\t (CIFS_ALLOW_INSECURE_LEGACY) is enabled.\n+\n+\t If unsure, say N.\n endif\ndiff --git a/fs/smb/client/Makefile b/fs/smb/client/Makefile\nindex 8560fe99ec2b..220a97c8a488 100644\n--- a/fs/smb/client/Makefile\n+++ b/fs/smb/client/Makefile\n@@ -71,6 +71,7 @@ $(obj)/smb2maperror.o: $(obj)/smb2_mapping_table.c\n quiet_cmd_gen_smb2_mapping = GEN $@\n cmd_gen_smb2_mapping = perl $(src)/gen_smb2_mapping $< $@\n \n+obj-$(CONFIG_SMB1_KUNIT_TESTS) += smb1maperror_test.o\n obj-$(CONFIG_SMB_KUNIT_TESTS) += smb2maperror_test.o\n \n # Let Kbuild handle tracking and cleaning\ndiff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c\nindex 0a945f9bf8de..499cacfeba6d 100644\n--- a/fs/smb/client/smb1maperror.c\n+++ b/fs/smb/client/smb1maperror.c\n@@ -288,3 +288,22 @@ int __init smb1_init_maperror(void)\n \n \treturn rc;\n }\n+\n+#if IS_ENABLED(CONFIG_SMB1_KUNIT_TESTS)\n+#define EXPORT_SYMBOL_FOR_SMB_TEST(sym) \\\n+\tEXPORT_SYMBOL_FOR_MODULES(sym, \"smb1maperror_test\")\n+\n+const struct ntstatus_to_dos_err *\n+search_ntstatus_to_dos_map_test(__u32 ntstatus)\n+{\n+\treturn search_ntstatus_to_dos_map(ntstatus);\n+}\n+EXPORT_SYMBOL_FOR_SMB_TEST(search_ntstatus_to_dos_map_test);\n+\n+const struct ntstatus_to_dos_err *\n+ntstatus_to_dos_map_test = ntstatus_to_dos_map;\n+EXPORT_SYMBOL_FOR_SMB_TEST(ntstatus_to_dos_map_test);\n+\n+unsigned int ntstatus_to_dos_num = ARRAY_SIZE(ntstatus_to_dos_map);\n+EXPORT_SYMBOL_FOR_SMB_TEST(ntstatus_to_dos_num);\n+#endif\ndiff --git a/fs/smb/client/smb1maperror_test.c b/fs/smb/client/smb1maperror_test.c\nnew file mode 100644\nindex 000000000000..f25008d149f5\n--- /dev/null\n+++ b/fs/smb/client/smb1maperror_test.c\n@@ -0,0 +1,61 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ *\n+ * KUnit tests of SMB1 maperror\n+ *\n+ * Copyright (C) 2026 KylinSoft Co., Ltd. All rights reserved.\n+ * Author(s): Youling Tang <tangyouling@kylinos.cn>\n+ * ChenXiaoSong <chenxiaosong@kylinos.cn>\n+ *\n+ */\n+\n+#include <kunit/test.h>\n+#include \"smb1proto.h\"\n+#include \"nterr.h\"\n+\n+extern const struct ntstatus_to_dos_err *ntstatus_to_dos_map_test;\n+extern unsigned int ntstatus_to_dos_num;\n+\n+#define DEFINE_CHECK_SEARCH_FUNC(__struct_name, __field,\t\t\\\n+\t\t\t\t __array, __num)\t\t\t\\\n+static void check_search_ ## __array(struct kunit *test)\t\t\\\n+{\t\t\t\t\t\t\t\t\t\\\n+\tunsigned int i;\t\t\t\t\t\t\t\\\n+\tconst struct __struct_name *expect, *result;\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\\\n+\tfor (i = 0; i < __num; i++) {\t\t\t\t\t\\\n+\t\texpect = &__array ## _test[i];\t\t\t\t\\\n+\t\tresult = search_ ## __array ## _test(expect->__field);\t\\\n+\t\tKUNIT_EXPECT_PTR_NE(test, NULL, result);\t\t\\\n+\t\ttest_cmp_ ## __struct_name(test, expect, result);\t\\\n+\t}\t\t\t\t\t\t\t\t\\\n+}\n+\n+static void\n+test_cmp_ntstatus_to_dos_err(struct kunit *test,\n+\t\t\t const struct ntstatus_to_dos_err *expect,\n+\t\t\t const struct ntstatus_to_dos_err *result)\n+{\n+\tKUNIT_EXPECT_EQ(test, expect->dos_class, result->dos_class);\n+\tKUNIT_EXPECT_EQ(test, expect->dos_code, result->dos_code);\n+\tKUNIT_EXPECT_EQ(test, expect->ntstatus, result->ntstatus);\n+\tKUNIT_EXPECT_STREQ(test, expect->nt_errstr, result->nt_errstr);\n+}\n+\n+/* check_search_ntstatus_to_dos_map */\n+DEFINE_CHECK_SEARCH_FUNC(ntstatus_to_dos_err, ntstatus, ntstatus_to_dos_map,\n+\t\t\t ntstatus_to_dos_num);\n+\n+static struct kunit_case maperror_test_cases[] = {\n+\tKUNIT_CASE(check_search_ntstatus_to_dos_map),\n+\t{}\n+};\n+\n+static struct kunit_suite maperror_suite = {\n+\t.name = \"smb1_maperror\",\n+\t.test_cases = maperror_test_cases,\n+};\n+\n+kunit_test_suite(maperror_suite);\n+\n+MODULE_LICENSE(\"GPL\");\ndiff --git a/fs/smb/client/smb1proto.h b/fs/smb/client/smb1proto.h\nindex dd98d04e837a..43b773e7964b 100644\n--- a/fs/smb/client/smb1proto.h\n+++ b/fs/smb/client/smb1proto.h\n@@ -237,6 +237,10 @@ int map_smb_to_linux_error(char *buf, bool logErr);\n int smb1_init_maperror(void);\n int map_and_check_smb_error(struct TCP_Server_Info *server,\n \t\t\t struct mid_q_entry *mid, bool logErr);\n+#if IS_ENABLED(CONFIG_SMB1_KUNIT_TESTS)\n+const struct ntstatus_to_dos_err *\n+search_ntstatus_to_dos_map_test(__u32 ntstatus);\n+#endif\n \n /*\n * smb1misc.c\n", "prefixes": [ "v2", "07/12" ] }