0

I am currently writing a Kernel module that needs to talk to an NVMe device. What is the best way to do this? I looked into the SPDK library but seems like that it operates in the userspace, which is something that I am not looking for. I found that there's a compiled kernel module for nvme driver in the linux kernel library (/lib/modules) but I am not sure how to interact with that.

Would appreciate any help on this.

Basim Sahaf
  • 33
  • 1
  • 7
  • 2
    The NVMe driver is there to hide the fact that you're talking to an NVMe device. Why would you need to talk to the NVMe driver? If its an NVMe SSD, for example, just talk to it as a block device without caring that it is NVMe – stark Jun 05 '20 at 17:21
  • I'm doing something like ` struct block_device *bdev; bdev = lookup_bdev("/dev/nvme0"); ` But lookup_bdev doesn't return the struct. All fields in `block_device` struct are null – Basim Sahaf Jun 26 '20 at 16:55
  • /dev/nvme0 is not a block device. Most likely you want /dev/nvme0n1 (whole block device) or /dev/nvme0n1p1 (first partition). In either case, kernel modules don't look up names. They use major/minor number (dev_t) of the device that you want. – stark Jun 26 '20 at 18:21

0 Answers0