From 775bbb9913ec1b8c04b182ac95f3156cda09a73e Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Fri, 22 Mar 2024 21:26:29 +0900 Subject: [PATCH] nvme: Use libnvme sysfs function to get NVMe controller directory Also delete the SYS_NVME definition unused instead. Signed-off-by: Tokunori Ikegami --- nvme.c | 2 +- nvme.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nvme.c b/nvme.c index dc065742d5..3743837b6f 100644 --- a/nvme.c +++ b/nvme.c @@ -5256,7 +5256,7 @@ static void *mmap_registers(struct nvme_dev *dev) void *membase; int fd; - sprintf(path, "/sys/class/nvme/%s/device/resource0", dev->name); + sprintf(path, "%s/%s/device/resource0", nvme_ctrl_sysfs_dir(), dev->name); fd = open(path, O_RDONLY); if (fd < 0) { if (log_level >= LOG_DEBUG) diff --git a/nvme.h b/nvme.h index d0aca2aee9..5a87dfb85f 100644 --- a/nvme.h +++ b/nvme.h @@ -45,8 +45,6 @@ enum nvme_cli_topo_ranking { NVME_CLI_TOPO_CTRL, }; -#define SYS_NVME "/sys/class/nvme" - enum nvme_dev_type { NVME_DEV_DIRECT, NVME_DEV_MI,