122851890Sopenharmony_ci/*
222851890Sopenharmony_ci * This header was generated from the Linux kernel headers by update_headers.py,
322851890Sopenharmony_ci * to provide necessary information from kernel to userspace, such as constants,
422851890Sopenharmony_ci * structures, and macros, and thus, contains no copyrightable information.
522851890Sopenharmony_ci */
622851890Sopenharmony_ci#ifndef __UBI_USER_H__
722851890Sopenharmony_ci#define __UBI_USER_H__
822851890Sopenharmony_ci#include <linux/types.h>
922851890Sopenharmony_ci#define UBI_VOL_NUM_AUTO (-1)
1022851890Sopenharmony_ci#define UBI_DEV_NUM_AUTO (-1)
1122851890Sopenharmony_ci#define UBI_MAX_VOLUME_NAME 127
1222851890Sopenharmony_ci#define UBI_IOC_MAGIC 'o'
1322851890Sopenharmony_ci#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
1422851890Sopenharmony_ci#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32)
1522851890Sopenharmony_ci#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
1622851890Sopenharmony_ci#define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req)
1722851890Sopenharmony_ci#define UBI_CTRL_IOC_MAGIC 'o'
1822851890Sopenharmony_ci#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
1922851890Sopenharmony_ci#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
2022851890Sopenharmony_ci#define UBI_VOL_IOC_MAGIC 'O'
2122851890Sopenharmony_ci#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64)
2222851890Sopenharmony_ci#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32)
2322851890Sopenharmony_ci#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32)
2422851890Sopenharmony_ci#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
2522851890Sopenharmony_ci#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32)
2622851890Sopenharmony_ci#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32)
2722851890Sopenharmony_ci#define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \
2822851890Sopenharmony_ci			       struct ubi_set_vol_prop_req)
2922851890Sopenharmony_ci#define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req)
3022851890Sopenharmony_ci#define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8)
3122851890Sopenharmony_ci#define MAX_UBI_MTD_NAME_LEN 127
3222851890Sopenharmony_ci#define UBI_MAX_RNVOL 32
3322851890Sopenharmony_cienum {
3422851890Sopenharmony_ci	UBI_DYNAMIC_VOLUME = 3,
3522851890Sopenharmony_ci	UBI_STATIC_VOLUME  = 4,
3622851890Sopenharmony_ci};
3722851890Sopenharmony_cienum {
3822851890Sopenharmony_ci	UBI_VOL_PROP_DIRECT_WRITE = 1,
3922851890Sopenharmony_ci};
4022851890Sopenharmony_cistruct ubi_attach_req {
4122851890Sopenharmony_ci	__s32 ubi_num;
4222851890Sopenharmony_ci	__s32 mtd_num;
4322851890Sopenharmony_ci	__s32 vid_hdr_offset;
4422851890Sopenharmony_ci	__s16 max_beb_per1024;
4522851890Sopenharmony_ci	__s8 padding[10];
4622851890Sopenharmony_ci};
4722851890Sopenharmony_cienum {
4822851890Sopenharmony_ci	UBI_VOL_SKIP_CRC_CHECK_FLG = 0x1,
4922851890Sopenharmony_ci};
5022851890Sopenharmony_ci#define UBI_VOL_VALID_FLGS	(UBI_VOL_SKIP_CRC_CHECK_FLG)
5122851890Sopenharmony_cistruct ubi_mkvol_req {
5222851890Sopenharmony_ci	__s32 vol_id;
5322851890Sopenharmony_ci	__s32 alignment;
5422851890Sopenharmony_ci	__s64 bytes;
5522851890Sopenharmony_ci	__s8 vol_type;
5622851890Sopenharmony_ci	__u8 flags;
5722851890Sopenharmony_ci	__s16 name_len;
5822851890Sopenharmony_ci	__s8 padding2[4];
5922851890Sopenharmony_ci	char name[UBI_MAX_VOLUME_NAME + 1];
6022851890Sopenharmony_ci} __packed;
6122851890Sopenharmony_cistruct ubi_rsvol_req {
6222851890Sopenharmony_ci	__s64 bytes;
6322851890Sopenharmony_ci	__s32 vol_id;
6422851890Sopenharmony_ci} __packed;
6522851890Sopenharmony_cistruct ubi_rnvol_req {
6622851890Sopenharmony_ci	__s32 count;
6722851890Sopenharmony_ci	__s8 padding1[12];
6822851890Sopenharmony_ci	struct {
6922851890Sopenharmony_ci		__s32 vol_id;
7022851890Sopenharmony_ci		__s16 name_len;
7122851890Sopenharmony_ci		__s8  padding2[2];
7222851890Sopenharmony_ci		char    name[UBI_MAX_VOLUME_NAME + 1];
7322851890Sopenharmony_ci	} ents[UBI_MAX_RNVOL];
7422851890Sopenharmony_ci} __packed;
7522851890Sopenharmony_cistruct ubi_leb_change_req {
7622851890Sopenharmony_ci	__s32 lnum;
7722851890Sopenharmony_ci	__s32 bytes;
7822851890Sopenharmony_ci	__s8  dtype;
7922851890Sopenharmony_ci	__s8  padding[7];
8022851890Sopenharmony_ci} __packed;
8122851890Sopenharmony_cistruct ubi_map_req {
8222851890Sopenharmony_ci	__s32 lnum;
8322851890Sopenharmony_ci	__s8  dtype;
8422851890Sopenharmony_ci	__s8  padding[3];
8522851890Sopenharmony_ci} __packed;
8622851890Sopenharmony_cistruct ubi_set_vol_prop_req {
8722851890Sopenharmony_ci	__u8  property;
8822851890Sopenharmony_ci	__u8  padding[7];
8922851890Sopenharmony_ci	__u64 value;
9022851890Sopenharmony_ci}  __packed;
9122851890Sopenharmony_cistruct ubi_blkcreate_req {
9222851890Sopenharmony_ci	__s8  padding[128];
9322851890Sopenharmony_ci}  __packed;
9422851890Sopenharmony_ci#endif
95