summaryrefslogtreecommitdiffstats
path: root/nvme-filters.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-14 18:27:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-16 15:11:56 +0000
commit6197903bd42478987516bc4cc3f0769488a37065 (patch)
tree508d399340039960289dd1d96696db7c56c22321 /nvme-filters.c
parentAdding upstream version 1.16. (diff)
downloadnvme-cli-6197903bd42478987516bc4cc3f0769488a37065.tar.xz
nvme-cli-6197903bd42478987516bc4cc3f0769488a37065.zip
Adding upstream version 2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'nvme-filters.c')
-rw-r--r--nvme-filters.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/nvme-filters.c b/nvme-filters.c
deleted file mode 100644
index 17c375f..0000000
--- a/nvme-filters.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "nvme.h"
-
-/* 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;
-
- if (d->d_name[0] == '.')
- return 0;
-
- if (strstr(d->d_name, "nvme"))
- if (sscanf(d->d_name, "nvme%dn%d", &i, &n) == 2)
- return 1;
- return 0;
-}
-
-int scan_ctrl_paths_filter(const struct dirent *d)
-{
- int id, cntlid, nsid;
-
- if (d->d_name[0] == '.')
- return 0;
-
- if (strstr(d->d_name, "nvme")) {
- if (sscanf(d->d_name, "nvme%dc%dn%d", &id, &cntlid, &nsid) == 3)
- return 1;
- if (sscanf(d->d_name, "nvme%dn%d", &id, &nsid) == 2)
- return 1;
- }
-
- return 0;
-}
-
-int scan_ctrls_filter(const struct dirent *d)
-{
- int id, nsid;
-
- if (d->d_name[0] == '.')
- return 0;
-
- if (strstr(d->d_name, "nvme")) {
- if (sscanf(d->d_name, "nvme%dn%d", &id, &nsid) == 2)
- return 0;
- if (sscanf(d->d_name, "nvme%dn", &id) == 1)
- return 1;
- return 0;
- }
-
- return 0;
-}
-
-int scan_subsys_filter(const struct dirent *d)
-{
- int id;
-
- if (d->d_name[0] == '.')
- return 0;
-
- if (strstr(d->d_name, "nvme-subsys")) {
- if (sscanf(d->d_name, "nvme-subsys%d", &id) != 1)
- return 0;
- return 1;
- }
-
- return 0;
-}
-
-int scan_dev_filter(const struct dirent *d)
-{
- int ctrl, ns, part;
-
- if (d->d_name[0] == '.')
- return 0;
-
- if (strstr(d->d_name, "nvme")) {
- if (sscanf(d->d_name, "nvme%dn%dp%d", &ctrl, &ns, &part) == 3)
- return 0;
- if (sscanf(d->d_name, "nvme%dn%d", &ctrl, &ns) == 2)
- return ctrl == current_index;
- }
- return 0;
-}