@@ -21,8 +21,8 @@
struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *ident)
{
char *end = NULL;
- const char *provider;
unsigned long bus_id, id;
+ const char *provider, *devname;
if (!ident || strcmp(ident, "all") == 0)
return bus;
@@ -32,12 +32,14 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *ident)
bus_id = ULONG_MAX;
provider = ndctl_bus_get_provider(bus);
+ devname = ndctl_bus_get_devname(bus);
id = ndctl_bus_get_id(bus);
if (bus_id < ULONG_MAX && bus_id == id)
return bus;
- if (bus_id == ULONG_MAX && strcmp(ident, provider) == 0)
+ if (bus_id == ULONG_MAX && (strcmp(ident, provider) == 0
+ || strcmp(ident, devname) == 0))
return bus;
return NULL;
For example, allow: ndctl list -b ndbus0 ...in addition to the existing provider based method: ndctl list -b ACPI.NFIT ...or the id based method: ndctl list -b 0 Cc: Vishal Verma <vishal.l.verma@intel.com> Reported-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- util/filter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)