libblock: limit the number of retries if we fail to write a block to disk.
commit3d353861de6cebab6ab932a2b33b6625786f8aa4
authorMaurizio Lombardi <m.lombardi85@gmail.com>
Mon, 28 Jul 2014 20:10:01 +0000 (28 22:10 +0200)
committerMaurizio Lombardi <m.lombardi85@gmail.com>
Mon, 28 Jul 2014 20:10:01 +0000 (28 22:10 +0200)
tree512825715e52d7ef5d500868b8c61c14c26b8045
parent7eb6c96392769a3bab70af54ff262130f072c967
libblock: limit the number of retries if we fail to write a block to disk.

The original behaviour is to continously retry to write a block until the
operation succeeds, this will cause the system to enter an infinite loop
if the underlying device is unable to satisfy the request.

This patch introduces an upper limit to the number of retries and discards
the block if the limit is reached.
It also fixes a bug in the block_get() function that allows the user to
try to read a block beyond the end of the device.
uspace/lib/block/block.c
uspace/lib/block/block.h