aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/new-utils/include
diff options
context:
space:
mode:
Diffstat (limited to 'ubi-utils/new-utils/include')
-rw-r--r--ubi-utils/new-utils/include/libubi.h11
-rw-r--r--ubi-utils/new-utils/include/libubigen.h18
2 files changed, 19 insertions, 10 deletions
diff --git a/ubi-utils/new-utils/include/libubi.h b/ubi-utils/new-utils/include/libubi.h
index 3e8c55a..0f5c9c8 100644
--- a/ubi-utils/new-utils/include/libubi.h
+++ b/ubi-utils/new-utils/include/libubi.h
@@ -195,6 +195,17 @@ void libubi_close(libubi_t desc);
int ubi_get_info(libubi_t desc, struct ubi_info *info);
/**
+ * mtd_num2ubi_dev - find UBI device by attached MTD device.
+ * @@desc: UBI library descriptor
+ * @mtd_num: MTD device number
+ * @dev_num: UBI device number is returned here
+ *
+ * This function finds UBI device to which MTD device @mtd_num is attached.
+ * Returns %0 if the UBI device was found and %-1 if not.
+ */
+int mtd_num2ubi_dev(libubi_t desc, int mtd_num, int *dev_num);
+
+/**
* ubi_attach_mtd - attach MTD device to UBI.
* @desc: UBI library descriptor
* @node: name of the UBI control character device node
diff --git a/ubi-utils/new-utils/include/libubigen.h b/ubi-utils/new-utils/include/libubigen.h
index 058cf8a..c2b95b0 100644
--- a/ubi-utils/new-utils/include/libubigen.h
+++ b/ubi-utils/new-utils/include/libubigen.h
@@ -26,8 +26,6 @@
#define __LIBUBIGEN_H__
#include <stdint.h>
-#include <stdio.h>
-#include <mtd_swab.h>
#ifdef __cplusplus
extern "C" {
@@ -41,7 +39,6 @@ extern "C" {
* @vid_hdr_offs: offset of the VID header
* @data_offs: data offset
* @ubi_ver: UBI version
- * @ec: initial erase counter
* @vtbl_size: volume table size
* @max_volumes: maximum amount of volumes
*/
@@ -53,7 +50,6 @@ struct ubigen_info
int vid_hdr_offs;
int data_offs;
int ubi_ver;
- long long ec;
int vtbl_size;
int max_volumes;
};
@@ -92,18 +88,20 @@ struct ubigen_vol_info
};
void ubigen_info_init(struct ubigen_info *ui, int peb_size, int min_io_size,
- int subpage_size, int vid_hdr_offs, int ubi_ver,
- long long ec);
+ int subpage_size, int vid_hdr_offs, int ubi_ver);
struct ubi_vtbl_record *ubigen_create_empty_vtbl(const struct ubigen_info *ui);
+void ubigen_init_ec_hdr(const struct ubigen_info *ui,
+ struct ubi_ec_hdr *hdr, long long ec);
int ubigen_get_vtbl_size(const struct ubigen_info *ui);
int ubigen_add_volume(const struct ubigen_info *ui,
const struct ubigen_vol_info *vi,
struct ubi_vtbl_record *vtbl);
int ubigen_write_volume(const struct ubigen_info *ui,
- const struct ubigen_vol_info *vi,
- long long bytes, FILE *in, FILE *out);
-int ubigen_write_layout_vol(const struct ubigen_info *ui,
- struct ubi_vtbl_record *vtbl, FILE *out);
+ const struct ubigen_vol_info *vi, long long ec,
+ long long bytes, int in, int out);
+int ubigen_write_layout_vol(const struct ubigen_info *ui, int peb1, int peb2,
+ long long ec1, long long ec2,
+ struct ubi_vtbl_record *vtbl, int fd);
#ifdef __cplusplus
}