• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI_LINUX_LIGHTNVM_H
20 #define _UAPI_LINUX_LIGHTNVM_H
21 #include <stdio.h>
22 #include <sys/ioctl.h>
23 #define DISK_NAME_LEN 32
24 #include <linux/types.h>
25 #include <linux/ioctl.h>
26 #define NVM_TTYPE_NAME_MAX 48
27 #define NVM_TTYPE_MAX 63
28 #define NVM_MMTYPE_LEN 8
29 #define NVM_CTRL_FILE "/dev/lightnvm/control"
30 struct nvm_ioctl_info_tgt {
31   __u32 version[3];
32   __u32 reserved;
33   char tgtname[NVM_TTYPE_NAME_MAX];
34 };
35 struct nvm_ioctl_info {
36   __u32 version[3];
37   __u16 tgtsize;
38   __u16 reserved16;
39   __u32 reserved[12];
40   struct nvm_ioctl_info_tgt tgts[NVM_TTYPE_MAX];
41 };
42 enum {
43   NVM_DEVICE_ACTIVE = 1 << 0,
44 };
45 struct nvm_ioctl_device_info {
46   char devname[DISK_NAME_LEN];
47   char bmname[NVM_TTYPE_NAME_MAX];
48   __u32 bmversion[3];
49   __u32 flags;
50   __u32 reserved[8];
51 };
52 struct nvm_ioctl_get_devices {
53   __u32 nr_devices;
54   __u32 reserved[31];
55   struct nvm_ioctl_device_info info[31];
56 };
57 struct nvm_ioctl_create_simple {
58   __u32 lun_begin;
59   __u32 lun_end;
60 };
61 enum {
62   NVM_CONFIG_TYPE_SIMPLE = 0,
63 };
64 struct nvm_ioctl_create_conf {
65   __u32 type;
66   union {
67     struct nvm_ioctl_create_simple s;
68   };
69 };
70 struct nvm_ioctl_create {
71   char dev[DISK_NAME_LEN];
72   char tgttype[NVM_TTYPE_NAME_MAX];
73   char tgtname[DISK_NAME_LEN];
74   __u32 flags;
75   struct nvm_ioctl_create_conf conf;
76 };
77 struct nvm_ioctl_remove {
78   char tgtname[DISK_NAME_LEN];
79   __u32 flags;
80 };
81 struct nvm_ioctl_dev_init {
82   char dev[DISK_NAME_LEN];
83   char mmtype[NVM_MMTYPE_LEN];
84   __u32 flags;
85 };
86 enum {
87   NVM_FACTORY_ERASE_ONLY_USER = 1 << 0,
88   NVM_FACTORY_RESET_HOST_BLKS = 1 << 1,
89   NVM_FACTORY_RESET_GRWN_BBLKS = 1 << 2,
90   NVM_FACTORY_NR_BITS = 1 << 3,
91 };
92 struct nvm_ioctl_dev_factory {
93   char dev[DISK_NAME_LEN];
94   __u32 flags;
95 };
96 enum {
97   NVM_INFO_CMD = 0x20,
98   NVM_GET_DEVICES_CMD,
99   NVM_DEV_CREATE_CMD,
100   NVM_DEV_REMOVE_CMD,
101   NVM_DEV_INIT_CMD,
102   NVM_DEV_FACTORY_CMD,
103 };
104 #define NVM_IOCTL 'L'
105 #define NVM_INFO _IOWR(NVM_IOCTL, NVM_INFO_CMD, struct nvm_ioctl_info)
106 #define NVM_GET_DEVICES _IOR(NVM_IOCTL, NVM_GET_DEVICES_CMD, struct nvm_ioctl_get_devices)
107 #define NVM_DEV_CREATE _IOW(NVM_IOCTL, NVM_DEV_CREATE_CMD, struct nvm_ioctl_create)
108 #define NVM_DEV_REMOVE _IOW(NVM_IOCTL, NVM_DEV_REMOVE_CMD, struct nvm_ioctl_remove)
109 #define NVM_DEV_INIT _IOW(NVM_IOCTL, NVM_DEV_INIT_CMD, struct nvm_ioctl_dev_init)
110 #define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, struct nvm_ioctl_dev_factory)
111 #define NVM_VERSION_MAJOR 1
112 #define NVM_VERSION_MINOR 0
113 #define NVM_VERSION_PATCHLEVEL 0
114 #endif
115