Add support for NVMe ioctls

Signed-off-by: Johannes Thumshirn <jthumsh...@suse.de>
---
 ioctls/nvme.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 ioctls/nvme.c

diff --git a/ioctls/nvme.c b/ioctls/nvme.c
new file mode 100644
index 0000000..5588e81
--- /dev/null
+++ b/ioctls/nvme.c
@@ -0,0 +1,39 @@
+#include <linux/ioctl.h>
+#include <linux/nvme.h>
+
+#include "utils.h"
+#include "ioctls.h"
+
+static const struct ioctl nvme_ioctls[] = {
+       IOCTL(NVME_IOCTL_ID),
+       IOCTL(NVME_IOCTL_ADMIN_CMD),
+       IOCTL(NVME_IOCTL_SUBMIT_IO),
+       IOCTL(NVME_IOCTL_IO_CMD),
+       IOCTL(NVME_IOCTL_RESET),
+};
+
+static const char *const nvme_devs[] = {
+       "nvme",
+};
+
+static const struct ioctl_group nvme_grp_misc = {
+       .devtype = DEV_CHAR,
+       .devs = nvme_devs,
+       .devs_cnt = ARRAY_SIZE(nvme_devs),
+       .sanitise = pick_random_ioctl,
+       .ioctls = nvme_ioctls,
+       .ioctls_cnt = ARRAY_SIZE(nvme_ioctls),
+};
+
+REG_IOCTL_GROUP(nvme_grp_misc)
+
+static const struct ioctl_group nvme_grp_block = {
+       .devtype = DEV_BLOCK,
+       .devs = nvme_devs,
+       .devs_cnt = ARRAY_SIZE(nvme_devs),
+       .sanitise = pick_random_ioctl,
+       .ioctls = nvme_ioctls,
+       .ioctls_cnt = ARRAY_SIZE(nvme_ioctls),
+};
+
+REG_IOCTL_GROUP(nvme_grp_block);
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to