Removed watchdog calls from Coffee

This commit is contained in:
nvt-se 2011-01-18 14:06:33 +00:00
parent 00ac8cfaa0
commit 28421f1fe2
3 changed files with 0 additions and 40 deletions

View File

@ -53,18 +53,6 @@
#include "cfs-coffee-arch.h" #include "cfs-coffee-arch.h"
#include "cfs/cfs-coffee.h" #include "cfs/cfs-coffee.h"
/* Platforms that have watchdog timers enable should
define these macros in cfs-coffee-arch.h. */
#ifndef COFFEE_WATCHDOG_START
#define COFFEE_WATCHDOG_START()
#endif
#ifndef COFFEE_WATCHDOG_STOP
#define COFFEE_WATCHDOG_STOP()
#endif
#ifndef COFFEE_WATCHDOG_PERIODIC
#define COFFEE_WATCHDOG_PERIODIC()
#endif
#ifndef COFFEE_CONF_APPEND_ONLY #ifndef COFFEE_CONF_APPEND_ONLY
#define COFFEE_APPEND_ONLY 0 #define COFFEE_APPEND_ONLY 0
#else #else
@ -351,8 +339,6 @@ collect_garbage(int mode)
struct sector_status stats; struct sector_status stats;
coffee_page_t first_page, isolation_count; coffee_page_t first_page, isolation_count;
COFFEE_WATCHDOG_STOP();
PRINTF("Coffee: Running the file system garbage collector in %s mode\n", PRINTF("Coffee: Running the file system garbage collector in %s mode\n",
mode == GC_RELUCTANT ? "reluctant" : "greedy"); mode == GC_RELUCTANT ? "reluctant" : "greedy");
/* /*
@ -388,8 +374,6 @@ collect_garbage(int mode)
} }
} }
} }
COFFEE_WATCHDOG_START();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static coffee_page_t static coffee_page_t
@ -475,15 +459,12 @@ find_file(const char *name)
} }
/* Scan the flash memory sequentially otherwise. */ /* Scan the flash memory sequentially otherwise. */
COFFEE_WATCHDOG_STOP();
for(page = 0; page < COFFEE_PAGE_COUNT; page = next_file(page, &hdr)) { for(page = 0; page < COFFEE_PAGE_COUNT; page = next_file(page, &hdr)) {
read_header(&hdr, page); read_header(&hdr, page);
if(HDR_ACTIVE(hdr) && !HDR_LOG(hdr) && strcmp(name, hdr.name) == 0) { if(HDR_ACTIVE(hdr) && !HDR_LOG(hdr) && strcmp(name, hdr.name) == 0) {
COFFEE_WATCHDOG_START();
return load_file(page, &hdr); return load_file(page, &hdr);
} }
} }
COFFEE_WATCHDOG_START();
return NULL; return NULL;
} }
@ -507,7 +488,6 @@ file_end(coffee_page_t start)
*/ */
for(page = hdr.max_pages - 1; page >= 0; page--) { for(page = hdr.max_pages - 1; page >= 0; page--) {
COFFEE_WATCHDOG_PERIODIC();
COFFEE_READ(buf, sizeof(buf), (start + page) * COFFEE_PAGE_SIZE); COFFEE_READ(buf, sizeof(buf), (start + page) * COFFEE_PAGE_SIZE);
for(i = COFFEE_PAGE_SIZE - 1; i >= 0; i--) { for(i = COFFEE_PAGE_SIZE - 1; i >= 0; i--) {
if(buf[i] != 0) { if(buf[i] != 0) {
@ -619,10 +599,7 @@ reserve(const char *name, coffee_page_t pages,
coffee_page_t page; coffee_page_t page;
struct file *file; struct file *file;
COFFEE_WATCHDOG_STOP();
if(!allow_duplicates && find_file(name) != NULL) { if(!allow_duplicates && find_file(name) != NULL) {
COFFEE_WATCHDOG_START();
return NULL; return NULL;
} }
@ -634,7 +611,6 @@ reserve(const char *name, coffee_page_t pages,
collect_garbage(GC_GREEDY); collect_garbage(GC_GREEDY);
page = find_contiguous_pages(pages); page = find_contiguous_pages(pages);
if(page == INVALID_PAGE) { if(page == INVALID_PAGE) {
COFFEE_WATCHDOG_START();
*gc_wait = 1; *gc_wait = 1;
return NULL; return NULL;
} }
@ -653,7 +629,6 @@ reserve(const char *name, coffee_page_t pages,
if(file != NULL) { if(file != NULL) {
file->end = 0; file->end = 0;
} }
COFFEE_WATCHDOG_START();
return file; return file;
} }
@ -818,21 +793,18 @@ merge_log(coffee_page_t file_page, int extend)
} }
offset = 0; offset = 0;
COFFEE_WATCHDOG_STOP();
do { do {
char buf[hdr.log_record_size == 0 ? COFFEE_PAGE_SIZE : hdr.log_record_size]; char buf[hdr.log_record_size == 0 ? COFFEE_PAGE_SIZE : hdr.log_record_size];
n = cfs_read(fd, buf, sizeof(buf)); n = cfs_read(fd, buf, sizeof(buf));
if(n < 0) { if(n < 0) {
remove_by_page(new_file->page, !REMOVE_LOG, !CLOSE_FDS, ALLOW_GC); remove_by_page(new_file->page, !REMOVE_LOG, !CLOSE_FDS, ALLOW_GC);
cfs_close(fd); cfs_close(fd);
COFFEE_WATCHDOG_START();
return -1; return -1;
} else if(n > 0) { } else if(n > 0) {
COFFEE_WRITE(buf, n, absolute_offset(new_file->page, offset)); COFFEE_WRITE(buf, n, absolute_offset(new_file->page, offset));
offset += n; offset += n;
} }
} while(n != 0); } while(n != 0);
COFFEE_WATCHDOG_START();
for(i = 0; i < COFFEE_FD_SET_SIZE; i++) { for(i = 0; i < COFFEE_FD_SET_SIZE; i++) {
if(coffee_fd_set[i].flags != COFFEE_FD_FREE && if(coffee_fd_set[i].flags != COFFEE_FD_FREE &&
@ -1122,7 +1094,6 @@ cfs_read(int fd, void *buf, unsigned size)
* ordinary file if the page has no log record. * ordinary file if the page has no log record.
*/ */
for(bytes_left = size; bytes_left > 0; bytes_left -= r) { for(bytes_left = size; bytes_left > 0; bytes_left -= r) {
COFFEE_WATCHDOG_PERIODIC();
r = -1; r = -1;
lp.offset = fdp->offset; lp.offset = fdp->offset;
@ -1246,7 +1217,6 @@ cfs_readdir(struct cfs_dir *dir, struct cfs_dirent *record)
memcpy(&page, dir->dummy_space, sizeof(coffee_page_t)); memcpy(&page, dir->dummy_space, sizeof(coffee_page_t));
while(page < COFFEE_PAGE_COUNT) { while(page < COFFEE_PAGE_COUNT) {
COFFEE_WATCHDOG_PERIODIC();
read_header(&hdr, page); read_header(&hdr, page);
if(HDR_ACTIVE(hdr) && !HDR_LOG(hdr)) { if(HDR_ACTIVE(hdr) && !HDR_LOG(hdr)) {
coffee_page_t next_page; coffee_page_t next_page;
@ -1315,12 +1285,10 @@ cfs_coffee_format(void)
*next_free = 0; *next_free = 0;
COFFEE_WATCHDOG_STOP();
for(i = 0; i < COFFEE_SECTOR_COUNT; i++) { for(i = 0; i < COFFEE_SECTOR_COUNT; i++) {
COFFEE_ERASE(i); COFFEE_ERASE(i);
PRINTF("."); PRINTF(".");
} }
COFFEE_WATCHDOG_START();
/* Formatting invalidates the file information. */ /* Formatting invalidates the file information. */
memset(&protected_mem, 0, sizeof(protected_mem)); memset(&protected_mem, 0, sizeof(protected_mem));

View File

@ -70,10 +70,6 @@
#define COFFEE_ERASE(sector) cfs_coffee_arch_erase(sector) #define COFFEE_ERASE(sector) cfs_coffee_arch_erase(sector)
#define COFFEE_WATCHDOG_START() watchdog_start()
#define COFFEE_WATCHDOG_STOP() watchdog_stop()
#define COFFEE_WATCHDOG_PERIODIC() watchdog_periodic()
void cfs_coffee_arch_erase(uint16_t sector); void cfs_coffee_arch_erase(uint16_t sector);
typedef int16_t coffee_page_t; typedef int16_t coffee_page_t;

View File

@ -58,10 +58,6 @@
#define COFFEE_MICRO_LOGS 1 #define COFFEE_MICRO_LOGS 1
#define COFFEE_WATCHDOG_START() watchdog_start()
#define COFFEE_WATCHDOG_STOP() watchdog_stop()
#define COFFEE_WATCHDOG_PERIODIC() watchdog_periodic()
/* Flash operations. */ /* Flash operations. */
#define COFFEE_WRITE(buf, size, offset) \ #define COFFEE_WRITE(buf, size, offset) \
xmem_pwrite((char *)(buf), (size), COFFEE_START + (offset)) xmem_pwrite((char *)(buf), (size), COFFEE_START + (offset))