Skip to content

Commit b559599

Browse files
committed
tree: support apple-nvme transport
Apple silicon support on Linux uses a separate platform driver called 'apple-nvme', and libnvme doesn't know about this transport. This fixes a "No transport address for 'apple-nvme'" error when running on Apple silicon, where libnvme was unable to enumerate nvme storage attached to this platform. $ nvme list Node Generic SN Model Namespace Usage Format FW Rev --------------------- --------------------- -------------------- ---------------------------------------- ---------- -------------------------- ---------------- -------- /dev/nvme0n1 /dev/ng0n1 xxxxxxxxxxxxxxxx APPLE SSD AP2048Z 0x1 2.00 TB / 2.00 TB 4 KiB + 0 B 532.140. ... Signed-off-by: Clayton Craft <[email protected]>
1 parent 33018f5 commit b559599

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/nvme/tree.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,8 @@ struct nvme_ctrl *nvme_create_ctrl(nvme_root_t r,
14171417
return NULL;
14181418
}
14191419
if (strncmp(transport, "loop", 4) &&
1420-
strncmp(transport, "pcie", 4) && !traddr) {
1420+
strncmp(transport, "pcie", 4) &&
1421+
strncmp(transport, "apple-nvme", 10) && !traddr) {
14211422
nvme_msg(r, LOG_ERR, "No transport address for '%s'\n",
14221423
transport);
14231424
errno = EINVAL;
@@ -2166,7 +2167,7 @@ static nvme_ctrl_t nvme_ctrl_alloc(nvme_root_t r, nvme_subsystem_t s,
21662167
goto skip_address;
21672168

21682169
/* Older kernel don't support pcie transport addresses */
2169-
if (strcmp(transport, "pcie")) {
2170+
if (strcmp(transport, "pcie") && strcmp(transport, "apple-nvme")) {
21702171
errno = ENXIO;
21712172
return NULL;
21722173
}
@@ -2187,7 +2188,7 @@ static nvme_ctrl_t nvme_ctrl_alloc(nvme_root_t r, nvme_subsystem_t s,
21872188
}
21882189
if (p)
21892190
addr = strdup(p);
2190-
} else if (!strcmp(transport, "pcie")) {
2191+
} else if (!strcmp(transport, "pcie") || !strcmp(transport, "apple-nvme")) {
21912192
/* The 'address' string is the transport address */
21922193
traddr = addr;
21932194
} else {

0 commit comments

Comments
 (0)