corrected GC page isolation loop.
adjusted cfs_coffee_reserve signature to use cfs_offset_t instead of uint32_t. made cfs_coffee_format also to clear *next_free.
This commit is contained in:
parent
9c9165dc90
commit
bffbb06d4a
2 changed files with 9 additions and 5 deletions
|
@ -215,8 +215,8 @@ get_sector_status(uint16_t sector, struct sector_stats *stats) {
|
||||||
the following pages as isolated. */
|
the following pages as isolated. */
|
||||||
memset(&hdr, 0, sizeof(hdr));
|
memset(&hdr, 0, sizeof(hdr));
|
||||||
hdr.flags = HDR_FLAG_ALLOCATED | HDR_FLAG_ISOLATED;
|
hdr.flags = HDR_FLAG_ALLOCATED | HDR_FLAG_ISOLATED;
|
||||||
for(page = sector_start; page < skip_pages; page++) {
|
for(page = 0; page < skip_pages; page++) {
|
||||||
write_header(&hdr, page);
|
write_header(&hdr, sector_start + page);
|
||||||
}
|
}
|
||||||
PRINTF("Coffee: Isolated %u pages starting in sector %d\n",
|
PRINTF("Coffee: Isolated %u pages starting in sector %d\n",
|
||||||
(unsigned)skip_pages, (int)sector);
|
(unsigned)skip_pages, (int)sector);
|
||||||
|
@ -1168,7 +1168,7 @@ cfs_closedir(struct cfs_dir *dir)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
cfs_coffee_reserve(const char *name, uint32_t size)
|
cfs_coffee_reserve(const char *name, cfs_offset_t size)
|
||||||
{
|
{
|
||||||
return reserve(name, page_count(size), 0) == NULL ? -1 : 0;
|
return reserve(name, page_count(size), 0) == NULL ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
@ -1216,6 +1216,8 @@ cfs_coffee_format(void)
|
||||||
|
|
||||||
PRINTF("Coffee: Formatting %d sectors", nsectors);
|
PRINTF("Coffee: Formatting %d sectors", nsectors);
|
||||||
|
|
||||||
|
*next_free = 0;
|
||||||
|
|
||||||
watchdog_stop();
|
watchdog_stop();
|
||||||
for(i = 0; i < nsectors; i++) {
|
for(i = 0; i < nsectors; i++) {
|
||||||
COFFEE_ERASE(i);
|
COFFEE_ERASE(i);
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#ifndef CFS_COFFEE_H
|
#ifndef CFS_COFFEE_H
|
||||||
#define CFS_COFFEE_H
|
#define CFS_COFFEE_H
|
||||||
|
|
||||||
|
#include "cfs.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
* Header for the Coffee file system.
|
* Header for the Coffee file system.
|
||||||
|
@ -59,7 +61,7 @@
|
||||||
* has been done, files will be set to a default size once opened for
|
* has been done, files will be set to a default size once opened for
|
||||||
* the first time.
|
* the first time.
|
||||||
*/
|
*/
|
||||||
int cfs_coffee_reserve(const char *name, uint32_t size);
|
int cfs_coffee_reserve(const char *name, cfs_offset_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Configure the on-demand log file.
|
* \brief Configure the on-demand log file.
|
||||||
|
@ -73,7 +75,7 @@ int cfs_coffee_reserve(const char *name, uint32_t size);
|
||||||
* is of log_entry_size.
|
* is of log_entry_size.
|
||||||
*/
|
*/
|
||||||
int cfs_coffee_configure_log(const char *file, unsigned log_size,
|
int cfs_coffee_configure_log(const char *file, unsigned log_size,
|
||||||
unsigned log_entry_size);
|
unsigned log_entry_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Format the storage area assigned to Coffee.
|
* \brief Format the storage area assigned to Coffee.
|
||||||
|
|
Loading…
Reference in a new issue