linux kernel module not able to find “nvme_ns” struct

情到浓时终转凉″ 提交于 2020-01-16 14:49:14

问题


I am writing a module in which I am accessing the nvme device using major and minor number.

The code for the function is

src_disk = get_gendisk(MKDEV(si->src_major, si->src_minor), &part);
my_nvme_ns = (struct nvme_ns *)src_disk->private_data;

for (i = 0; i <= 15; i++)
{
    printk(KERN_CONT "%02x", my_nvme_ns->head.ids.nvme_ns_ids.nguid[i]);
}

Now, when I try to acces my_nvme_ns, it fails with error

error: dereferencing pointer to incomplete type ‘struct nvme_ns’
         printk(KERN_CONT "%02x", my_nvme_ns->head.ids.nvme_ns_ids.nguid[i]);

I have included all the relevant files, including

#include <linux/nvme.h>
#include <linux/nvme_ioctl.h>
#include <linux/types.h>

Using kernel 5.0.0

what am I missing here?

来源:https://stackoverflow.com/questions/58262330/linux-kernel-module-not-able-to-find-nvme-ns-struct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!