From patchwork Fri Dec 1 23:24:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10088271 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 A71C96035E for ; Fri, 1 Dec 2017 23:33:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95F1A2A820 for ; Fri, 1 Dec 2017 23:33:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9481B2A82A; Fri, 1 Dec 2017 23:33:02 +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=-1.9 required=2.0 tests=BAYES_00, 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 C76142A828 for ; Fri, 1 Dec 2017 23:33:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C175621A10987; Fri, 1 Dec 2017 15:28:34 -0800 (PST) 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.65; helo=mga03.intel.com; envelope-from=dan.j.williams@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 0454021A10961 for ; Fri, 1 Dec 2017 15:28:33 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Dec 2017 15:33:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,347,1508828400"; d="scan'208";a="182617010" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga005.fm.intel.com with ESMTP; 01 Dec 2017 15:33:00 -0800 Subject: [ndctl PATCH 03/17] ndctl, smart: rename 'temperature' helpers to 'media_temperature' From: Dan Williams To: linux-nvdimm@lists.01.org Date: Fri, 01 Dec 2017 15:24:45 -0800 Message-ID: <151217068584.28402.9909444496961087237.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <151217066885.28402.7962437173336388439.stgit@dwillia2-desk3.amr.corp.intel.com> References: <151217066885.28402.7962437173336388439.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP In preparation for adding controller temperature support rename the current ambiguous 'temperature' to 'media_temperature'. Signed-off-by: Dan Williams --- ndctl/lib/hpe1.c | 10 ++++++---- ndctl/lib/libndctl.sym | 2 ++ ndctl/lib/msft.c | 4 ++-- ndctl/lib/private.h | 4 ++-- ndctl/lib/smart.c | 34 ++++++++++++++++++++++++++++++---- ndctl/libndctl.h.in | 17 +++++++++++++++++ 6 files changed, 59 insertions(+), 12 deletions(-) diff --git a/ndctl/lib/hpe1.c b/ndctl/lib/hpe1.c index addebe952ce6..81f60ab27a07 100644 --- a/ndctl/lib/hpe1.c +++ b/ndctl/lib/hpe1.c @@ -134,7 +134,7 @@ static unsigned int hpe1_cmd_smart_get_health(struct ndctl_cmd *cmd) return health; } -static unsigned int hpe1_cmd_smart_get_temperature(struct ndctl_cmd *cmd) +static unsigned int hpe1_cmd_smart_get_media_temperature(struct ndctl_cmd *cmd) { if (hpe1_smart_valid(cmd) < 0) return UINT_MAX; @@ -279,7 +279,8 @@ static unsigned int hpe1_cmd_smart_threshold_get_alarm_control(struct ndctl_cmd return flags; } -static unsigned int hpe1_cmd_smart_threshold_get_temperature(struct ndctl_cmd *cmd) +static unsigned int hpe1_cmd_smart_threshold_get_media_temperature( + struct ndctl_cmd *cmd) { if (hpe1_smart_threshold_valid(cmd) < 0) return UINT_MAX; @@ -299,7 +300,7 @@ struct ndctl_smart_ops * const hpe1_smart_ops = &(struct ndctl_smart_ops) { .new_smart = hpe1_dimm_cmd_new_smart, .smart_get_flags = hpe1_cmd_smart_get_flags, .smart_get_health = hpe1_cmd_smart_get_health, - .smart_get_temperature = hpe1_cmd_smart_get_temperature, + .smart_get_media_temperature = hpe1_cmd_smart_get_media_temperature, .smart_get_spares = hpe1_cmd_smart_get_spares, .smart_get_alarm_flags = hpe1_cmd_smart_get_alarm_flags, .smart_get_life_used = hpe1_cmd_smart_get_life_used, @@ -308,6 +309,7 @@ struct ndctl_smart_ops * const hpe1_smart_ops = &(struct ndctl_smart_ops) { .smart_get_vendor_data = hpe1_cmd_smart_get_vendor_data, .new_smart_threshold = hpe1_dimm_cmd_new_smart_threshold, .smart_threshold_get_alarm_control = hpe1_cmd_smart_threshold_get_alarm_control, - .smart_threshold_get_temperature = hpe1_cmd_smart_threshold_get_temperature, + .smart_threshold_get_media_temperature = + hpe1_cmd_smart_threshold_get_media_temperature, .smart_threshold_get_spares = hpe1_cmd_smart_threshold_get_spares, }; diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym index 30480074d2ef..b3fab6232df6 100644 --- a/ndctl/lib/libndctl.sym +++ b/ndctl/lib/libndctl.sym @@ -310,4 +310,6 @@ global: ndctl_namespace_injection_get_next_bb; ndctl_bb_get_block; ndctl_bb_get_count; + ndctl_cmd_smart_get_media_temperature; + ndctl_cmd_smart_threshold_get_media_temperature; } LIBNDCTL_13; diff --git a/ndctl/lib/msft.c b/ndctl/lib/msft.c index 1c4c8913714f..d61c065e752d 100644 --- a/ndctl/lib/msft.c +++ b/ndctl/lib/msft.c @@ -120,7 +120,7 @@ static unsigned int msft_cmd_smart_get_health(struct ndctl_cmd *cmd) return health; } -static unsigned int msft_cmd_smart_get_temperature(struct ndctl_cmd *cmd) +static unsigned int msft_cmd_smart_get_media_temperature(struct ndctl_cmd *cmd) { if (msft_smart_valid(cmd) < 0) return UINT_MAX; @@ -140,6 +140,6 @@ struct ndctl_smart_ops * const msft_smart_ops = &(struct ndctl_smart_ops) { .new_smart = msft_dimm_cmd_new_smart, .smart_get_flags = msft_cmd_smart_get_flags, .smart_get_health = msft_cmd_smart_get_health, - .smart_get_temperature = msft_cmd_smart_get_temperature, + .smart_get_media_temperature = msft_cmd_smart_get_media_temperature, .smart_get_life_used = msft_cmd_smart_get_life_used, }; diff --git a/ndctl/lib/private.h b/ndctl/lib/private.h index 685d65d89a06..c2ce519ebad2 100644 --- a/ndctl/lib/private.h +++ b/ndctl/lib/private.h @@ -288,7 +288,7 @@ struct ndctl_smart_ops { struct ndctl_cmd *(*new_smart)(struct ndctl_dimm *); unsigned int (*smart_get_flags)(struct ndctl_cmd *); unsigned int (*smart_get_health)(struct ndctl_cmd *); - unsigned int (*smart_get_temperature)(struct ndctl_cmd *); + unsigned int (*smart_get_media_temperature)(struct ndctl_cmd *); unsigned int (*smart_get_spares)(struct ndctl_cmd *); unsigned int (*smart_get_alarm_flags)(struct ndctl_cmd *); unsigned int (*smart_get_life_used)(struct ndctl_cmd *); @@ -298,7 +298,7 @@ struct ndctl_smart_ops { unsigned char *(*smart_get_vendor_data)(struct ndctl_cmd *); struct ndctl_cmd *(*new_smart_threshold)(struct ndctl_dimm *); unsigned int (*smart_threshold_get_alarm_control)(struct ndctl_cmd *); - unsigned int (*smart_threshold_get_temperature)(struct ndctl_cmd *); + unsigned int (*smart_threshold_get_media_temperature)(struct ndctl_cmd *); unsigned int (*smart_threshold_get_spares)(struct ndctl_cmd *); }; diff --git a/ndctl/lib/smart.c b/ndctl/lib/smart.c index 1821af2289d3..d30288a1486a 100644 --- a/ndctl/lib/smart.c +++ b/ndctl/lib/smart.c @@ -53,7 +53,8 @@ NDCTL_EXPORT rettype name(struct ndctl_cmd *cmd) \ smart_cmd_op(ndctl_cmd_smart_get_flags, smart_get_flags, unsigned int, 0) smart_cmd_op(ndctl_cmd_smart_get_health, smart_get_health, unsigned int, 0) -smart_cmd_op(ndctl_cmd_smart_get_temperature, smart_get_temperature, unsigned int, 0) +smart_cmd_op(ndctl_cmd_smart_get_media_temperature, smart_get_media_temperature, + unsigned int, 0) smart_cmd_op(ndctl_cmd_smart_get_spares, smart_get_spares, unsigned int, 0) smart_cmd_op(ndctl_cmd_smart_get_alarm_flags, smart_get_alarm_flags, unsigned int, 0) smart_cmd_op(ndctl_cmd_smart_get_life_used, smart_get_life_used, unsigned int, 0) @@ -62,9 +63,21 @@ smart_cmd_op(ndctl_cmd_smart_get_shutdown_count, smart_get_shutdown_count, unsig smart_cmd_op(ndctl_cmd_smart_get_vendor_size, smart_get_vendor_size, unsigned int, 0) smart_cmd_op(ndctl_cmd_smart_get_vendor_data, smart_get_vendor_data, unsigned char *, NULL) smart_cmd_op(ndctl_cmd_smart_threshold_get_alarm_control, smart_threshold_get_alarm_control, unsigned int, 0) -smart_cmd_op(ndctl_cmd_smart_threshold_get_temperature, smart_threshold_get_temperature, unsigned int, 0) +smart_cmd_op(ndctl_cmd_smart_threshold_get_media_temperature, + smart_threshold_get_media_temperature, unsigned int, 0) smart_cmd_op(ndctl_cmd_smart_threshold_get_spares, smart_threshold_get_spares, unsigned int, 0) +NDCTL_EXPORT unsigned int ndctl_cmd_smart_get_temperature(struct ndctl_cmd *cmd) +{ + return ndctl_cmd_smart_get_media_temperature(cmd); +} + +NDCTL_EXPORT unsigned int ndctl_cmd_smart_threshold_get_temperature( + struct ndctl_cmd *cmd) +{ + return ndctl_cmd_smart_threshold_get_media_temperature(cmd); +} + /* * The following intel_dimm_*() and intel_smart_*() functions implement * the ndctl_smart_ops for the Intel DSM family (NVDIMM_FAMILY_INTEL): @@ -126,6 +139,12 @@ intel_smart_get_field(cmd, shutdown_state) intel_smart_get_field(cmd, shutdown_count) intel_smart_get_field(cmd, vendor_size) +static unsigned int intel_cmd_smart_get_media_temperature( + struct ndctl_cmd *cmd) +{ + return intel_cmd_smart_get_temperature(cmd); +} + static unsigned char *intel_cmd_smart_get_vendor_data(struct ndctl_cmd *cmd) { struct nd_smart_payload *smart_data; @@ -159,6 +178,12 @@ intel_smart_threshold_get_field(cmd, alarm_control) intel_smart_threshold_get_field(cmd, temperature) intel_smart_threshold_get_field(cmd, spares) +static unsigned int intel_cmd_smart_threshold_get_media_temperature( + struct ndctl_cmd *cmd) +{ + return intel_cmd_smart_threshold_get_temperature(cmd); +} + static struct ndctl_cmd *intel_dimm_cmd_new_smart_threshold( struct ndctl_dimm *dimm) { @@ -193,7 +218,7 @@ struct ndctl_smart_ops * const intel_smart_ops = &(struct ndctl_smart_ops) { .new_smart = intel_dimm_cmd_new_smart, .smart_get_flags = intel_cmd_smart_get_flags, .smart_get_health = intel_cmd_smart_get_health, - .smart_get_temperature = intel_cmd_smart_get_temperature, + .smart_get_media_temperature = intel_cmd_smart_get_media_temperature, .smart_get_spares = intel_cmd_smart_get_spares, .smart_get_alarm_flags = intel_cmd_smart_get_alarm_flags, .smart_get_life_used = intel_cmd_smart_get_life_used, @@ -203,6 +228,7 @@ struct ndctl_smart_ops * const intel_smart_ops = &(struct ndctl_smart_ops) { .smart_get_vendor_data = intel_cmd_smart_get_vendor_data, .new_smart_threshold = intel_dimm_cmd_new_smart_threshold, .smart_threshold_get_alarm_control = intel_cmd_smart_threshold_get_alarm_control, - .smart_threshold_get_temperature = intel_cmd_smart_threshold_get_temperature, + .smart_threshold_get_media_temperature + = intel_cmd_smart_threshold_get_media_temperature, .smart_threshold_get_spares = intel_cmd_smart_threshold_get_spares, }; diff --git a/ndctl/libndctl.h.in b/ndctl/libndctl.h.in index fb77d243a893..298adff476c7 100644 --- a/ndctl/libndctl.h.in +++ b/ndctl/libndctl.h.in @@ -275,12 +275,18 @@ static inline unsigned long long ndctl_cmd_clear_error_get_cleared( } #endif +/* + * Note: ndctl_cmd_smart_get_temperature is an alias for + * ndctl_cmd_smart_get_temperature + */ + #define HAS_SMART HAVE_NDCTL_SMART #if HAS_SMART == 1 struct ndctl_cmd *ndctl_dimm_cmd_new_smart(struct ndctl_dimm *dimm); unsigned int ndctl_cmd_smart_get_flags(struct ndctl_cmd *cmd); unsigned int ndctl_cmd_smart_get_health(struct ndctl_cmd *cmd); unsigned int ndctl_cmd_smart_get_temperature(struct ndctl_cmd *cmd); +unsigned int ndctl_cmd_smart_get_media_temperature(struct ndctl_cmd *cmd); unsigned int ndctl_cmd_smart_get_spares(struct ndctl_cmd *cmd); unsigned int ndctl_cmd_smart_get_alarm_flags(struct ndctl_cmd *cmd); unsigned int ndctl_cmd_smart_get_life_used(struct ndctl_cmd *cmd); @@ -291,6 +297,7 @@ unsigned char *ndctl_cmd_smart_get_vendor_data(struct ndctl_cmd *cmd); struct ndctl_cmd *ndctl_dimm_cmd_new_smart_threshold(struct ndctl_dimm *dimm); unsigned int ndctl_cmd_smart_threshold_get_alarm_control(struct ndctl_cmd *cmd); unsigned int ndctl_cmd_smart_threshold_get_temperature(struct ndctl_cmd *cmd); +unsigned int ndctl_cmd_smart_threshold_get_media_temperature(struct ndctl_cmd *cmd); unsigned int ndctl_cmd_smart_threshold_get_spares(struct ndctl_cmd *cmd); #else static inline struct ndctl_cmd *ndctl_dimm_cmd_new_smart(struct ndctl_dimm *dimm) @@ -309,6 +316,11 @@ static inline unsigned int ndctl_cmd_smart_get_temperature(struct ndctl_cmd *cmd { return 0; } +static inline unsigned int ndctl_cmd_smart_get_media_temperature( + struct ndctl_cmd *cmd) +{ + return 0; +} static inline unsigned int ndctl_cmd_smart_get_spares(struct ndctl_cmd *cmd) { return 0; @@ -352,6 +364,11 @@ static inline unsigned int ndctl_cmd_smart_threshold_get_temperature( { return 0; } +static inline unsigned int ndctl_cmd_smart_threshold_get_media_temperature( + struct ndctl_cmd *cmd) +{ + return 0; +} static inline unsigned int ndctl_cmd_smart_threshold_get_spares( struct ndctl_cmd *cmd) {