Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2218401/?format=api
{ "id": 2218401, "url": "http://patchwork.ozlabs.org/api/patches/2218401/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260401072912.355072-10-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-10-huiwen.he@linux.dev>", "list_archive_url": null, "date": "2026-04-01T07:29:09", "name": "[v2,09/12] smb/client: autogenerate SMB1 DOS/SRV to POSIX error mapping", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f2d2fc42eacf2390d22432d00cf04a7e3878a7e0", "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-10-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/2218401/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2218401/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-cifs+bounces-10614-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=HZT2/nUk;\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-10614-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=\"HZT2/nUk\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=91.218.175.179", "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 4flxcR4bWHz1yGH\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 18:36:07 +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 531C630F88BB\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 1 Apr 2026 07:33:39 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 9025F39769E;\n\tWed, 1 Apr 2026 07:30:50 +0000 (UTC)", "from out-179.mta0.migadu.com (out-179.mta0.migadu.com\n [91.218.175.179])\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 0A08A391846\n\tfor <linux-cifs@vger.kernel.org>; Wed, 1 Apr 2026 07:30:48 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775028650; cv=none;\n b=UW3hUKVIMEa0JZHvt3cg4hWLVEYtVaiZhw2zQzdQQWqgB8WdFEdekPmPnWUA2ZLkhQj272a4sdKkTjt34eDfJPRRF+tvdCqR0dnbNdxU6ia43kbLS+mg2CUpGDf2WQzMZ8RhMePqmXAqneOUr9QyeQIuAQHM+VUZKAeo7+Q7dcg=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775028650; c=relaxed/simple;\n\tbh=xSOe+JewmnPFOSctjnNFy4BnCEeeasVzRxI8dTTX6CE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=jcuSMsrwRUnYXDtGP77FpXAh7GTnN3yjZ7r7MVI7nT2KHpREzcHjzr9RF26crTyrhG6QES6zIKo53UgAKuvna4/xps3n3GI/ScN2LnuTb9EugmWac6pi6MNTuL2PD90u3BqXMu14tojN+IZL5Qr3sqvDgTpmSfatj0n2zShuTXA=", "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=HZT2/nUk; arc=none smtp.client-ip=91.218.175.179", "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=1775028647;\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=cVVaEgzTXrfPR0ajrjHi80OSpSlNLx/inE6YDoc2LFA=;\n\tb=HZT2/nUk4qpSfhjrWSAteFeFHI67tmc67bO5I+O+nGCKH2oNdrBbSVXpqDnxZZjTCyGzM/\n\t4x9RU4PuLDTHXx7Ly1tlPrdNfWxO2qH1/ODgHvU2ijI55wjfNn7sy/xtvsxqzUwYD6zQUz\n\tRgZiXQWGXgmSIcZg+rd4WLS1wrnlf28=", "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,\n\tHuiwen He <hehuiwen@kylinos.cn>", "Subject": "[PATCH v2 09/12] smb/client: autogenerate SMB1 DOS/SRV to POSIX error\n mapping", "Date": "Wed, 1 Apr 2026 07:29:09 +0000", "Message-ID": "<20260401072912.355072-10-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: Huiwen He <hehuiwen@kylinos.cn>\n\nExtend the `gen_smb1_mapping` script to support generating sorted POSIX\nerror mapping tables for both ERRDOS and ERRSRV classes at compile time.\n\nThe script parses annotations from smberr.h to generate smb1_err_dos_map.c\nand smb1_err_srv_map.c, which are included as the contents of the arrays\nmapping_table_ERRDOS[] and mapping_table_ERRSRV[], respectively.\n\nThis ensures that the mapping logic remains synchronized with the source\nheaders and prepares for faster error lookups using binary search in the\nfuture.\n\nSigned-off-by: Huiwen He <hehuiwen@kylinos.cn>\nReviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>\n---\n fs/smb/client/.gitignore | 2 +\n fs/smb/client/Makefile | 9 +++-\n fs/smb/client/gen_smb1_mapping | 25 ++++++++++\n fs/smb/client/smb1maperror.c | 85 ++++------------------------------\n fs/smb/client/smberr.h | 12 ++++-\n 5 files changed, 54 insertions(+), 79 deletions(-)", "diff": "diff --git a/fs/smb/client/.gitignore b/fs/smb/client/.gitignore\nindex d5ea5ac6015d..66e6e2ade0bd 100644\n--- a/fs/smb/client/.gitignore\n+++ b/fs/smb/client/.gitignore\n@@ -1,2 +1,4 @@\n smb1_mapping_table.c\n+smb1_err_dos_map.c\n+smb1_err_srv_map.c\n smb2_mapping_table.c\ndiff --git a/fs/smb/client/Makefile b/fs/smb/client/Makefile\nindex 220a97c8a488..6e83b5204699 100644\n--- a/fs/smb/client/Makefile\n+++ b/fs/smb/client/Makefile\n@@ -46,13 +46,18 @@ cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o\n \n ifneq ($(CONFIG_CIFS_ALLOW_INSECURE_LEGACY),)\n #\n-# Build the SMB1 error mapping tables from nterr.h\n+# Build the SMB1 error mapping tables from nterr.h and smberr.h\n #\n-smb1-gen-y := smb1_mapping_table.c\n+smb1-gen-y := smb1_mapping_table.c \\\n+\t smb1_err_dos_map.c \\\n+\t smb1_err_srv_map.c\n \n $(obj)/smb1_mapping_table.c: $(src)/nterr.h $(src)/gen_smb1_mapping FORCE\n \t$(call if_changed,gen_smb1_mapping)\n \n+$(obj)/smb1_err_%.c: $(src)/smberr.h $(src)/gen_smb1_mapping FORCE\n+\t$(call if_changed,gen_smb1_mapping)\n+\n $(obj)/smb1maperror.o: $(addprefix $(obj)/, $(smb1-gen-y))\n \n quiet_cmd_gen_smb1_mapping = GEN $@\ndiff --git a/fs/smb/client/gen_smb1_mapping b/fs/smb/client/gen_smb1_mapping\nindex 52ea4fdccbcd..51a77e745bfa 100644\n--- a/fs/smb/client/gen_smb1_mapping\n+++ b/fs/smb/client/gen_smb1_mapping\n@@ -21,6 +21,7 @@ my $input_name = (split m|/|, $in_file)[-1];\n my $script_name = (split m|/|, $0)[-1];\n my @list = ();\n my %seen = ();\n+my $current_class = \"\";\n \n # Parse annotated entries from the input file\n open(my $in, \"<\", $in_file) or die \"Cannot open $in_file: $!\";\n@@ -45,6 +46,20 @@ if ($in_file =~ /nterr\\.h$/) {\n \t\t\tpush @list, { val => $val, name => $name, class => $class, code => $code };\n \t\t}\n \t}\n+} elsif ($in_file =~ /smberr\\.h$/) {\n+\twhile (<$in>) {\n+\t\t# Detect current error class from header comments (ERRDOS or ERRSRV)\n+\t\tif (/generated with the (\\w+) error class/) {\n+\t\t\t$current_class = $1;\n+\t\t}\n+\n+\t\t# Match #define ERR... <value> // -POSIX_ERR\n+\t\tif (/^\\s*#define\\s+(ERR[A-Za-z0-9_]+)\\s+([0-9a-fA-FxX]+)\\s*\\/\\/\\s*(-[A-Z0-9_]+)/) {\n+\t\t\tmy ($name, $val_str, $error) = ($1, $2, $3);\n+\t\t\tmy $val = ($val_str =~ /^0x/i) ? hex($val_str) : $val_str;\n+\t\t\tpush @list, { val => $val, name => $name, error => $error, class => $current_class };\n+\t\t}\n+\t}\n }\n close($in);\n \n@@ -80,5 +95,15 @@ if ($in_file =~ /nterr\\.h$/) {\n \n \t\t$full_names = \"\";\n \t}\n+} elsif ($in_file =~ /smberr\\.h$/) {\n+\t# Generate SMB1 error -> POSIX error mapping file smb1_err_dos_map.c and smb1_err_srv_map.c\n+\n+\t# Filtered by dos/srv\n+\tmy $filter = ($out_file =~ /dos/) ? \"ERRDOS\" : ($out_file =~ /srv/ ? \"ERRSRV\" : \"\");\n+\tforeach my $e (@list) {\n+\t\tif (!$filter || $e->{class} eq $filter) {\n+\t\t\tprintf $out \"\\t{%s, %s},\\n\", $e->{name}, $e->{error};\n+\t\t}\n+\t}\n }\n close($out);\ndiff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c\nindex 499cacfeba6d..bed579afc37b 100644\n--- a/fs/smb/client/smb1maperror.c\n+++ b/fs/smb/client/smb1maperror.c\n@@ -21,85 +21,20 @@ struct smb_to_posix_error {\n };\n \n static const struct smb_to_posix_error mapping_table_ERRDOS[] = {\n-\t{ERRbadfunc, -EINVAL},\n-\t{ERRbadfile, -ENOENT},\n-\t{ERRbadpath, -ENOTDIR},\n-\t{ERRnofids, -EMFILE},\n-\t{ERRnoaccess, -EACCES},\n-\t{ERRbadfid, -EBADF},\n-\t{ERRbadmcb, -EIO},\n-\t{ERRnomem, -EREMOTEIO},\n-\t{ERRbadmem, -EFAULT},\n-\t{ERRbadenv, -EFAULT},\n-\t{ERRbadformat, -EINVAL},\n-\t{ERRbadaccess, -EACCES},\n-\t{ERRbaddata, -EIO},\n-\t{ERRbaddrive, -ENXIO},\n-\t{ERRremcd, -EACCES},\n-\t{ERRdiffdevice, -EXDEV},\n-\t{ERRnofiles, -ENOENT},\n-\t{ERRwriteprot, -EROFS},\n-\t{ERRbadshare, -EBUSY},\n-\t{ERRlock, -EACCES},\n-\t{ERRunsup, -EINVAL},\n-\t{ERRnosuchshare, -ENXIO},\n-\t{ERRfilexists, -EEXIST},\n-\t{ERRinvparm, -EINVAL},\n-\t{ERRdiskfull, -ENOSPC},\n-\t{ERRinvname, -ENOENT},\n-\t{ERRunknownlevel, -EOPNOTSUPP},\n-\t{ERRdirnotempty, -ENOTEMPTY},\n-\t{ERRnotlocked, -ENOLCK},\n-\t{ERRcancelviolation, -ENOLCK},\n-\t{ERRalreadyexists, -EEXIST},\n-\t{ERRmoredata, -EOVERFLOW},\n-\t{ERReasnotsupported, -EOPNOTSUPP},\n-\t{ErrQuota, -EDQUOT},\n-\t{ErrNotALink, -ENOLINK},\n-\t{ERRnetlogonNotStarted, -ENOPROTOOPT},\n-\t{ERRsymlink, -EOPNOTSUPP},\n-\t{ErrTooManyLinks, -EMLINK},\n+/*\n+ * Automatically generated by the `gen_smb1_mapping` script,\n+ * sorted by DOS error code (ascending).\n+ */\n+#include \"smb1_err_dos_map.c\"\n \t{0, 0}\n };\n \n static const struct smb_to_posix_error mapping_table_ERRSRV[] = {\n-\t{ERRerror, -EIO},\n-\t{ERRbadpw, -EACCES}, /* was EPERM */\n-\t{ERRbadtype, -EREMOTE},\n-\t{ERRaccess, -EACCES},\n-\t{ERRinvtid, -ENXIO},\n-\t{ERRinvnetname, -ENXIO},\n-\t{ERRinvdevice, -ENXIO},\n-\t{ERRqfull, -ENOSPC},\n-\t{ERRqtoobig, -ENOSPC},\n-\t{ERRqeof, -EIO},\n-\t{ERRinvpfid, -EBADF},\n-\t{ERRsmbcmd, -EBADRQC},\n-\t{ERRsrverror, -EIO},\n-\t{ERRbadBID, -EIO},\n-\t{ERRfilespecs, -EINVAL},\n-\t{ERRbadLink, -EIO},\n-\t{ERRbadpermits, -EINVAL},\n-\t{ERRbadPID, -ESRCH},\n-\t{ERRsetattrmode, -EINVAL},\n-\t{ERRpaused, -EHOSTDOWN},\n-\t{ERRmsgoff, -EHOSTDOWN},\n-\t{ERRnoroom, -ENOSPC},\n-\t{ERRrmuns, -EUSERS},\n-\t{ERRtimeout, -ETIME},\n-\t{ERRnoresource, -EREMOTEIO},\n-\t{ERRtoomanyuids, -EUSERS},\n-\t{ERRbaduid, -EACCES},\n-\t{ERRusempx, -EIO},\n-\t{ERRusestd, -EIO},\n-\t{ERR_NOTIFY_ENUM_DIR, -ENOBUFS},\n-\t{ERRnoSuchUser, -EACCES},\n-\t{ERRaccountexpired, -EKEYEXPIRED},\n-\t{ERRbadclient, -EACCES},\n-\t{ERRbadLogonTime, -EACCES},\n-\t{ERRpasswordExpired, -EKEYEXPIRED},\n-\n-\t{ERRnosupport, -EINVAL},\n+/*\n+ * Automatically generated by the `gen_smb1_mapping` script,\n+ * sorted by SRV error code (ascending).\n+ */\n+#include \"smb1_err_srv_map.c\"\n \t{0, 0}\n };\n \ndiff --git a/fs/smb/client/smberr.h b/fs/smb/client/smberr.h\nindex a848b6ad987a..98074c64587d 100644\n--- a/fs/smb/client/smberr.h\n+++ b/fs/smb/client/smberr.h\n@@ -24,7 +24,11 @@\n \n /*#define SUCCESS\t0\tThe request was successful. */\n \n-/* The following error codes may be generated with the ERRDOS error class.*/\n+/*\n+ * The following error codes may be generated with the ERRDOS error class.\n+ * The comment at the end of each definition indicates the POSIX error\n+ * code; it is used to generate the `mapping_table_ERRDOS` array.\n+ */\n \n /*\n * Invalid function. The server did not\n@@ -161,7 +165,11 @@\n #define ERRsymlink 0xFFFD\t// -EOPNOTSUPP\n #define ErrTooManyLinks 0xFFFE\t// -EMLINK\n \n-/* Following error codes may be generated with the ERRSRV error class.*/\n+/*\n+ * The following error codes may be generated with the ERRSRV error class.\n+ * The comment at the end of each definition indicates the POSIX error\n+ * code; it is used to generate the `mapping_table_ERRSRV` array.\n+ */\n \n /*\n * Non-specific error code. It is\n", "prefixes": [ "v2", "09/12" ] }