aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.h3
-rw-r--r--include/libmissing.h2
-rw-r--r--include/libmtd.h28
-rw-r--r--include/libubi.h5
-rw-r--r--include/mtd/mtd-abi.h2
-rw-r--r--include/mtd/ubi-user.h10
6 files changed, 44 insertions, 6 deletions
diff --git a/include/common.h b/include/common.h
index 7270769..303d30d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -31,8 +31,6 @@
#include <unistd.h>
#include <sys/sysmacros.h>
-#include "config.h"
-
#ifndef PROGRAM_NAME
# error "You must define PROGRAM_NAME before including this header"
#endif
@@ -238,6 +236,7 @@ do { \
long long util_get_bytes(const char *str);
void util_print_bytes(long long bytes, int bracket);
int util_srand(void);
+char *mtd_find_dev_node(const char *id);
/*
* The following helpers are here to avoid compiler complaints about unchecked
diff --git a/include/libmissing.h b/include/libmissing.h
index 0196033..0fb0cf4 100644
--- a/include/libmissing.h
+++ b/include/libmissing.h
@@ -1,8 +1,6 @@
#ifndef LIBMISSING_H
#define LIBMISSING_H
-#include "config.h"
-
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
diff --git a/include/libmtd.h b/include/libmtd.h
index cc24af8..f909a16 100644
--- a/include/libmtd.h
+++ b/include/libmtd.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008, 2009 Nokia Corporation
+ * Copyright 2021 NXP
*
* 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
@@ -129,7 +130,7 @@ int mtd_get_info(libmtd_t desc, struct mtd_info *info);
/**
* mtd_get_dev_info - get information about an MTD device.
* @desc: MTD library descriptor
- * @node: name of the MTD device node
+ * @node: path of the MTD device node
* @mtd: the MTD device information is returned here
*
* This function gets information about MTD device defined by the @node device
@@ -151,6 +152,17 @@ int mtd_get_dev_info(libmtd_t desc, const char *node, struct mtd_dev_info *mtd);
int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd);
/**
+ * mtd_get_dev_info2 - get information about an MTD device.
+ * @desc: MTD library descriptor
+ * @name: name of the MTD device
+ * @mtd: the MTD device information is returned here
+ *
+ * This function is identical to 'mtd_get_dev_info()' except that it accepts
+ * MTD device's name, not MTD character device.
+ */
+int mtd_get_dev_info2(libmtd_t desc, const char *name, struct mtd_dev_info *mtd);
+
+/**
* mtd_lock - lock eraseblocks.
* @desc: MTD library descriptor
* @mtd: MTD device description object
@@ -175,6 +187,20 @@ int mtd_lock(const struct mtd_dev_info *mtd, int fd, int eb);
int mtd_unlock(const struct mtd_dev_info *mtd, int fd, int eb);
/**
+ * mtd_unlock_multi - unlock eraseblocks.
+ * @desc: MTD library descriptor
+ * @mtd: MTD device description object
+ * @fd: MTD device node file descriptor
+ * @eb: index of first eraseblock to unlock
+ * @blocks: the number of eraseblocks to unlock
+ *
+ * This function unlocks @blocks starting at eraseblock @eb.
+ * Returns %0 in case of success and %-1 in case of failure.
+ */
+int mtd_unlock_multi(const struct mtd_dev_info *mtd, int fd, int eb,
+ int blocks);
+
+/**
* mtd_erase - erase multiple eraseblocks.
* @desc: MTD library descriptor
* @mtd: MTD device description object
diff --git a/include/libubi.h b/include/libubi.h
index 46c732a..e1e234e 100644
--- a/include/libubi.h
+++ b/include/libubi.h
@@ -25,6 +25,7 @@
#include <ctype.h>
#include <stdint.h>
+#include <stdbool.h>
#include <mtd/ubi-user.h>
#ifdef __cplusplus
@@ -53,6 +54,8 @@ typedef void * libubi_t;
* @vid_hdr_offset: VID header offset (%0 means default offset and this is what
* most of the users want)
* @max_beb_per1024: Maximum expected bad eraseblocks per 1024 eraseblocks
+ * @disable_fm: whether disable fastmap
+ * @need_resv_pool: whether reserve free pebs for filling pool/wl_pool
*/
struct ubi_attach_request
{
@@ -61,6 +64,8 @@ struct ubi_attach_request
const char *mtd_dev_node;
int vid_hdr_offset;
int max_beb_per1024;
+ bool disable_fm;
+ bool need_resv_pool;
};
/**
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index bcd7496..a54c386 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -201,6 +201,8 @@ struct otp_info {
* modes (see "struct mtd_write_req")
*/
#define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
+/* Erase a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */
+#define OTPERASE _IOW('M', 25, struct otp_info)
/*
* Obsolete legacy interface. Keep it in order not to break userspace
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 707c4f2..bb5c0f9 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -235,6 +235,8 @@ enum {
* @mtd_num: MTD device number to attach
* @vid_hdr_offset: VID header offset (use defaults if %0)
* @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs
+ * @disable_fm: whether disable fastmap
+ * @need_resv_pool: whether reserve free pebs for filling pool/wl_pool
* @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
@@ -270,13 +272,19 @@ enum {
* eraseblocks for new bad eraseblocks, but attempts to use available
* eraseblocks (if any). The accepted range is 0-768. If 0 is given, the
* default kernel value of %CONFIG_MTD_UBI_BEB_LIMIT will be used.
+ *
+ * If @disable_fm is not zero, ubi doesn't create new fastmap even the module
+ * param 'fm_autoconvert' is set, and existed old fastmap will be destroyed
+ * after doing full scanning.
*/
struct ubi_attach_req {
int32_t ubi_num;
int32_t mtd_num;
int32_t vid_hdr_offset;
int16_t max_beb_per1024;
- int8_t padding[10];
+ int8_t disable_fm;
+ int8_t need_resv_pool;
+ int8_t padding[8];
};
/*