Skip to content

Commit 83b3365

Browse files
committed
sys/log, fs/fcb2: Remove fcb2 support
1 parent 940cc46 commit 83b3365

File tree

7 files changed

+10
-75
lines changed

7 files changed

+10
-75
lines changed

fs/fcb2/include/fcb/fcb2.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -196,19 +196,6 @@ int fcb2_walk(struct fcb2 *fcb, int sector, fcb2_walk_cb cb, void *cb_arg);
196196
*/
197197
int fcb2_getnext(struct fcb2 *fcb, struct fcb2_entry *loc);
198198

199-
/**
200-
* Get first entry in the provided flash area
201-
*
202-
* @param fcb Pointer to FCB
203-
* @param range Optional range in flash sector
204-
* @param loc Pointer to first FCB entry in the provided flash area
205-
*
206-
* @return 0 on success, non-zero on failure
207-
*/
208-
int
209-
fcb2_getnext_in_area(struct fcb2 *fcb, struct flash_sector_range *range,
210-
struct fcb2_entry *loc);
211-
212199
/**
213200
* Walk through entries within FCB from newest to oldest.
214201
* fcb_getprev() finds the previous valid entry backwards from loc, and fills in
@@ -317,17 +304,6 @@ int fcb2_clear(struct fcb2 *fcb);
317304
*/
318305
int fcb2_area_info(struct fcb2 *fcb, int sector, int *elemsp, int *bytesp);
319306

320-
/**
321-
* Returns the next sector flash range, given current entry
322-
*
323-
* @param fcb Pointer to the FCB
324-
* @param loc Pointer to the location
325-
*
326-
* @return Flash sector range of the next sector
327-
*/
328-
struct flash_sector_range *
329-
fcb2_getnext_range(struct fcb2 *fcb, struct fcb2_entry *loc);
330-
331307
#ifdef __cplusplus
332308
}
333309

fs/fcb2/src/fcb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fcb2_init(struct fcb2 *fcb)
8888
fcb->f_active_id = newest;
8989

