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:
nvt-se 2009-03-20 15:15:43 +00:00
parent 9c9165dc90
commit bffbb06d4a
2 changed files with 9 additions and 5 deletions

View File

@ -215,8 +215,8 @@ get_sector_status(uint16_t sector, struct sector_stats *stats) {
the following pages as isolated. */
memset(&hdr, 0, sizeof(hdr));
hdr.flags = HDR_FLAG_ALLOCATED | HDR_FLAG_ISOLATED;
for(page = sector_start; page < skip_pages; page++) {
write_header(&hdr, page);
for(page = 0; page < skip_pages; page++) {
write_header(&hdr, sector_start + page);
}
PRINTF("Coffee: Isolated %u pages starting in sector %d\n",
(unsigned)skip_pages, (int)sector);
@ -1168,7 +1168,7 @@ cfs_closedir(struct cfs_dir *dir)
}
/*---------------------------------------------------------------------------*/
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;
}
@ -1216,6 +1216,8 @@ cfs_coffee_format(void)
PRINTF("Coffee: Formatting %d sectors", nsectors);
*next_free = 0;
watchdog_stop();
for(i = 0; i < nsectors; i++) {
COFFEE_ERASE(i);

View File

@ -38,6 +38,8 @@
#ifndef CFS_COFFEE_H
#define CFS_COFFEE_H
#include "cfs.h"
/**
* \file
* Header for the Coffee file system.
@ -59,7 +61,7 @@
* has been done, files will be set to a default size once opened for
* 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.