From patchwork Mon Dec 7 17:36:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7788561 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 775CEBEEE1 for ; Mon, 7 Dec 2015 17:37:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8E112052F for ; Mon, 7 Dec 2015 17:37:12 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id F1FDA2051A for ; Mon, 7 Dec 2015 17:37:11 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C84B01A20A2; Mon, 7 Dec 2015 09:37:11 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id 9155E1A20A0 for ; Mon, 7 Dec 2015 09:37:10 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 07 Dec 2015 09:37:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,395,1444719600"; d="scan'208";a="613994591" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.136]) by FMSMGA003.fm.intel.com with ESMTP; 07 Dec 2015 09:37:10 -0800 Subject: [PATCH] ndctl: convenience utilities for 'mapping' objects From: Dan Williams To: linux-nvdimm@lists.01.org Date: Mon, 07 Dec 2015 09:36:42 -0800 Message-ID: <20151207173642.445.46895.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Cc: Tomasz Rochumski X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 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-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add implementations for: ndctl_mapping_get_ctx ndctl_mapping_get_bus ndctl_mapping_get_region ...to allow resolving ancestor objects for a 'mapping'. Reported-by: Tomasz Rochumski Signed-off-by: Dan Williams --- lib/libndctl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/libndctl.c b/lib/libndctl.c index 6ebb4eb3d3cd..8693fb5268b8 100644 --- a/lib/libndctl.c +++ b/lib/libndctl.c @@ -2477,6 +2477,24 @@ NDCTL_EXPORT unsigned long long ndctl_mapping_get_length(struct ndctl_mapping *m return mapping->length; } +NDCTL_EXPORT struct ndctl_region *ndctl_mapping_get_region( + struct ndctl_mapping *mapping) +{ + return mapping->region; +} + +NDCTL_EXPORT struct ndctl_bus *ndctl_mapping_get_bus( + struct ndctl_mapping *mapping) +{ + return ndctl_mapping_get_region(mapping)->bus; +} + +NDCTL_EXPORT struct ndctl_ctx *ndctl_mapping_get_ctx( + struct ndctl_mapping *mapping) +{ + return ndctl_mapping_get_bus(mapping)->ctx; +} + static struct kmod_module *to_module(struct ndctl_ctx *ctx, const char *alias) { struct kmod_list *list = NULL;