diff --git a/ChangeLog b/ChangeLog index 377f2b110a..2bda7e474b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10881,4 +10881,6 @@ device (2015-08-24). * networking: Correct return value from psock_tcp_accept(). From SaeHie Park (2015-08-25). + * drivers/rwbuffer.c: Fix some logic errors. From Dmitry Nikolaev + via Juha Niskanen (2015-08-26). diff --git a/Documentation b/Documentation index ce750c0899..8a30728ae9 160000 --- a/Documentation +++ b/Documentation @@ -1 +1 @@ -Subproject commit ce750c0899c2138b37b52a48d020a3eceb92fd04 +Subproject commit 8a30728ae9a64496f0c9a0ff5dd62bd3b022c145 diff --git a/configs b/configs index e3f37812a9..e1e1873700 160000 --- a/configs +++ b/configs @@ -1 +1 @@ -Subproject commit e3f37812a9a7595a7ddab1a625ebe857d104beb2 +Subproject commit e1e1873700ffda7aeb632e2b1234333d88ce3457 diff --git a/drivers/rwbuffer.c b/drivers/rwbuffer.c index fd2f73c77a..9c443df7b5 100644 --- a/drivers/rwbuffer.c +++ b/drivers/rwbuffer.c @@ -96,7 +96,7 @@ static void rwb_semtake(sem_t *sem) while (sem_wait(sem) != 0) { - /* The only case that an error should occr here is if + /* The only case that an error should occur here is if * the wait was awakened by a signal. */ @@ -117,8 +117,8 @@ static void rwb_semtake(sem_t *sem) static inline bool rwb_overlap(off_t blockstart1, size_t nblocks1, off_t blockstart2, size_t nblocks2) { - off_t blockend1 = blockstart1 + nblocks1; - off_t blockend2 = blockstart2 + nblocks2; + off_t blockend1 = blockstart1 + nblocks1 - 1; + off_t blockend2 = blockstart2 + nblocks2 - 1; /* If the buffer 1 is wholly outside of buffer 2, return false */ @@ -257,7 +257,7 @@ static ssize_t rwb_writebuffer(FAR struct rwbuffer_s *rwb, /* Flush the write buffer */ - ret = rwb->wrflush(rwb, rwb->wrbuffer, rwb->wrblockstart, rwb->wrnblocks); + ret = rwb->wrflush(rwb->dev, rwb->wrbuffer, rwb->wrblockstart, rwb->wrnblocks); if (ret < 0) { fdbg("ERROR: Error writing multiple from cache: %d\n", -ret); @@ -842,7 +842,7 @@ int rwb_read(FAR struct rwbuffer_s *rwb, off_t startblock, uint32_t nblocks, * the user buffer. */ - ret = rwb->rhreload(rwb->dev, startblock, nblocks, rdbuffer); + ret = rwb->rhreload(rwb->dev, rdbuffer, startblock, nblocks); } #endif