9090
while (1) {
91-
rc = fcb2_getnext_in_area(fcb, NULL, &fcb->f_active);
91+
rc = fcb2_getnext_in_area(fcb, &fcb->f_active);
9292
if (rc == FCB2_ERR_NOVAR) {
9393
rc = FCB2_OK;
9494
break;

fs/fcb2/src/fcb_getnext.c

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,13 @@
2222
#include "fcb_priv.h"
2323

2424
int
25-
fcb2_getnext_in_area(struct fcb2 *fcb, struct flash_sector_range *range,
26-
struct fcb2_entry *loc)
25+
fcb2_getnext_in_area(struct fcb2 *fcb, struct fcb2_entry *loc)
2726
{
2827
int rc = FCB2_ERR_CRC;
2928
int len;
3029
int next_data_offset;
3130
int next_entry_offset;
3231

33-
/* If a flash range is specified, find first entry in that area */
34-
if (range) {
35-
loc->fe_range = range;
36-
loc->fe_data_off = fcb2_len_in_flash(range, sizeof(struct fcb2_disk_area));
37-
loc->fe_entry_num = 0;
38-
loc->fe_data_len = 0;
39-
loc->fe_sector = 0;
40-
}
41-
4232
while (rc == FCB2_ERR_CRC) {
4333
len = loc->fe_data_len;
4434
/* Next data offset in sector */
@@ -62,17 +52,6 @@ fcb2_getnext_in_area(struct fcb2 *fcb, struct flash_sector_range *range,
6252
return rc;
6353
}
6454

65-
struct flash_sector_range *
66-
fcb2_getnext_range(struct fcb2 *fcb, struct fcb2_entry *loc)
67-
{
68-
loc->fe_entry_num = 0;
69-
loc->fe_data_len = 0;
70-
loc->fe_sector = fcb2_getnext_sector(fcb, loc->fe_sector);
71-
loc->fe_range = fcb2_get_sector_range(fcb, loc->fe_sector);
72-
73-
return loc->fe_range;
74-
}
75-
7655
int
7756
fcb2_getnext_nolock(struct fcb2 *fcb, struct fcb2_entry *loc)
7857
{
@@ -92,7 +71,7 @@ fcb2_getnext_nolock(struct fcb2 *fcb, struct fcb2_entry *loc)
9271
loc->fe_entry_num = 1;
9372
rc = fcb2_elem_info(loc);
9473
} else {
95-
rc = fcb2_getnext_in_area(fcb, NULL, loc);
74+
rc = fcb2_getnext_in_area(fcb, loc);
9675
}
9776
switch (rc) {
9877
case 0:
@@ -103,7 +82,7 @@ fcb2_getnext_nolock(struct fcb2 *fcb, struct fcb2_entry *loc)
10382
goto next_sector;
10483
}
10584
while (rc == FCB2_ERR_CRC) {
106-
rc = fcb2_getnext_in_area(fcb, NULL, loc);
85+
rc = fcb2_getnext_in_area(fcb, loc);
10786
if (rc == 0) {
10887
return 0;
10988
}

fs/fcb2/src/fcb_priv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ fcb2_len_in_flash(const struct flash_sector_range *range, uint16_t len)
4949
return (len + (range->fsr_align - 1)) & ~(range->fsr_align - 1);
5050
}
5151

52+
int fcb2_getnext_in_area(struct fcb2 *fcb, struct fcb2_entry *loc);
53+
5254
static inline int
5355
fcb2_getnext_sector(struct fcb2 *fcb, int sector)
5456
{

sys/log/full/src/log_fcb2.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ log_fcb2_start_append(struct log *log, int len, struct fcb2_entry *loc)
173173
}
174174
#endif
175175

176-
#if MYNEWT_VAL(LOG_FCB_BOOKMARKS) && !MYNEWT_VAL(LOG_FCB_SECTOR_BOOKMARKS)
176+
#if MYNEWT_VAL(LOG_FCB_BOOKMARKS)
177177
/* The FCB needs to be rotated. */
178178
log_fcb_rotate_bmarks(fcb_log);
179179
#endif
@@ -183,18 +183,6 @@ log_fcb2_start_append(struct log *log, int len, struct fcb2_entry *loc)
183183
goto err;
184184
}
185185

186-
#if MYNEWT_VAL(LOG_FCB_SECTOR_BOOKMARKS)
187-
/* The FCB needs to be rotated, reinit previously allocated
188-
* bookmarks
189-
*/
190-
rc = log_fcb_init_bmarks(fcb_log, fcb_log->fl_bset.lfs_bmarks,
191-
fcb_log->fl_bset.lfs_cap,
192-
fcb_log->fl_bset.lfs_en_sect_bmarks);
193-
if (rc) {
194-
goto err;
195-
}
196-
#endif
197-
198186
#if MYNEWT_VAL(LOG_STORAGE_WATERMARK)
199187
/*
200188
* FCB was rotated successfully so let's check if watermark was within

sys/log/full/src/log_fcb_bmark.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,6 @@ log_fcb_closest_bmark(const struct fcb_log *fcb_log, uint32_t index,
249249
fcb_log->fl_bset.lfs_next_sect < (fcb_log->fl_bset.lfs_sect_cap - 1)) {
250250
start_idx = fcb_log->fl_bset.lfs_next_sect + 1;
251251
}
252-
#elif MYNEWT_VAL(LOG_FCB2)
253-
if (!fcb_log->fl_bset.lfs_bmarks[i].lfb_entry.fe_range &&
254-
fcb_log->fl_bset.lfs_next_sect < (fcb_log->fl_bset.lfs_sect_cap - 1)) {
255-
start_idx = fcb_log->fl_bset.lfs_next_sect + 1;
256-
}
257252
#endif
258253
#endif
259254

@@ -303,15 +298,9 @@ log_fcb_closest_bmark(const struct fcb_log *fcb_log, uint32_t index,
303298
}
304299

305300
#if MYNEWT_VAL(LOG_FCB_SECTOR_BOOKMARKS)
306-
#if MYNEWT_VAL(LOG_FCB)
307301
static int
308302
log_fcb_insert_sect_bmark(struct fcb_log *fcb_log, struct fcb_entry *entry,
309303
uint32_t index)
310-
#elif MYNEWT_VAL(LOG_FCB2)
311-
static int
312-
log_fcb_insert_sect_bmark(struct fcb_log *fcb_log, struct fcb2_entry *entry,
313-
uint32_t index)
314-
#endif
315304
{
316305
struct log_fcb_bset *bset;
317306

@@ -347,7 +336,7 @@ log_fcb_replace_non_sect_bmark(struct fcb_log *fcb_log, struct fcb2_entry *entry
347336
int i = 0;
348337
struct log_fcb_bset *bset = &fcb_log->fl_bset;
349338

350-
#if MYNEWT_VAL(LOG_FCB_SECTOR_BOOKMARKS)
339+
#if MYNEWT_VAL(LOG_FCB) && MYNEWT_VAL(LOG_FCB_SECTOR_BOOKMARKS)
351340
if (bset->lfs_en_sect_bmarks) {
352341
for (i = bset->lfs_sect_cap;
353342
i < (bset->lfs_non_sect_size + bset->lfs_sect_cap);
@@ -393,7 +382,7 @@ log_fcb_add_bmark(struct fcb_log *fcb_log, struct fcb2_entry *entry,
393382
return SYS_ENOMEM;
394383
}
395384

396-
#if MYNEWT_VAL(LOG_FCB_SECTOR_BOOKMARKS)
385+
#if MYNEWT_VAL(LOG_FCB) && MYNEWT_VAL(LOG_FCB_SECTOR_BOOKMARKS)
397386
if (sect_bmark & bset->lfs_en_sect_bmarks) {
398387
rc = log_fcb_insert_sect_bmark(fcb_log, entry, index);
399388
if (rc) {

sys/log/full/syscfg.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ syscfg.defs:
190190
value: 0
191191
restrictions:
192192
- LOG_FCB_BOOKMARKS
193+
- LOG_FCB
193194

194195
syscfg.vals.CONSOLE_TICKS:
195196
LOG_CONSOLE_PRETTY_WITH_TIMESTAMP: 0

0 commit comments

Comments
 (0)