From cf5da75e3f07d6eff61f8e30eb14d15a3dbef17d Mon Sep 17 00:00:00 2001 From: batt Date: Sun, 10 Feb 2008 14:32:54 +0000 Subject: [PATCH] Fix move page bug; add battfs_close. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1100 38d2e660-2303-0410-9eaa-f027e97ec537 --- fs/battfs.c | 11 +++++++++-- fs/battfs.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/battfs.c b/fs/battfs.c index 21d44d8d..97bc897d 100644 --- a/fs/battfs.c +++ b/fs/battfs.c @@ -212,7 +212,7 @@ static pgcnt_t countPages(pgoff_t *filelen_table, inode_t inode) static void movePages(struct BattFsSuper *disk, pgcnt_t src, int offset) { pgcnt_t dst = src + offset; - memmove(&disk->page_array[dst], &disk->page_array[src], disk->page_count - MAX(dst, src) * sizeof(pgcnt_t)); + memmove(&disk->page_array[dst], &disk->page_array[src], (disk->page_count - MAX(dst, src)) * sizeof(pgcnt_t)); if (offset < 0) { @@ -588,11 +588,18 @@ bool battfs_init(struct BattFsSuper *disk) return true; } +/** + * Close \a disk. + */ +bool battfs_close(struct BattFsSuper *disk) +{ + return disk->close(disk); +} + bool battfs_writeTestBlock(struct BattFsSuper *disk, pgcnt_t page, inode_t inode, seq_t seq, fill_t fill, pgoff_t pgoff, mark_t mark) { BattFsPageHeader hdr; - TRACEMSG("page %d, inode %d, pgoff %d\n", page, inode, pgoff); hdr.inode = inode; hdr.seq = seq; diff --git a/fs/battfs.h b/fs/battfs.h index c155b61e..f7518ced 100644 --- a/fs/battfs.h +++ b/fs/battfs.h @@ -215,6 +215,8 @@ typedef struct BattFsSuper } BattFsSuper; bool battfs_init(struct BattFsSuper *d); +bool battfs_close(struct BattFsSuper *disk); + bool battfs_writeTestBlock(struct BattFsSuper *disk, pgcnt_t page, inode_t inode, seq_t seq, fill_t fill, pgoff_t pgoff, mark_t mark); #endif /* FS_BATTFS_H */ -- 2.25.1