| 1 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
/* |
| 3 |
* This file is part of libnvme. |
| 4 |
* Copyright (c) 2020 Western Digital Corporation or its affiliates. |
| 5 |
* |
| 6 |
* Authors: Keith Busch <[email protected]> |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef _LIBNVME_FILTERS_H |
| 10 |
#define _LIBNVME_FILTERS_H |
| 11 |
|
| 12 |
#include <dirent.h> |
| 13 |
|
| 14 |
#include <nvme/tree.h> |
| 15 |
|
| 16 |
/** |
| 17 |
* DOC: filters.h |
| 18 |
* |
| 19 |
* libnvme directory filter |
| 20 |
*/ |
| 21 |
|
| 22 |
/** |
| 23 |
* nvme_namespace_filter() - Filter for namespaces |
| 24 |
* @d: dirent to check |
| 25 |
* |
| 26 |
* Return: 1 if @d matches, 0 otherwise |
| 27 |
*/ |
| 28 |
int nvme_namespace_filter(const struct dirent *d); |
| 29 |
|
| 30 |
/** |
| 31 |
* nvme_paths_filter() - Filter for paths |
| 32 |
* @d: dirent to check |
| 33 |
* |
| 34 |
* Return: 1 if @d matches, 0 otherwise |
| 35 |
*/ |
| 36 |
int nvme_paths_filter(const struct dirent *d); |
| 37 |
|
| 38 |
/** |
| 39 |
* nvme_ctrls_filter() - Filter for controllers |
| 40 |
* @d: dirent to check |
| 41 |
* |
| 42 |
* Return: 1 if @d matches, 0 otherwise |
| 43 |
*/ |
| 44 |
int nvme_ctrls_filter(const struct dirent *d); |
| 45 |
|
| 46 |
/** |
| 47 |
* nvme_subsys_filter() - Filter for subsystems |
| 48 |
* @d: dirent to check |
| 49 |
* |
| 50 |
* Return: 1 if @d matches, 0 otherwise |
| 51 |
*/ |
| 52 |
int nvme_subsys_filter(const struct dirent *d); |
| 53 |
|
| 54 |
/** |
| 55 |
* nvme_scan_subsystems() - Scan for subsystems |
| 56 |
* @subsys: Pointer to array of dirents |
| 57 |
* |
| 58 |
* Return: number of entries in @subsys |
| 59 |
*/ |
| 60 |
int nvme_scan_subsystems(struct dirent ***subsys); |
| 61 |
|
| 62 |
/** |
| 63 |
* nvme_scan_subsystem_namespaces() - Scan for namespaces in a subsystem |
| 64 |
* @s: Subsystem to scan |
| 65 |
* @ns: Pointer to array of dirents |
| 66 |
* |
| 67 |
* Return: number of entries in @ns |
| 68 |
*/ |
| 69 |
int nvme_scan_subsystem_namespaces(nvme_subsystem_t s, struct dirent ***ns); |
| 70 |
|
| 71 |
/** |
| 72 |
* nvme_scan_ctrls() - Scan for controllers |
| 73 |
* @ctrls: Pointer to array of dirents |
| 74 |
* |
| 75 |
* Return: number of entries in @ctrls |
| 76 |
*/ |
| 77 |
int nvme_scan_ctrls(struct dirent ***ctrls); |
| 78 |
|
| 79 |
/** |
| 80 |
* nvme_scan_ctrl_namespace_paths() - Scan for namespace paths in a controller |
| 81 |
* @c: Controller to scan |
| 82 |
* @paths: Pointer to array of dirents |
| 83 |
* |
| 84 |
* Return: number of entries in @paths |
| 85 |
*/ |
| 86 |
int nvme_scan_ctrl_namespace_paths(nvme_ctrl_t c, struct dirent ***paths); |
| 87 |
|
| 88 |
/** |
| 89 |
* nvme_scan_ctrl_namespaces() - Scan for namespaces in a controller |
| 90 |
* @c: Controller to scan |
| 91 |
* @ns: Pointer to array of dirents |
| 92 |
* |
| 93 |
* Return: number of entries in @ns |
| 94 |
*/ |
| 95 |
int nvme_scan_ctrl_namespaces(nvme_ctrl_t c, struct dirent ***ns); |
| 96 |
|
| 97 |
/** |
| 98 |
* nvme_scan_ns_head_paths() - Scan for namespace paths |
| 99 |
* @head: Namespace head node to scan |
| 100 |
* @paths : Pointer to array of dirents |
| 101 |
* |
| 102 |
* Return: number of entries in @ents |
| 103 |
*/ |
| 104 |
int nvme_scan_ns_head_paths(nvme_ns_head_t head, struct dirent ***paths); |
| 105 |
|
| 106 |
#endif /* _LIBNVME_FILTERS_H */ |