From be167f67c180ba7de62fc50bcaeeb3920e05997c Mon Sep 17 00:00:00 2001 From: batt Date: Mon, 17 Dec 2007 20:02:23 +0000 Subject: [PATCH] Reformat; simplify seq num check. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1040 38d2e660-2303-0410-9eaa-f027e97ec537 --- fs/battfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/battfs.c b/fs/battfs.c index 1b8bf923..ab8075f5 100644 --- a/fs/battfs.c +++ b/fs/battfs.c @@ -174,7 +174,7 @@ static void movePages(struct BattFsSuper *disk, pgcnt_t src, int offset) /** * Insert \a page into page allocation array of \a disk, using \a filelen_table and - * \a free_number to compure position. + * \a free_number to compute position. */ static void insertFreePage(struct BattFsSuper *disk, pgoff_t *filelen_table, mark_t free_number, pgcnt_t page) { @@ -269,7 +269,7 @@ bool battfs_init(struct BattFsSuper *disk) /* Increase free space */ disk->free_bytes += disk->page_size - sizeof(BattFsPageHeader); - /* Check if putting mark to MARK_PAGE_VALID makes fcs correct */ + /* Check if setting mark to MARK_PAGE_VALID makes fcs correct */ mark_t old_mark = hdr.mark; hdr.mark = MARK_PAGE_VALID; rotating_init(&cks); @@ -340,7 +340,7 @@ bool battfs_init(struct BattFsSuper *disk) fill_t old_fill; /* Fancy check to handle seq wraparound */ - #define HALF_SEQ ((1 << (sizeof(seq_t) * CPU_BITS_PER_CHAR)) / 2) + #define HALF_SEQ (1 << ((sizeof(seq_t) * CPU_BITS_PER_CHAR) - 1)) if ((hdr.seq - hdr_old.seq) < HALF_SEQ) { /* Actual header is newer than the previuos one */ @@ -379,7 +379,7 @@ bool battfs_init(struct BattFsSuper *disk) } else { - /* Check if putting mark to MARK_PAGE_VALID makes fcs correct */ + /* Check if setting mark to MARK_PAGE_VALID makes fcs correct */ mark_t mark = hdr.mark; hdr.mark = MARK_PAGE_VALID; rotating_init(&cks); -- 2.25.1