@@ -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)
{
@@ -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;
@@ -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);
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(+)