From nobody Fri Aug 16 02:30:25 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WlQvQ2lsDz5TLCb; Fri, 16 Aug 2024 02:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WlQvQ0fS0z4b4X; Fri, 16 Aug 2024 02:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723775426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HoIo1/Bi90miv44QpPYoJ/hLZPOouYwrAq0qR5+vFfs=; b=RoeN2E6cqAg4IU+AL7zPr5lGXRdandbLipBtgK8nSrR0XC9NP4mCLINqh0BVEVQA6Q6CvS o59iCKxXTRmfCBN9Off7S8HZJ9qd0J2A4dcW7tZWfQBoHUDdUSGnDo8SM1qI75RKhpgbgK I97cwgZ7xBKF+siCj4d6A09AjIDszTgXbyuEhETTH7bc0Zln3AUeK7d3CacjcRQFOfcJeh SoPMJtbEn7qpwutspjICb6sgf75OP5oZjvVtOquuEASY6OBfxoxCknYbVVo4D1GRkZUNZX oHRRAoSVX+JQsY97bXFyuQW2Ia2LK69jK1Oc9b6LHIfrsVwgYYi7Ic/2N1ZA9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723775426; a=rsa-sha256; cv=none; b=YU7YpdySUOBSZp3UzIqr6SQPhsqizBODOmW6k73GpKuO2FxjcFH0Dkj6VKYitVTN6Xvd7r SAjEF6Yqz4dP3UsredvDbKe7Cvdo8zPR9npE8p4Fx204865Od4aiKSzaRg7o6e7a6cXbj9 23MPmYkqCxPHF865IIRWPCMwVjPhx/cvQJq1OaCveo33JJMg0XqiaktB3D7QcSiXae6Qgx klYXpoghVWxr1n33spcx14S02HxbHeG6xP87cTXH5btzvVYzjnC7WxolWrS9Kw42bHQPyZ ZS7JQ105CqkKdiGtnCiLHyUn7fN74T33U9AbQc49p6G3cQvk6LV8Wg5cBDQ3nA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723775426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HoIo1/Bi90miv44QpPYoJ/hLZPOouYwrAq0qR5+vFfs=; b=fpfkCLBVvA7QAKdB2OjYPFwJT8J4/4VmXvEyNYLYwKNdjJXFGEMUsgdETP8ksFwQ4/lsI+ Qtxka6GvAZzUiKtaGFnVhgJI6ES/kLnUwPvm3S5KyYAZ0uBohuWkXSDh7tG92S9xpLteUd 1odoSHY21dK0FIEZsQs4538hnt+xF6+9WBwy4ZVLBlSnJq0NM5Y90eR2AydQ5k/PvNpbfD AIGTbF+pNtDGU9giTourizcrMqmEBEjqd/9/rbmNKsHb08l8GhtEkJDpzIJOqG7O8YlNHX rEH7/fn1vIfyzf75KBo6rI3VbCTUfztnho3zUNgFpAQHBjs9iJkXZYGz6lCrJQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WlQvP6s53zpBR; Fri, 16 Aug 2024 02:30:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47G2UP7p045874; Fri, 16 Aug 2024 02:30:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47G2UP4V045871; Fri, 16 Aug 2024 02:30:25 GMT (envelope-from git) Date: Fri, 16 Aug 2024 02:30:25 GMT Message-Id: <202408160230.47G2UP4V045871@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a233cb6914e6 - main - nvmecontrol: Accept -a {1,2,3,4} for sanitize command for nvme-cli compat List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a233cb6914e68252baf143c5f1d6e01e3956e33e Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a233cb6914e68252baf143c5f1d6e01e3956e33e commit a233cb6914e68252baf143c5f1d6e01e3956e33e Author: Warner Losh AuthorDate: 2024-08-15 21:10:17 +0000 Commit: Warner Losh CommitDate: 2024-08-16 02:22:31 +0000 nvmecontrol: Accept -a {1,2,3,4} for sanitize command for nvme-cli compat Linux's `nvme sanititze -a` takes a number, not a string. Accept 1-4 for compatibility so vendor's recepies are easier to implmement. Sponsored by: Netflix --- sbin/nvmecontrol/nvmecontrol.8 | 10 ++++++++++ sbin/nvmecontrol/sanitize.c | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 713fcf092d64..cb3e8aa9080f 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -572,6 +572,16 @@ A failed sanitize operation can only be exited if it was run in the unrestricted completion mode, as provided by the .Fl U argument. +.It 1, 2, 3, 4 +nvme-cli compatible +.Fl a +values for +.Dq exitfailure , +.Dq block , +.Dq overwrite , +and +.Dq crypto +respectively. .El .It Fl c Ar passes The number of passes when performing an diff --git a/sbin/nvmecontrol/sanitize.c b/sbin/nvmecontrol/sanitize.c index ba89e138db83..e720c6d43497 100644 --- a/sbin/nvmecontrol/sanitize.c +++ b/sbin/nvmecontrol/sanitize.c @@ -130,8 +130,11 @@ sanitize(const struct cmd *f, int argc, char *argv[]) sanact = 3; else if (strcmp(opt.sanact, "crypto") == 0) sanact = 4; + else if ((sanact = (int)strtol(opt.sanact, NULL, 10) != 0) + && (sanact >= 1 && sanact <= 4)) + ; /* compat with nvme sanitize -a number */ else { - fprintf(stderr, "Incorrect Sanitize Action value\n"); + fprintf(stderr, "Incorrect Sanitize Action value: %s\n", opt.sanact); arg_help(argc, argv, f); } }