Skip to content

Commit

Permalink
sysfs: Export NVMe controller sysfs directory return function
Browse files Browse the repository at this point in the history
The path is returned with the controller name by the nvme scan.
To return the path without the nvme scan nvme identify namespace.

Signed-off-by: Tokunori Ikegami <[email protected]>
  • Loading branch information
ikegami-t committed Mar 22, 2024
1 parent ea5600c commit a3f73c8
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/libnvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern "C" {
#include "nvme/tree.h"
#include "nvme/util.h"
#include "nvme/log.h"
#include "nvme/sysfs.h"

#ifdef __cplusplus
}
Expand Down
1 change: 1 addition & 0 deletions src/libnvme.map
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ LIBNVME_1.9 {
nvme_submit_passthru;
nvme_submit_passthru64;
nvme_update_key;
nvme_ctrl_sysfs_dir;
};

LIBNVME_1_8 {
Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ install_headers([
'nvme/types.h',
'nvme/util.h',
'nvme/mi.h',
'nvme/sysfs.h',
],
subdir: 'nvme',
install_mode: mode,
Expand Down
1 change: 1 addition & 0 deletions src/nvme/filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <dirent.h>

#include "filters.h"
#include "sysfs.h"
#include "private.h"

int nvme_namespace_filter(const struct dirent *d)
Expand Down
2 changes: 0 additions & 2 deletions src/nvme/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
#include "fabrics.h"
#include "mi.h"


const char *nvme_subsys_sysfs_dir(void);
const char *nvme_ctrl_sysfs_dir(void);
const char *nvme_ns_sysfs_dir(void);
const char *nvme_slots_sysfs_dir(void);
const char *nvme_uuid_ibm_filename(void);
Expand Down
22 changes: 22 additions & 0 deletions src/nvme/sysfs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* This file is part of libnvme.
*/

#ifndef _LIBNVME_SYSFS_H
#define _LIBNVME_SYSFS_H

/**
* DOC: sysfs.h
*
* libnvme sysfs directory
*/

/**
* nvme_ctrl_sysfs_dir() - Return for a NVMe controller sysfs directory
*
* Return: NVMe controller sysfs directory
*/
const char *nvme_ctrl_sysfs_dir(void);

#endif /* _LIBNVME_SYSFS_H */
1 change: 1 addition & 0 deletions src/nvme/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "util.h"
#include "fabrics.h"
#include "log.h"
#include "sysfs.h"
#include "private.h"

/**
Expand Down

0 comments on commit a3f73c8

Please sign in to comment.