4040 * UBI volume creation
4141 * ~~~~~~~~~~~~~~~~~~~
4242 *
43- * UBI volumes are created via the %UBI_IOCMKVOL IOCTL command of UBI character
43+ * UBI volumes are created via the %UBI_IOCMKVOL ioctl command of UBI character
4444 * device. A &struct ubi_mkvol_req object has to be properly filled and a
45- * pointer to it has to be passed to the IOCTL .
45+ * pointer to it has to be passed to the ioctl .
4646 *
4747 * UBI volume deletion
4848 * ~~~~~~~~~~~~~~~~~~~
4949 *
50- * To delete a volume, the %UBI_IOCRMVOL IOCTL command of the UBI character
50+ * To delete a volume, the %UBI_IOCRMVOL ioctl command of the UBI character
5151 * device should be used. A pointer to the 32-bit volume ID hast to be passed
52- * to the IOCTL .
52+ * to the ioctl .
5353 *
5454 * UBI volume re-size
5555 * ~~~~~~~~~~~~~~~~~~
5656 *
57- * To re-size a volume, the %UBI_IOCRSVOL IOCTL command of the UBI character
57+ * To re-size a volume, the %UBI_IOCRSVOL ioctl command of the UBI character
5858 * device should be used. A &struct ubi_rsvol_req object has to be properly
59- * filled and a pointer to it has to be passed to the IOCTL .
59+ * filled and a pointer to it has to be passed to the ioctl .
6060 *
6161 * UBI volumes re-name
6262 * ~~~~~~~~~~~~~~~~~~~
6363 *
6464 * To re-name several volumes atomically at one go, the %UBI_IOCRNVOL command
6565 * of the UBI character device should be used. A &struct ubi_rnvol_req object
66- * has to be properly filled and a pointer to it has to be passed to the IOCTL .
66+ * has to be properly filled and a pointer to it has to be passed to the ioctl .
6767 *
6868 * UBI volume update
6969 * ~~~~~~~~~~~~~~~~~
7070 *
71- * Volume update should be done via the %UBI_IOCVOLUP IOCTL command of the
71+ * Volume update should be done via the %UBI_IOCVOLUP ioctl command of the
7272 * corresponding UBI volume character device. A pointer to a 64-bit update
73- * size should be passed to the IOCTL . After this, UBI expects user to write
73+ * size should be passed to the ioctl . After this, UBI expects user to write
7474 * this number of bytes to the volume character device. The update is finished
7575 * when the claimed number of bytes is passed. So, the volume update sequence
7676 * is something like:
8080 * write(fd, buf, image_size);
8181 * close(fd);
8282 *
83- * Atomic eraseblock change
83+ * Logical eraseblock erase
8484 * ~~~~~~~~~~~~~~~~~~~~~~~~
8585 *
86- * Atomic eraseblock change operation is done via the %UBI_IOCEBCH IOCTL
87- * command of the corresponding UBI volume character device. A pointer to
88- * &struct ubi_leb_change_req has to be passed to the IOCTL. Then the user is
89- * expected to write the requested amount of bytes. This is similar to the
90- * "volume update" IOCTL.
86+ * To erase a logical eraseblock, the %UBI_IOCEBER ioctl command of the
87+ * corresponding UBI volume character device should be used. This command
88+ * unmaps the requested logical eraseblock, makes sure the corresponding
89+ * physical eraseblock is successfully erased, and returns.
90+ *
91+ * Atomic logical eraseblock change
92+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93+ *
94+ * Atomic logical eraseblock change operation is called using the %UBI_IOCEBCH
95+ * ioctl command of the corresponding UBI volume character device. A pointer to
96+ * a &struct ubi_leb_change_req object has to be passed to the ioctl. Then the
97+ * user is expected to write the requested amount of bytes (similarly to what
98+ * should be done in case of the "volume update" ioctl).
99+ *
100+ * Logical eraseblock map
101+ * ~~~~~~~~~~~~~~~~~~~~~
102+ *
103+ * To map a logical eraseblock to a physical eraseblock, the %UBI_IOCEBMAP
104+ * ioctl command should be used. A pointer to a &struct ubi_map_req object is
105+ * expected to be passed. The ioctl maps the requested logical eraseblock to
106+ * a physical eraseblock and returns. Only non-mapped logical eraseblocks can
107+ * be mapped. If the logical eraseblock specified in the request is already
108+ * mapped to a physical eraseblock, the ioctl fails and returns error.
109+ *
110+ * Logical eraseblock unmap
111+ * ~~~~~~~~~~~~~~~~~~~~~~~~
112+ *
113+ * To unmap a logical eraseblock to a physical eraseblock, the %UBI_IOCEBUNMAP
114+ * ioctl command should be used. The ioctl unmaps the logical eraseblocks,
115+ * schedules corresponding physical eraseblock for erasure, and returns. Unlike
116+ * the "LEB erase" command, it does not wait for the physical eraseblock being
117+ * erased. Note, the side effect of this is that if an unclean reboot happens
118+ * after the unmap ioctl returns, you may find the LEB mapped again to the same
119+ * physical eraseblock after the UBI is run again.
120+ *
121+ * Check if logical eraseblock is mapped
122+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123+ *
124+ * To check if a logical eraseblock is mapped to a physical eraseblock, the
125+ * %UBI_IOCEBISMAP ioctl command should be used. It returns %0 if the LEB is
126+ * not mapped, and %1 if it is mapped.
91127 */
92128
93129/*
101137/* Maximum volume name length */
102138#define UBI_MAX_VOLUME_NAME 127
103139
104- /* IOCTL commands of UBI character devices */
140+ /* ioctl commands of UBI character devices */
105141
106142#define UBI_IOC_MAGIC 'o'
107143
114150/* Re-name volumes */
115151#define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req)
116152
117- /* IOCTL commands of the UBI control character device */
153+ /* ioctl commands of the UBI control character device */
118154
119155#define UBI_CTRL_IOC_MAGIC 'o'
120156
123159/* Detach an MTD device */
124160#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, int32_t)
125161
126- /* IOCTL commands of UBI volume character devices */
162+ /* ioctl commands of UBI volume character devices */
127163
128164#define UBI_VOL_IOC_MAGIC 'O'
129165
130166/* Start UBI volume update */
131167#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t)
132- /* An eraseblock erasure command, used for debugging, disabled by default */
168+ /* LEB erasure command, used for debugging, disabled by default */
133169#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t)
134- /* An atomic eraseblock change command */
170+ /* Atomic LEB change command */
135171#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, int32_t)
136- /* Map an eraseblock, used for debugging, disabled by default */
172+ /* Map LEB command */
137173#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
138- /* Unmap an eraseblock, used for debugging, disabled by default */
174+ /* Unmap LEB command */
139175#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t)
140- /* Check if an eraseblock is mapped, used for debugging, disabled by default */
176+ /* Check if LEB is mapped command */
141177#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t)
142178
143179/* Maximum MTD device name length supported by UBI */
@@ -311,8 +347,8 @@ struct ubi_rnvol_req {
311347} __attribute__ ((packed ));
312348
313349/**
314- * struct ubi_leb_change_req - a data structure used in atomic logical
315- * eraseblock change requests.
350+ * struct ubi_leb_change_req - a data structure used in atomic LEB change
351+ * requests.
316352 * @lnum: logical eraseblock number to change
317353 * @bytes: how many bytes will be written to the logical eraseblock
318354 * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
@@ -326,7 +362,7 @@ struct ubi_leb_change_req {
326362} __attribute__ ((packed ));
327363
328364/**
329- * struct ubi_map_req - a data structure used in map eraseblock requests.
365+ * struct ubi_map_req - a data structure used in map LEB requests.
330366 * @lnum: logical eraseblock number to unmap
331367 * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
332368 * @padding: reserved for future, not used, has to be zeroed
0 commit comments