From 3945f3269b3e2763faa1ab22d225ca4dd1856b82 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 14 Jul 2022 20:53:09 +0200 Subject: Adding upstream version 1.0. Signed-off-by: Daniel Baumann --- src/nvme/filters.h | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/nvme/filters.h (limited to 'src/nvme/filters.h') diff --git a/src/nvme/filters.h b/src/nvme/filters.h new file mode 100644 index 0000000..49bbeea --- /dev/null +++ b/src/nvme/filters.h @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later +/* + * This file is part of libnvme. + * Copyright (c) 2020 Western Digital Corporation or its affiliates. + * + * Authors: Keith Busch + */ + +#ifndef _LIBNVME_FILTERS_H +#define _LIBNVME_FILTERS_H + +#include +#include "tree.h" + +/** + * DOC: filters.h + * + * libnvme directory filter + */ + +/** + * nvme_namespace_filter() - Filter for namespaces + * @d: dirent to check + * + * Return: 1 if @d matches, 0 otherwise + */ +int nvme_namespace_filter(const struct dirent *d); + +/** + * nvme_paths_filter() - Filter for paths + * @d: dirent to check + * + * Return: 1 if @d matches, 0 otherwise + */ +int nvme_paths_filter(const struct dirent *d); + +/** + * nvme_ctrls_filter() - Filter for controllers + * @d: dirent to check + * + * Return: 1 if @d matches, 0 otherwise + */ +int nvme_ctrls_filter(const struct dirent *d); + +/** + * nvme_subsys_filter() - Filter for subsystems + * @d: dirent to check + * + * Return: 1 if @d matches, 0 otherwise + */ +int nvme_subsys_filter(const struct dirent *d); + +/** + * nvme_scan_subsystems() - Scan for subsystems + * @subsys: Pointer to array of dirents + * + * Return: number of entries in @subsys + */ +int nvme_scan_subsystems(struct dirent ***subsys); + +/** + * nvme_scan_subsystem_namespaces() - Scan for namespaces in a subsystem + * @s: Subsystem to scan + * @ns: Pointer to array of dirents + * + * Return: number of entries in @ns + */ +int nvme_scan_subsystem_namespaces(nvme_subsystem_t s, struct dirent ***ns); + +/** + * nvme_scan_ctrls() - Scan for controllers + * @ctrls: Pointer to array of dirents + * + * Return: number of entries in @ctrls + */ +int nvme_scan_ctrls(struct dirent ***ctrls); + +/** + * nvme_scan_ctrl_namespace_paths() - Scan for namespace paths in a controller + * @c: Controller to scan + * @paths: Pointer to array of dirents + * + * Return: number of entries in @paths + */ +int nvme_scan_ctrl_namespace_paths(nvme_ctrl_t c, struct dirent ***paths); + +/** + * nvme_scan_ctrl_namespaces() - Scan for namespaces in a controller + * @c: Controller to scan + * @ns: Pointer to array of dirents + * + * Return: number of entries in @ns + */ +int nvme_scan_ctrl_namespaces(nvme_ctrl_t c, struct dirent ***ns); + +#endif /* _LIBNVME_FILTERS_H */ -- cgit v1.2.3