@@ -84,24 +84,25 @@ if (!(EXPR)) \
8484#endif /* FDB_ASSERT */
8585#endif /* FDB_USING_NATIVE_ASSERT */
8686
87- #define FDB_KVDB_CTRL_SET_SEC_SIZE 0x00 /**< set sector size control command, this change MUST before database initialization */
88- #define FDB_KVDB_CTRL_GET_SEC_SIZE 0x01 /**< get sector size control command */
89- #define FDB_KVDB_CTRL_SET_LOCK 0x02 /**< set lock function control command */
90- #define FDB_KVDB_CTRL_SET_UNLOCK 0x03 /**< set unlock function control command */
91- #define FDB_KVDB_CTRL_SET_FILE_MODE 0x09 /**< set file mode control command, this change MUST before database initialization */
92- #define FDB_KVDB_CTRL_SET_MAX_SIZE 0x0A /**< set database max size in file mode control command, this change MUST before database initialization */
93- #define FDB_KVDB_CTRL_SET_NOT_FORMAT 0x0B /**< set database NOT format mode control command, this change MUST before database initialization */
94-
95- #define FDB_TSDB_CTRL_SET_SEC_SIZE 0x00 /**< set sector size control command, this change MUST before database initialization */
96- #define FDB_TSDB_CTRL_GET_SEC_SIZE 0x01 /**< get sector size control command */
97- #define FDB_TSDB_CTRL_SET_LOCK 0x02 /**< set lock function control command */
98- #define FDB_TSDB_CTRL_SET_UNLOCK 0x03 /**< set unlock function control command */
99- #define FDB_TSDB_CTRL_SET_ROLLOVER 0x04 /**< set rollover control command, this change MUST after database initialization */
100- #define FDB_TSDB_CTRL_GET_ROLLOVER 0x05 /**< get rollover control command */
101- #define FDB_TSDB_CTRL_GET_LAST_TIME 0x06 /**< get last save time control command */
102- #define FDB_TSDB_CTRL_SET_FILE_MODE 0x09 /**< set file mode control command, this change MUST before database initialization */
103- #define FDB_TSDB_CTRL_SET_MAX_SIZE 0x0A /**< set database max size in file mode control command, this change MUST before database initialization */
104- #define FDB_TSDB_CTRL_SET_NOT_FORMAT 0x0B /**< set database NOT formatable mode control command, this change MUST before database initialization */
87+ #define FDB_KVDB_CTRL_SET_SEC_SIZE 0x00 /**< set sector size control command, this change MUST before database initialization */
88+ #define FDB_KVDB_CTRL_GET_SEC_SIZE 0x01 /**< get sector size control command */
89+ #define FDB_KVDB_CTRL_SET_LOCK 0x02 /**< set lock function control command */
90+ #define FDB_KVDB_CTRL_SET_UNLOCK 0x03 /**< set unlock function control command */
91+ #define FDB_KVDB_CTRL_SET_FILE_MODE 0x09 /**< set file mode control command, this change MUST before database initialization */
92+ #define FDB_KVDB_CTRL_SET_MAX_SIZE 0x0A /**< set database max size in file mode control command, this change MUST before database initialization */
93+ #define FDB_KVDB_CTRL_SET_NOT_FORMAT 0x0B /**< set database NOT format mode control command, this change MUST before database initialization */
94+
95+ #define FDB_TSDB_CTRL_SET_SEC_SIZE 0x00 /**< set sector size control command, this change MUST before database initialization */
96+ #define FDB_TSDB_CTRL_GET_SEC_SIZE 0x01 /**< get sector size control command */
97+ #define FDB_TSDB_CTRL_SET_LOCK 0x02 /**< set lock function control command */
98+ #define FDB_TSDB_CTRL_SET_UNLOCK 0x03 /**< set unlock function control command */
99+ #define FDB_TSDB_CTRL_SET_ROLLOVER 0x04 /**< set rollover control command, this change MUST after database initialization */
100+ #define FDB_TSDB_CTRL_GET_ROLLOVER 0x05 /**< get rollover control command */
101+ #define FDB_TSDB_CTRL_GET_LAST_TIME 0x06 /**< get last save time control command */
102+ #define FDB_TSDB_CTRL_SET_FILE_MODE 0x09 /**< set file mode control command, this change MUST before database initialization */
103+ #define FDB_TSDB_CTRL_SET_MAX_SIZE 0x0A /**< set database max size in file mode control command, this change MUST before database initialization */
104+ #define FDB_TSDB_CTRL_SET_NOT_FORMAT 0x0B /**< set database NOT formatable mode control command, this change MUST before database initialization */
105+ #define FDB_TSDB_CTRL_SET_FORMAT_BAD_SEC_ONLY 0x0C /**< format bad sectors only */
105106
106107#ifdef FDB_USING_TIMESTAMP_64BIT
107108 typedef int64_t fdb_time_t ;
@@ -278,6 +279,7 @@ struct fdb_db {
278279 bool init_ok ; /**< initialized successfully */
279280 bool file_mode ; /**< is file mode, default is false */
280281 bool not_formatable ; /**< is can NOT be formated mode, default is false */
282+ bool format_bad_sec_only ; /**< only format the bad sectors */
281283#ifdef FDB_USING_FILE_MODE
282284 uint32_t cur_file_sec [FDB_FILE_CACHE_TABLE_SIZE ];/**< last operate sector address */
283285#if defined(FDB_USING_FILE_POSIX_MODE )
0 commit comments