All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH 5/8] libndctl: add ndctl_cmd_cfg_read_get_size()
Date: Wed, 19 Oct 2016 09:48:15 -0700	[thread overview]
Message-ID: <147689569519.11015.13966814247817280212.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <147689566876.11015.13898062253087685236.stgit@dwillia2-desk3.amr.corp.intel.com>

Allow the size of the configuration label region to be retrieved from
the cfg_read command.  This lets applications pass around a successful
cfg_read command object and not need access to the original cfg_size
command.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/lib/libndctl.c   |    9 +++++++++
 ndctl/lib/libndctl.sym |    1 +
 ndctl/libndctl.h.in    |    1 +
 3 files changed, 11 insertions(+)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 7d870b082cd4..82b11a0d3ac9 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -2057,6 +2057,15 @@ NDCTL_EXPORT ssize_t ndctl_cmd_cfg_read_get_data(struct ndctl_cmd *cfg_read,
 	return len;
 }
 
+NDCTL_EXPORT ssize_t ndctl_cmd_cfg_read_get_size(struct ndctl_cmd *cfg_read)
+{
+	if (cfg_read->type != ND_CMD_GET_CONFIG_DATA || cfg_read->status > 0)
+		return -EINVAL;
+	if (cfg_read->status < 0)
+		return cfg_read->status;
+	return cfg_read->iter.total_xfer;
+}
+
 NDCTL_EXPORT ssize_t ndctl_cmd_cfg_write_set_data(struct ndctl_cmd *cfg_write,
 		void *buf, unsigned int len, unsigned int offset)
 {
diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index dfc44ae51362..6bd032ea7526 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -210,6 +210,7 @@ global:
 	ndctl_btt_is_configured;
 	ndctl_cmd_cfg_size_get_size;
 	ndctl_cmd_cfg_read_get_data;
+	ndctl_cmd_cfg_read_get_size;
 	ndctl_cmd_cfg_write_set_data;
 	ndctl_cmd_cfg_write_zero_data;
 	ndctl_cmd_unref;
diff --git a/ndctl/libndctl.h.in b/ndctl/libndctl.h.in
index 803368bc1acd..d3379f76e1f9 100644
--- a/ndctl/libndctl.h.in
+++ b/ndctl/libndctl.h.in
@@ -356,6 +356,7 @@ unsigned long ndctl_dimm_get_available_labels(struct ndctl_dimm *dimm);
 unsigned int ndctl_cmd_cfg_size_get_size(struct ndctl_cmd *cfg_size);
 ssize_t ndctl_cmd_cfg_read_get_data(struct ndctl_cmd *cfg_read, void *buf,
 		unsigned int len, unsigned int offset);
+ssize_t ndctl_cmd_cfg_read_get_size(struct ndctl_cmd *cfg_read);
 ssize_t ndctl_cmd_cfg_write_set_data(struct ndctl_cmd *cfg_write, void *buf,
 		unsigned int len, unsigned int offset);
 ssize_t ndctl_cmd_cfg_write_zero_data(struct ndctl_cmd *cfg_write);

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  parent reply	other threads:[~2016-10-19 16:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 16:47 [ndctl PATCH 0/8] dimm label space initialization support Dan Williams
2016-10-19 16:47 ` [Qemu-devel] " Dan Williams
2016-10-19 16:47 ` [ndctl PATCH 1/8] libndctl: fix error returns for unsigned apis Dan Williams
2016-10-19 16:47 ` [ndctl PATCH 2/8] ndctl: consolidate label commands into a single file Dan Williams
2016-10-19 16:48 ` [ndctl PATCH 3/8] ndctl: glob support for label commands Dan Williams
2016-10-19 16:48 ` [ndctl PATCH 4/8] ndctl: merge {enable, disable}-dimm with " Dan Williams
2016-10-19 16:48 ` Dan Williams [this message]
2016-10-19 16:48 ` [ndctl PATCH 6/8] ndctl: provide a read_labels() helper Dan Williams
2016-10-19 16:48 ` [ndctl PATCH 7/8] ndctl: init-labels command Dan Williams
2016-10-19 16:48   ` [Qemu-devel] " Dan Williams
2016-10-19 16:48 ` [ndctl PATCH 8/8] ndctl: check-labels command Dan Williams
2016-10-19 18:42 ` [ndctl PATCH 0/8] dimm label space initialization support Eric Blake
2016-10-19 18:42   ` [Qemu-devel] " Eric Blake
     [not found]   ` <6ceb7075-71fc-b725-8a1c-a7d8c727770e-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-19 19:41     ` Dan Williams
2016-10-19 19:41       ` Dan Williams
     [not found]       ` <CAPcyv4gbRE-ALJM6EHv6fM3Kq02HeZFMLF5T63J5qaJmHWvQCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-19 21:29         ` Dan Williams
2016-10-19 21:29           ` Dan Williams
2016-10-19 23:46           ` Eric Blake
2016-10-19 23:46             ` [Qemu-devel] " Eric Blake
     [not found]             ` <708947f5-dfdc-d6c9-4523-7436959119f3-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-19 23:56               ` Dan Williams
2016-10-19 23:56                 ` Dan Williams
2016-10-20 19:32 ` Vishal Verma
2016-10-20 19:32   ` [Qemu-devel] " Vishal Verma
2016-10-20 20:06   ` Dan Williams
2016-10-20 20:06     ` [Qemu-devel] " Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=147689569519.11015.13966814247817280212.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.