From: asterix Date: Thu, 5 Aug 2010 08:37:43 +0000 (+0000) Subject: Fix typo in kblock posix. Comply battfs test to new kblock posix. X-Git-Tag: 2.6.0~245 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=6319f9311847a277c84495e49019d9f8b7db8aca;p=bertos.git Fix typo in kblock posix. Comply battfs test to new kblock posix. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4145 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/fs/battfs_test.c b/bertos/fs/battfs_test.c index bb4f6cc2..559bb194 100644 --- a/bertos/fs/battfs_test.c +++ b/bertos/fs/battfs_test.c @@ -35,7 +35,7 @@ */ #include -#include +#include #include #include @@ -105,8 +105,8 @@ static void diskNew(BattFsSuper *disk) for (int i = 0; i < PAGE_COUNT; i++) ref[i] = i; - KBlockFile f; - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + KBlockPosix f; + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); battfs_mount(disk, &f.b, page_array, sizeof(page_array)); testCheck(disk, ref); @@ -122,8 +122,8 @@ static void disk1File(BattFsSuper *disk) for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); for (int i = 0; i < PAGE_COUNT; i++) { @@ -148,8 +148,8 @@ static void diskHalfFile(BattFsSuper *disk) for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); for (int i = 0; i < PAGE_COUNT / 2; i++) { @@ -180,8 +180,8 @@ static void oldSeq1(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 4; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); // page, inode, seq, fill, pgoff battfs_writeTestBlock(&f.b, 0, 0, 0, DATA_SIZE, 0); @@ -208,8 +208,8 @@ static void oldSeq2(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 4; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); // page, inode, seq, fill, pgoff battfs_writeTestBlock(&f.b, 0, 0, 0, DATA_SIZE, 0); @@ -236,8 +236,8 @@ static void oldSeq3(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 4; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); // page, inode, seq, fill, pgoff battfs_eraseBlock(&f.b, 0); @@ -264,8 +264,8 @@ static void oldSeq2File(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); // page, inode, seq, fill, pgoff battfs_eraseBlock(&f.b, 0); @@ -301,8 +301,8 @@ static void openFile(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; @@ -375,8 +375,8 @@ static void readFile(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; @@ -418,8 +418,8 @@ static void readAcross(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); const unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; inode_t INODE = 0; @@ -484,8 +484,8 @@ static void writeFile(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; @@ -535,8 +535,8 @@ static void writeAcross(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); const unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; inode_t INODE = 0; @@ -608,8 +608,8 @@ static void createFile(BattFsSuper *disk) FILE *fpt = fopen(test_filename, "w+"); for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fpt); - KBlockFile f; - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + KBlockPosix f; + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); BattFs fd1; inode_t INODE = 0; @@ -629,7 +629,7 @@ static void createFile(BattFsSuper *disk) ASSERT(battfs_umount(disk)); fpt = fopen(test_filename, "r+"); - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); ASSERT(battfs_mount(disk, &f.b, page_array, sizeof(page_array))); ASSERT(battfs_fsck(disk)); @@ -661,8 +661,8 @@ static void multipleWrite(BattFsSuper *disk) FILE *fpt = fopen(test_filename, "w+"); for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fpt); - KBlockFile f; - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + KBlockPosix f; + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); BattFs fd1; @@ -698,7 +698,7 @@ static void multipleWrite(BattFsSuper *disk) ASSERT(battfs_umount(disk)); fpt = fopen(test_filename, "r+"); - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); ASSERT(battfs_mount(disk, &f.b, page_array, sizeof(page_array))); ASSERT(battfs_fsck(disk)); @@ -726,8 +726,8 @@ static void increaseFile(BattFsSuper *disk) for (int i = 0; i < FILE_SIZE / 10; i++) fputc(0xff, fpt); - KBlockFile f; - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT / 10); + KBlockPosix f; + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT / 10); BattFs fd1,fd2; @@ -778,8 +778,8 @@ static void readEOF(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; @@ -818,8 +818,8 @@ static void writeEOF(BattFsSuper *disk) FILE *fpt = fopen(test_filename, "w+"); for (int i = 0; i < FILE_SIZE / 5; i++) fputc(0xff, fpt); - KBlockFile f; - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT / 5); + KBlockPosix f; + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT / 5); BattFs fd1; inode_t INODE = 0; @@ -902,8 +902,8 @@ static void endOfSpace(BattFsSuper *disk) FILE *fp = fopen(test_filename, "w+"); for (int i = 0; i < PAGE_SIZE * 4; i++) fputc(0xff, fp); - KBlockFile f; - kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); + KBlockPosix f; + kblockposix_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; inode_t INODE = 0; @@ -938,8 +938,8 @@ static void multipleFilesRW(BattFsSuper *disk) FILE *fpt = fopen(test_filename, "w+"); for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fpt); - KBlockFile f; - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + KBlockPosix f; + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); #define N_FILES 10 BattFs fd[N_FILES]; @@ -985,7 +985,7 @@ static void multipleFilesRW(BattFsSuper *disk) ASSERT(battfs_umount(disk)); fpt = fopen(test_filename, "r+"); - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); ASSERT(battfs_mount(disk, &f.b, page_array, sizeof(page_array))); ASSERT(battfs_fsck(disk)); @@ -1024,8 +1024,8 @@ static void openAllFiles(BattFsSuper *disk) FILE *fpt = fopen(test_filename, "w+"); for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fpt); - KBlockFile f; - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + KBlockPosix f; + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); BattFs fd[BATTFS_MAX_FILES]; unsigned int MODE = BATTFS_CREATE; @@ -1048,7 +1048,7 @@ static void openAllFiles(BattFsSuper *disk) fpt = fopen(test_filename, "r+"); - kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockposix_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); ASSERT(battfs_mount(disk, &f.b, page_array, sizeof(page_array))); ASSERT(battfs_fsck(disk)); diff --git a/bertos/io/kblock_posix.c b/bertos/io/kblock_posix.c index 57c2ee8c..b1186ff2 100644 --- a/bertos/io/kblock_posix.c +++ b/bertos/io/kblock_posix.c @@ -53,7 +53,7 @@ static int kblockposix_load(KBlock *b, block_idx_t index) static int kblockposix_store(struct KBlock *b, block_idx_t index) { - KBlockPosix *f = kblockposix_CAST(b); + KBlockPosix *f = KBLOCKPOSIX_CAST(b); fseek(f->fp, index * b->blk_size, SEEK_SET); return (fwrite(f->b.priv.buf, 1, b->blk_size, f->fp) == b->blk_size) ? 0 : EOF; }