1/*
2 * This header was generated from the Linux kernel headers by update_headers.py,
3 * to provide necessary information from kernel to userspace, such as constants,
4 * structures, and macros, and thus, contains no copyrightable information.
5 */
6#ifndef __UBI_USER_H__
7#define __UBI_USER_H__
8#include <linux/types.h>
9#define UBI_VOL_NUM_AUTO (-1)
10#define UBI_DEV_NUM_AUTO (-1)
11#define UBI_MAX_VOLUME_NAME 127
12#define UBI_IOC_MAGIC 'o'
13#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
14#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32)
15#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
16#define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req)
17#define UBI_CTRL_IOC_MAGIC 'o'
18#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
19#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
20#define UBI_VOL_IOC_MAGIC 'O'
21#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64)
22#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32)
23#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32)
24#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
25#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32)
26#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32)
27#define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \
28			       struct ubi_set_vol_prop_req)
29#define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req)
30#define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8)
31#define MAX_UBI_MTD_NAME_LEN 127
32#define UBI_MAX_RNVOL 32
33enum {
34	UBI_DYNAMIC_VOLUME = 3,
35	UBI_STATIC_VOLUME  = 4,
36};
37enum {
38	UBI_VOL_PROP_DIRECT_WRITE = 1,
39};
40struct ubi_attach_req {
41	__s32 ubi_num;
42	__s32 mtd_num;
43	__s32 vid_hdr_offset;
44	__s16 max_beb_per1024;
45	__s8 padding[10];
46};
47enum {
48	UBI_VOL_SKIP_CRC_CHECK_FLG = 0x1,
49};
50#define UBI_VOL_VALID_FLGS	(UBI_VOL_SKIP_CRC_CHECK_FLG)
51struct ubi_mkvol_req {
52	__s32 vol_id;
53	__s32 alignment;
54	__s64 bytes;
55	__s8 vol_type;
56	__u8 flags;
57	__s16 name_len;
58	__s8 padding2[4];
59	char name[UBI_MAX_VOLUME_NAME + 1];
60} __packed;
61struct ubi_rsvol_req {
62	__s64 bytes;
63	__s32 vol_id;
64} __packed;
65struct ubi_rnvol_req {
66	__s32 count;
67	__s8 padding1[12];
68	struct {
69		__s32 vol_id;
70		__s16 name_len;
71		__s8  padding2[2];
72		char    name[UBI_MAX_VOLUME_NAME + 1];
73	} ents[UBI_MAX_RNVOL];
74} __packed;
75struct ubi_leb_change_req {
76	__s32 lnum;
77	__s32 bytes;
78	__s8  dtype;
79	__s8  padding[7];
80} __packed;
81struct ubi_map_req {
82	__s32 lnum;
83	__s8  dtype;
84	__s8  padding[3];
85} __packed;
86struct ubi_set_vol_prop_req {
87	__u8  property;
88	__u8  padding[7];
89	__u64 value;
90}  __packed;
91struct ubi_blkcreate_req {
92	__s8  padding[128];
93}  __packed;
94#endif
95