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 __UBI_USER_H__
20#define __UBI_USER_H__
21#include <linux/types.h>
22#define UBI_VOL_NUM_AUTO (- 1)
23#define UBI_DEV_NUM_AUTO (- 1)
24#define UBI_MAX_VOLUME_NAME 127
25#define UBI_IOC_MAGIC 'o'
26#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
27#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32)
28#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
29#define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req)
30#define UBI_CTRL_IOC_MAGIC 'o'
31#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
32#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
33#define UBI_VOL_IOC_MAGIC 'O'
34#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64)
35#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32)
36#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32)
37#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
38#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32)
39#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32)
40#define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_vol_prop_req)
41#define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req)
42#define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8)
43#define MAX_UBI_MTD_NAME_LEN 127
44#define UBI_MAX_RNVOL 32
45enum {
46  UBI_DYNAMIC_VOLUME = 3,
47  UBI_STATIC_VOLUME = 4,
48};
49enum {
50  UBI_VOL_PROP_DIRECT_WRITE = 1,
51};
52struct ubi_attach_req {
53  __s32 ubi_num;
54  __s32 mtd_num;
55  __s32 vid_hdr_offset;
56  __s16 max_beb_per1024;
57  __s8 padding[10];
58};
59struct ubi_mkvol_req {
60  __s32 vol_id;
61  __s32 alignment;
62  __s64 bytes;
63  __s8 vol_type;
64  __s8 padding1;
65  __s16 name_len;
66  __s8 padding2[4];
67  char name[UBI_MAX_VOLUME_NAME + 1];
68} __packed;
69struct ubi_rsvol_req {
70  __s64 bytes;
71  __s32 vol_id;
72} __packed;
73struct ubi_rnvol_req {
74  __s32 count;
75  __s8 padding1[12];
76  struct {
77    __s32 vol_id;
78    __s16 name_len;
79    __s8 padding2[2];
80    char name[UBI_MAX_VOLUME_NAME + 1];
81  } ents[UBI_MAX_RNVOL];
82} __packed;
83struct ubi_leb_change_req {
84  __s32 lnum;
85  __s32 bytes;
86  __s8 dtype;
87  __s8 padding[7];
88} __packed;
89struct ubi_map_req {
90  __s32 lnum;
91  __s8 dtype;
92  __s8 padding[3];
93} __packed;
94struct ubi_set_vol_prop_req {
95  __u8 property;
96  __u8 padding[7];
97  __u64 value;
98} __packed;
99struct ubi_blkcreate_req {
100  __s8 padding[128];
101} __packed;
102#endif
103