From patchwork Wed Jun 6 00:00:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 10449521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B260B6053F for ; Wed, 6 Jun 2018 00:00:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79EB829765 for ; Wed, 6 Jun 2018 00:00:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00CAA29BDC; Wed, 6 Jun 2018 00:00:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 59E7029426 for ; Wed, 6 Jun 2018 00:00:46 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 456A8211E372F; Tue, 5 Jun 2018 17:00:46 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=vishal.l.verma@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D024A211E3708 for ; Tue, 5 Jun 2018 17:00:45 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2018 17:00:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,481,1520924400"; d="scan'208";a="234973714" Received: from vverma7-mobl4.lm.intel.com ([10.254.41.126]) by fmsmga006.fm.intel.com with ESMTP; 05 Jun 2018 17:00:44 -0700 From: Vishal Verma To: Subject: [ndctl PATCH] ndctl: add an api for getting ars_status flags Date: Tue, 5 Jun 2018 18:00:34 -0600 Message-Id: <20180606000034.12161-1-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.14.3 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jacek Zloch MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP The ARS status command defines a 'flags' field that wasn't being exposed via an API yet. Add a new ndctl_cmd_ars_get_flags() helper to retrieve this field. Reported-by: Jacek Zloch Cc: Dan Williams Signed-off-by: Vishal Verma --- ndctl/lib/ars.c | 10 ++++++++++ ndctl/lib/libndctl.sym | 1 + ndctl/libndctl.h | 1 + 3 files changed, 12 insertions(+) diff --git a/ndctl/lib/ars.c b/ndctl/lib/ars.c index e04b51e..b0a7ae6 100644 --- a/ndctl/lib/ars.c +++ b/ndctl/lib/ars.c @@ -269,6 +269,16 @@ NDCTL_EXPORT unsigned long long ndctl_cmd_ars_get_record_len( return ars_stat->ars_status->records[rec_index].length; } +NDCTL_EXPORT unsigned int ndctl_cmd_ars_get_flags(struct ndctl_cmd *ars_stat) +{ + struct ndctl_ctx *ctx = ndctl_bus_get_ctx(cmd_to_bus(ars_stat)); + + if (!validate_ars_stat(ctx, ars_stat)) + return 0; + + return ars_stat->ars_status->flags; +} + NDCTL_EXPORT struct ndctl_cmd *ndctl_bus_cmd_new_clear_error( unsigned long long address, unsigned long long len, struct ndctl_cmd *ars_cap) diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym index c1228e5..9940c7a 100644 --- a/ndctl/lib/libndctl.sym +++ b/ndctl/lib/libndctl.sym @@ -365,4 +365,5 @@ global: ndctl_cmd_ars_cap_get_clear_unit; ndctl_namespace_inject_error2; ndctl_namespace_uninject_error2; + ndctl_cmd_ars_get_flags; } LIBNDCTL_15; diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h index be997ac..99218e6 100644 --- a/ndctl/libndctl.h +++ b/ndctl/libndctl.h @@ -210,6 +210,7 @@ struct ndctl_cmd *ndctl_bus_cmd_new_clear_error(unsigned long long address, unsigned long long ndctl_cmd_clear_error_get_cleared( struct ndctl_cmd *clear_err); unsigned int ndctl_cmd_ars_cap_get_clear_unit(struct ndctl_cmd *ars_cap); +unsigned int ndctl_cmd_ars_get_flags(struct ndctl_cmd *ars_stat); /* * Note: ndctl_cmd_smart_get_temperature is an alias for