summaryrefslogtreecommitdiff
path: root/libdde_linux26/contrib/include/mtd
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-07-27 22:07:53 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-07-27 22:07:53 +0000
commit4fbe7358c7747a9165f776eb19addbb9baf7def2 (patch)
treebc7076b4f6d10c2cc2942539bb666e50f0b66954 /libdde_linux26/contrib/include/mtd
parent21adb5284111190057db245cfc2b54091920c373 (diff)
rename libdde_linux26 into libdde-linux26 to make dpkg-source happy
Diffstat (limited to 'libdde_linux26/contrib/include/mtd')
-rw-r--r--libdde_linux26/contrib/include/mtd/Kbuild6
-rw-r--r--libdde_linux26/contrib/include/mtd/inftl-user.h91
-rw-r--r--libdde_linux26/contrib/include/mtd/jffs2-user.h33
-rw-r--r--libdde_linux26/contrib/include/mtd/mtd-abi.h150
-rw-r--r--libdde_linux26/contrib/include/mtd/mtd-user.h19
-rw-r--r--libdde_linux26/contrib/include/mtd/nftl-user.h74
-rw-r--r--libdde_linux26/contrib/include/mtd/ubi-user.h410
7 files changed, 0 insertions, 783 deletions
diff --git a/libdde_linux26/contrib/include/mtd/Kbuild b/libdde_linux26/contrib/include/mtd/Kbuild
deleted file mode 100644
index 8eb018f9..00000000
--- a/libdde_linux26/contrib/include/mtd/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
-header-y += inftl-user.h
-header-y += jffs2-user.h
-header-y += mtd-abi.h
-header-y += mtd-user.h
-header-y += nftl-user.h
-header-y += ubi-user.h
diff --git a/libdde_linux26/contrib/include/mtd/inftl-user.h b/libdde_linux26/contrib/include/mtd/inftl-user.h
deleted file mode 100644
index d409d489..00000000
--- a/libdde_linux26/contrib/include/mtd/inftl-user.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Parts of INFTL headers shared with userspace
- *
- */
-
-#ifndef __MTD_INFTL_USER_H__
-#define __MTD_INFTL_USER_H__
-
-#include <linux/types.h>
-
-#define OSAK_VERSION 0x5120
-#define PERCENTUSED 98
-
-#define SECTORSIZE 512
-
-/* Block Control Information */
-
-struct inftl_bci {
- uint8_t ECCsig[6];
- uint8_t Status;
- uint8_t Status1;
-} __attribute__((packed));
-
-struct inftl_unithead1 {
- uint16_t virtualUnitNo;
- uint16_t prevUnitNo;
- uint8_t ANAC;
- uint8_t NACs;
- uint8_t parityPerField;
- uint8_t discarded;
-} __attribute__((packed));
-
-struct inftl_unithead2 {
- uint8_t parityPerField;
- uint8_t ANAC;
- uint16_t prevUnitNo;
- uint16_t virtualUnitNo;
- uint8_t NACs;
- uint8_t discarded;
-} __attribute__((packed));
-
-struct inftl_unittail {
- uint8_t Reserved[4];
- uint16_t EraseMark;
- uint16_t EraseMark1;
-} __attribute__((packed));
-
-union inftl_uci {
- struct inftl_unithead1 a;
- struct inftl_unithead2 b;
- struct inftl_unittail c;
-};
-
-struct inftl_oob {
- struct inftl_bci b;
- union inftl_uci u;
-};
-
-
-/* INFTL Media Header */
-
-struct INFTLPartition {
- __u32 virtualUnits;
- __u32 firstUnit;
- __u32 lastUnit;
- __u32 flags;
- __u32 spareUnits;
- __u32 Reserved0;
- __u32 Reserved1;
-} __attribute__((packed));
-
-struct INFTLMediaHeader {
- char bootRecordID[8];
- __u32 NoOfBootImageBlocks;
- __u32 NoOfBinaryPartitions;
- __u32 NoOfBDTLPartitions;
- __u32 BlockMultiplierBits;
- __u32 FormatFlags;
- __u32 OsakVersion;
- __u32 PercentUsed;
- struct INFTLPartition Partitions[4];
-} __attribute__((packed));
-
-/* Partition flag types */
-#define INFTL_BINARY 0x20000000
-#define INFTL_BDTL 0x40000000
-#define INFTL_LAST 0x80000000
-
-#endif /* __MTD_INFTL_USER_H__ */
-
-
diff --git a/libdde_linux26/contrib/include/mtd/jffs2-user.h b/libdde_linux26/contrib/include/mtd/jffs2-user.h
deleted file mode 100644
index 001685d7..00000000
--- a/libdde_linux26/contrib/include/mtd/jffs2-user.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * JFFS2 definitions for use in user space only
- */
-
-#ifndef __JFFS2_USER_H__
-#define __JFFS2_USER_H__
-
-/* This file is blessed for inclusion by userspace */
-#include <linux/jffs2.h>
-#include <endian.h>
-#include <byteswap.h>
-
-#undef cpu_to_je16
-#undef cpu_to_je32
-#undef cpu_to_jemode
-#undef je16_to_cpu
-#undef je32_to_cpu
-#undef jemode_to_cpu
-
-extern int target_endian;
-
-#define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
-#define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
-
-#define cpu_to_je16(x) ((jint16_t){t16(x)})
-#define cpu_to_je32(x) ((jint32_t){t32(x)})
-#define cpu_to_jemode(x) ((jmode_t){t32(x)})
-
-#define je16_to_cpu(x) (t16((x).v16))
-#define je32_to_cpu(x) (t32((x).v32))
-#define jemode_to_cpu(x) (t32((x).m))
-
-#endif /* __JFFS2_USER_H__ */
diff --git a/libdde_linux26/contrib/include/mtd/mtd-abi.h b/libdde_linux26/contrib/include/mtd/mtd-abi.h
deleted file mode 100644
index c6c61cd5..00000000
--- a/libdde_linux26/contrib/include/mtd/mtd-abi.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Portions of MTD ABI definition which are shared by kernel and user space
- */
-
-#ifndef __MTD_ABI_H__
-#define __MTD_ABI_H__
-
-struct erase_info_user {
- uint32_t start;
- uint32_t length;
-};
-
-struct mtd_oob_buf {
- uint32_t start;
- uint32_t length;
- unsigned char __user *ptr;
-};
-
-#define MTD_ABSENT 0
-#define MTD_RAM 1
-#define MTD_ROM 2
-#define MTD_NORFLASH 3
-#define MTD_NANDFLASH 4
-#define MTD_DATAFLASH 6
-#define MTD_UBIVOLUME 7
-
-#define MTD_WRITEABLE 0x400 /* Device is writeable */
-#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
-#define MTD_NO_ERASE 0x1000 /* No erase necessary */
-#define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */
-
-// Some common devices / combinations of capabilities
-#define MTD_CAP_ROM 0
-#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
-#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
-#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
-
-/* ECC byte placement */
-#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended)
-#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode)
-#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme
-#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read)
-#define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default
-
-/* OTP mode selection */
-#define MTD_OTP_OFF 0
-#define MTD_OTP_FACTORY 1
-#define MTD_OTP_USER 2
-
-struct mtd_info_user {
- uint8_t type;
- uint32_t flags;
- uint32_t size; // Total size of the MTD
- uint32_t erasesize;
- uint32_t writesize;
- uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
- /* The below two fields are obsolete and broken, do not use them
- * (TODO: remove at some point) */
- uint32_t ecctype;
- uint32_t eccsize;
-};
-
-struct region_info_user {
- uint32_t offset; /* At which this region starts,
- * from the beginning of the MTD */
- uint32_t erasesize; /* For this region */
- uint32_t numblocks; /* Number of blocks in this region */
- uint32_t regionindex;
-};
-
-struct otp_info {
- uint32_t start;
- uint32_t length;
- uint32_t locked;
-};
-
-#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
-#define MEMERASE _IOW('M', 2, struct erase_info_user)
-#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
-#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf)
-#define MEMLOCK _IOW('M', 5, struct erase_info_user)
-#define MEMUNLOCK _IOW('M', 6, struct erase_info_user)
-#define MEMGETREGIONCOUNT _IOR('M', 7, int)
-#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
-#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
-#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
-#define MEMGETBADBLOCK _IOW('M', 11, loff_t)
-#define MEMSETBADBLOCK _IOW('M', 12, loff_t)
-#define OTPSELECT _IOR('M', 13, int)
-#define OTPGETREGIONCOUNT _IOW('M', 14, int)
-#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
-#define OTPLOCK _IOR('M', 16, struct otp_info)
-#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout)
-#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
-#define MTDFILEMODE _IO('M', 19)
-
-/*
- * Obsolete legacy interface. Keep it in order not to break userspace
- * interfaces
- */
-struct nand_oobinfo {
- uint32_t useecc;
- uint32_t eccbytes;
- uint32_t oobfree[8][2];
- uint32_t eccpos[32];
-};
-
-struct nand_oobfree {
- uint32_t offset;
- uint32_t length;
-};
-
-#define MTD_MAX_OOBFREE_ENTRIES 8
-/*
- * ECC layout control structure. Exported to userspace for
- * diagnosis and to allow creation of raw images
- */
-struct nand_ecclayout {
- uint32_t eccbytes;
- uint32_t eccpos[64];
- uint32_t oobavail;
- struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
-};
-
-/**
- * struct mtd_ecc_stats - error correction stats
- *
- * @corrected: number of corrected bits
- * @failed: number of uncorrectable errors
- * @badblocks: number of bad blocks in this partition
- * @bbtblocks: number of blocks reserved for bad block tables
- */
-struct mtd_ecc_stats {
- uint32_t corrected;
- uint32_t failed;
- uint32_t badblocks;
- uint32_t bbtblocks;
-};
-
-/*
- * Read/write file modes for access to MTD
- */
-enum mtd_file_modes {
- MTD_MODE_NORMAL = MTD_OTP_OFF,
- MTD_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
- MTD_MODE_OTP_USER = MTD_OTP_USER,
- MTD_MODE_RAW,
-};
-
-#endif /* __MTD_ABI_H__ */
diff --git a/libdde_linux26/contrib/include/mtd/mtd-user.h b/libdde_linux26/contrib/include/mtd/mtd-user.h
deleted file mode 100644
index 170ceca3..00000000
--- a/libdde_linux26/contrib/include/mtd/mtd-user.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * MTD ABI header for use by user space only.
- */
-
-#ifndef __MTD_USER_H__
-#define __MTD_USER_H__
-
-#include <stdint.h>
-
-/* This file is blessed for inclusion by userspace */
-#include <mtd/mtd-abi.h>
-
-typedef struct mtd_info_user mtd_info_t;
-typedef struct erase_info_user erase_info_t;
-typedef struct region_info_user region_info_t;
-typedef struct nand_oobinfo nand_oobinfo_t;
-typedef struct nand_ecclayout nand_ecclayout_t;
-
-#endif /* __MTD_USER_H__ */
diff --git a/libdde_linux26/contrib/include/mtd/nftl-user.h b/libdde_linux26/contrib/include/mtd/nftl-user.h
deleted file mode 100644
index 390d21c0..00000000
--- a/libdde_linux26/contrib/include/mtd/nftl-user.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Parts of NFTL headers shared with userspace
- *
- */
-
-#ifndef __MTD_NFTL_USER_H__
-#define __MTD_NFTL_USER_H__
-
-/* Block Control Information */
-
-struct nftl_bci {
- unsigned char ECCSig[6];
- uint8_t Status;
- uint8_t Status1;
-}__attribute__((packed));
-
-/* Unit Control Information */
-
-struct nftl_uci0 {
- uint16_t VirtUnitNum;
- uint16_t ReplUnitNum;
- uint16_t SpareVirtUnitNum;
- uint16_t SpareReplUnitNum;
-} __attribute__((packed));
-
-struct nftl_uci1 {
- uint32_t WearInfo;
- uint16_t EraseMark;
- uint16_t EraseMark1;
-} __attribute__((packed));
-
-struct nftl_uci2 {
- uint16_t FoldMark;
- uint16_t FoldMark1;
- uint32_t unused;
-} __attribute__((packed));
-
-union nftl_uci {
- struct nftl_uci0 a;
- struct nftl_uci1 b;
- struct nftl_uci2 c;
-};
-
-struct nftl_oob {
- struct nftl_bci b;
- union nftl_uci u;
-};
-
-/* NFTL Media Header */
-
-struct NFTLMediaHeader {
- char DataOrgID[6];
- uint16_t NumEraseUnits;
- uint16_t FirstPhysicalEUN;
- uint32_t FormattedSize;
- unsigned char UnitSizeFactor;
-} __attribute__((packed));
-
-#define MAX_ERASE_ZONES (8192 - 512)
-
-#define ERASE_MARK 0x3c69
-#define SECTOR_FREE 0xff
-#define SECTOR_USED 0x55
-#define SECTOR_IGNORE 0x11
-#define SECTOR_DELETED 0x00
-
-#define FOLD_MARK_IN_PROGRESS 0x5555
-
-#define ZONE_GOOD 0xff
-#define ZONE_BAD_ORIGINAL 0
-#define ZONE_BAD_MARKED 7
-
-
-#endif /* __MTD_NFTL_USER_H__ */
diff --git a/libdde_linux26/contrib/include/mtd/ubi-user.h b/libdde_linux26/contrib/include/mtd/ubi-user.h
deleted file mode 100644
index 296efae3..00000000
--- a/libdde_linux26/contrib/include/mtd/ubi-user.h
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * Copyright (c) International Business Machines Corp., 2006
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Artem Bityutskiy (Битюцкий Артём)
- */
-
-#ifndef __UBI_USER_H__
-#define __UBI_USER_H__
-
-/*
- * UBI device creation (the same as MTD device attachment)
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * MTD devices may be attached using %UBI_IOCATT ioctl command of the UBI
- * control device. The caller has to properly fill and pass
- * &struct ubi_attach_req object - UBI will attach the MTD device specified in
- * the request and return the newly created UBI device number as the ioctl
- * return value.
- *
- * UBI device deletion (the same as MTD device detachment)
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * An UBI device maybe deleted with %UBI_IOCDET ioctl command of the UBI
- * control device.
- *
- * UBI volume creation
- * ~~~~~~~~~~~~~~~~~~~
- *
- * UBI volumes are created via the %UBI_IOCMKVOL ioctl command of UBI character
- * device. A &struct ubi_mkvol_req object has to be properly filled and a
- * pointer to it has to be passed to the ioctl.
- *
- * UBI volume deletion
- * ~~~~~~~~~~~~~~~~~~~
- *
- * To delete a volume, the %UBI_IOCRMVOL ioctl command of the UBI character
- * device should be used. A pointer to the 32-bit volume ID hast to be passed
- * to the ioctl.
- *
- * UBI volume re-size
- * ~~~~~~~~~~~~~~~~~~
- *
- * To re-size a volume, the %UBI_IOCRSVOL ioctl command of the UBI character
- * device should be used. A &struct ubi_rsvol_req object has to be properly
- * filled and a pointer to it has to be passed to the ioctl.
- *
- * UBI volumes re-name
- * ~~~~~~~~~~~~~~~~~~~
- *
- * To re-name several volumes atomically at one go, the %UBI_IOCRNVOL command
- * of the UBI character device should be used. A &struct ubi_rnvol_req object
- * has to be properly filled and a pointer to it has to be passed to the ioctl.
- *
- * UBI volume update
- * ~~~~~~~~~~~~~~~~~
- *
- * Volume update should be done via the %UBI_IOCVOLUP ioctl command of the
- * corresponding UBI volume character device. A pointer to a 64-bit update
- * size should be passed to the ioctl. After this, UBI expects user to write
- * this number of bytes to the volume character device. The update is finished
- * when the claimed number of bytes is passed. So, the volume update sequence
- * is something like:
- *
- * fd = open("/dev/my_volume");
- * ioctl(fd, UBI_IOCVOLUP, &image_size);
- * write(fd, buf, image_size);
- * close(fd);
- *
- * Logical eraseblock erase
- * ~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * To erase a logical eraseblock, the %UBI_IOCEBER ioctl command of the
- * corresponding UBI volume character device should be used. This command
- * unmaps the requested logical eraseblock, makes sure the corresponding
- * physical eraseblock is successfully erased, and returns.
- *
- * Atomic logical eraseblock change
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Atomic logical eraseblock change operation is called using the %UBI_IOCEBCH
- * ioctl command of the corresponding UBI volume character device. A pointer to
- * a &struct ubi_leb_change_req object has to be passed to the ioctl. Then the
- * user is expected to write the requested amount of bytes (similarly to what
- * should be done in case of the "volume update" ioctl).
- *
- * Logical eraseblock map
- * ~~~~~~~~~~~~~~~~~~~~~
- *
- * To map a logical eraseblock to a physical eraseblock, the %UBI_IOCEBMAP
- * ioctl command should be used. A pointer to a &struct ubi_map_req object is
- * expected to be passed. The ioctl maps the requested logical eraseblock to
- * a physical eraseblock and returns. Only non-mapped logical eraseblocks can
- * be mapped. If the logical eraseblock specified in the request is already
- * mapped to a physical eraseblock, the ioctl fails and returns error.
- *
- * Logical eraseblock unmap
- * ~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * To unmap a logical eraseblock to a physical eraseblock, the %UBI_IOCEBUNMAP
- * ioctl command should be used. The ioctl unmaps the logical eraseblocks,
- * schedules corresponding physical eraseblock for erasure, and returns. Unlike
- * the "LEB erase" command, it does not wait for the physical eraseblock being
- * erased. Note, the side effect of this is that if an unclean reboot happens
- * after the unmap ioctl returns, you may find the LEB mapped again to the same
- * physical eraseblock after the UBI is run again.
- *
- * Check if logical eraseblock is mapped
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * To check if a logical eraseblock is mapped to a physical eraseblock, the
- * %UBI_IOCEBISMAP ioctl command should be used. It returns %0 if the LEB is
- * not mapped, and %1 if it is mapped.
- *
- * Set an UBI volume property
- * ~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be
- * used. A pointer to a &struct ubi_set_prop_req object is expected to be
- * passed. The object describes which property should be set, and to which value
- * it should be set.
- */
-
-/*
- * When a new UBI volume or UBI device is created, users may either specify the
- * volume/device number they want to create or to let UBI automatically assign
- * the number using these constants.
- */
-#define UBI_VOL_NUM_AUTO (-1)
-#define UBI_DEV_NUM_AUTO (-1)
-
-/* Maximum volume name length */
-#define UBI_MAX_VOLUME_NAME 127
-
-/* ioctl commands of UBI character devices */
-
-#define UBI_IOC_MAGIC 'o'
-
-/* Create an UBI volume */
-#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
-/* Remove an UBI volume */
-#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t)
-/* Re-size an UBI volume */
-#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
-/* Re-name volumes */
-#define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req)
-
-/* ioctl commands of the UBI control character device */
-
-#define UBI_CTRL_IOC_MAGIC 'o'
-
-/* Attach an MTD device */
-#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
-/* Detach an MTD device */
-#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, int32_t)
-
-/* ioctl commands of UBI volume character devices */
-
-#define UBI_VOL_IOC_MAGIC 'O'
-
-/* Start UBI volume update */
-#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t)
-/* LEB erasure command, used for debugging, disabled by default */
-#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t)
-/* Atomic LEB change command */
-#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, int32_t)
-/* Map LEB command */
-#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
-/* Unmap LEB command */
-#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t)
-/* Check if LEB is mapped command */
-#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t)
-/* Set an UBI volume property */
-#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req)
-
-/* Maximum MTD device name length supported by UBI */
-#define MAX_UBI_MTD_NAME_LEN 127
-
-/* Maximum amount of UBI volumes that can be re-named at one go */
-#define UBI_MAX_RNVOL 32
-
-/*
- * UBI data type hint constants.
- *
- * UBI_LONGTERM: long-term data
- * UBI_SHORTTERM: short-term data
- * UBI_UNKNOWN: data persistence is unknown
- *
- * These constants are used when data is written to UBI volumes in order to
- * help the UBI wear-leveling unit to find more appropriate physical
- * eraseblocks.
- */
-enum {
- UBI_LONGTERM = 1,
- UBI_SHORTTERM = 2,
- UBI_UNKNOWN = 3,
-};
-
-/*
- * UBI volume type constants.
- *
- * @UBI_DYNAMIC_VOLUME: dynamic volume
- * @UBI_STATIC_VOLUME: static volume
- */
-enum {
- UBI_DYNAMIC_VOLUME = 3,
- UBI_STATIC_VOLUME = 4,
-};
-
-/*
- * UBI set property ioctl constants
- *
- * @UBI_PROP_DIRECT_WRITE: allow / disallow user to directly write and
- * erase individual eraseblocks on dynamic volumes
- */
-enum {
- UBI_PROP_DIRECT_WRITE = 1,
-};
-
-/**
- * struct ubi_attach_req - attach MTD device request.
- * @ubi_num: UBI device number to create
- * @mtd_num: MTD device number to attach
- * @vid_hdr_offset: VID header offset (use defaults if %0)
- * @padding: reserved for future, not used, has to be zeroed
- *
- * This data structure is used to specify MTD device UBI has to attach and the
- * parameters it has to use. The number which should be assigned to the new UBI
- * device is passed in @ubi_num. UBI may automatically assign the number if
- * @UBI_DEV_NUM_AUTO is passed. In this case, the device number is returned in
- * @ubi_num.
- *
- * Most applications should pass %0 in @vid_hdr_offset to make UBI use default
- * offset of the VID header within physical eraseblocks. The default offset is
- * the next min. I/O unit after the EC header. For example, it will be offset
- * 512 in case of a 512 bytes page NAND flash with no sub-page support. Or
- * it will be 512 in case of a 2KiB page NAND flash with 4 512-byte sub-pages.
- *
- * But in rare cases, if this optimizes things, the VID header may be placed to
- * a different offset. For example, the boot-loader might do things faster if
- * the VID header sits at the end of the first 2KiB NAND page with 4 sub-pages.
- * As the boot-loader would not normally need to read EC headers (unless it
- * needs UBI in RW mode), it might be faster to calculate ECC. This is weird
- * example, but it real-life example. So, in this example, @vid_hdr_offer would
- * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes
- * aligned, which is OK, as UBI is clever enough to realize this is 4th
- * sub-page of the first page and add needed padding.
- */
-struct ubi_attach_req {
- int32_t ubi_num;
- int32_t mtd_num;
- int32_t vid_hdr_offset;
- int8_t padding[12];
-};
-
-/**
- * struct ubi_mkvol_req - volume description data structure used in
- * volume creation requests.
- * @vol_id: volume number
- * @alignment: volume alignment
- * @bytes: volume size in bytes
- * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
- * @padding1: reserved for future, not used, has to be zeroed
- * @name_len: volume name length
- * @padding2: reserved for future, not used, has to be zeroed
- * @name: volume name
- *
- * This structure is used by user-space programs when creating new volumes. The
- * @used_bytes field is only necessary when creating static volumes.
- *
- * The @alignment field specifies the required alignment of the volume logical
- * eraseblock. This means, that the size of logical eraseblocks will be aligned
- * to this number, i.e.,
- * (UBI device logical eraseblock size) mod (@alignment) = 0.
- *
- * To put it differently, the logical eraseblock of this volume may be slightly
- * shortened in order to make it properly aligned. The alignment has to be
- * multiple of the flash minimal input/output unit, or %1 to utilize the entire
- * available space of logical eraseblocks.
- *
- * The @alignment field may be useful, for example, when one wants to maintain
- * a block device on top of an UBI volume. In this case, it is desirable to fit
- * an integer number of blocks in logical eraseblocks of this UBI volume. With
- * alignment it is possible to update this volume using plane UBI volume image
- * BLOBs, without caring about how to properly align them.
- */
-struct ubi_mkvol_req {
- int32_t vol_id;
- int32_t alignment;
- int64_t bytes;
- int8_t vol_type;
- int8_t padding1;
- int16_t name_len;
- int8_t padding2[4];
- char name[UBI_MAX_VOLUME_NAME + 1];
-} __attribute__ ((packed));
-
-/**
- * struct ubi_rsvol_req - a data structure used in volume re-size requests.
- * @vol_id: ID of the volume to re-size
- * @bytes: new size of the volume in bytes
- *
- * Re-sizing is possible for both dynamic and static volumes. But while dynamic
- * volumes may be re-sized arbitrarily, static volumes cannot be made to be
- * smaller than the number of bytes they bear. To arbitrarily shrink a static
- * volume, it must be wiped out first (by means of volume update operation with
- * zero number of bytes).
- */
-struct ubi_rsvol_req {
- int64_t bytes;
- int32_t vol_id;
-} __attribute__ ((packed));
-
-/**
- * struct ubi_rnvol_req - volumes re-name request.
- * @count: count of volumes to re-name
- * @padding1: reserved for future, not used, has to be zeroed
- * @vol_id: ID of the volume to re-name
- * @name_len: name length
- * @padding2: reserved for future, not used, has to be zeroed
- * @name: new volume name
- *
- * UBI allows to re-name up to %32 volumes at one go. The count of volumes to
- * re-name is specified in the @count field. The ID of the volumes to re-name
- * and the new names are specified in the @vol_id and @name fields.
- *
- * The UBI volume re-name operation is atomic, which means that should power cut
- * happen, the volumes will have either old name or new name. So the possible
- * use-cases of this command is atomic upgrade. Indeed, to upgrade, say, volumes
- * A and B one may create temporary volumes %A1 and %B1 with the new contents,
- * then atomically re-name A1->A and B1->B, in which case old %A and %B will
- * be removed.
- *
- * If it is not desirable to remove old A and B, the re-name request has to
- * contain 4 entries: A1->A, A->A1, B1->B, B->B1, in which case old A1 and B1
- * become A and B, and old A and B will become A1 and B1.
- *
- * It is also OK to request: A1->A, A1->X, B1->B, B->Y, in which case old A1
- * and B1 become A and B, and old A and B become X and Y.
- *
- * In other words, in case of re-naming into an existing volume name, the
- * existing volume is removed, unless it is re-named as well at the same
- * re-name request.
- */
-struct ubi_rnvol_req {
- int32_t count;
- int8_t padding1[12];
- struct {
- int32_t vol_id;
- int16_t name_len;
- int8_t padding2[2];
- char name[UBI_MAX_VOLUME_NAME + 1];
- } ents[UBI_MAX_RNVOL];
-} __attribute__ ((packed));
-
-/**
- * struct ubi_leb_change_req - a data structure used in atomic LEB change
- * requests.
- * @lnum: logical eraseblock number to change
- * @bytes: how many bytes will be written to the logical eraseblock
- * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
- * @padding: reserved for future, not used, has to be zeroed
- */
-struct ubi_leb_change_req {
- int32_t lnum;
- int32_t bytes;
- int8_t dtype;
- int8_t padding[7];
-} __attribute__ ((packed));
-
-/**
- * struct ubi_map_req - a data structure used in map LEB requests.
- * @lnum: logical eraseblock number to unmap
- * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
- * @padding: reserved for future, not used, has to be zeroed
- */
-struct ubi_map_req {
- int32_t lnum;
- int8_t dtype;
- int8_t padding[3];
-} __attribute__ ((packed));
-
-
-/**
- * struct ubi_set_prop_req - a data structure used to set an ubi volume
- * property.
- * @property: property to set (%UBI_PROP_DIRECT_WRITE)
- * @padding: reserved for future, not used, has to be zeroed
- * @value: value to set
- */
-struct ubi_set_prop_req {
- uint8_t property;
- uint8_t padding[7];
- uint64_t value;
-} __attribute__ ((packed));
-
-#endif /* __UBI_USER_H__ */