summaryrefslogtreecommitdiffstats
path: root/nvme-filters.c
diff options
context:
space:
mode:
Diffstat (limited to 'nvme-filters.c')
-rw-r--r--nvme-filters.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/nvme-filters.c b/nvme-filters.c
index a4133f8..17c375f 100644
--- a/nvme-filters.c
+++ b/nvme-filters.c
@@ -7,6 +7,22 @@
/* global, used for controller specific namespace filter */
int current_index;
+int scan_ctrl_namespace_filter(const struct dirent *d)
+{
+ int c, i, n;
+
+ if (d->d_name[0] == '.')
+ return 0;
+
+ if (strstr(d->d_name, "nvme")) {
+ if (sscanf(d->d_name, "nvme%dc%dn%d", &i, &c, &n) == 3)
+ return 1;
+ if (sscanf(d->d_name, "nvme%dn%d", &i, &n) == 2)
+ return 1;
+ }
+ return 0;
+}
+
int scan_namespace_filter(const struct dirent *d)
{
int i, n;