On Thursday 05 July 2018 05:18 PM, Gaetan Rivet wrote:
rte_devargs_parse becomes non-variadic,
rte_devargs_parsef becomes the variadic version, to be used to compose
device strings.

Signed-off-by: Gaetan Rivet <gaetan.ri...@6wind.com>
---
  drivers/net/failsafe/failsafe_args.c        |  2 +-
  drivers/net/failsafe/failsafe_eal.c         |  2 +-
  lib/librte_eal/common/eal_common_dev.c      |  4 +-
  lib/librte_eal/common/eal_common_devargs.c  | 42 ++++++++++++++++-----
  lib/librte_eal/common/include/rte_devargs.h | 40 +++++++++++++++++++-
  lib/librte_eal/rte_eal_version.map          |  1 +
  lib/librte_ethdev/rte_ethdev.c              |  2 +-
  7 files changed, 76 insertions(+), 17 deletions(-)


[...]

+__rte_experimental
+int
+rte_devargs_parsef(struct rte_devargs *da, const char *format, ...)
+{
+       va_list ap;
+       size_t len;
+       char *dev;
+
+       if (da == NULL)
+               return -EINVAL;
+
+       va_start(ap, format);
+       len = vsnprintf(NULL, 0, format, ap);
+       va_end(ap);
+
+       dev = calloc(1, len + 1);
+       if (dev == NULL) {
+               fprintf(stderr, "ERROR: not enough memory to parse device\n");

Should RTE_LOG be used here?

+               return -ENOMEM;
+       }
+
+       va_start(ap, format);
+       vsnprintf(dev, len, format, ap);
+       va_end(ap);
+
+       return rte_devargs_parse(da, dev);
+}
+
  int __rte_experimental
  rte_devargs_insert(struct rte_devargs *da)
  {

[...]

Except the comment above:

Acked-by: Shreyansh Jain <shreyansh.j...@nxp.com>

Reply via email to