X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fmain-block.c;h=dab3c8e68883a5d698e2dcb19782abd3a1a1c6e4;hb=623185a65b8870abb82cd0dd8547a1aa4fc1f535;hp=98c558e6acc671f6270d8339eaa45722e69f2105;hpb=035b3e0b5db8be1444c6bc1cfc929d03c0fb5196;p=libucw.git diff --git a/ucw/main-block.c b/ucw/main-block.c index 98c558e6..dab3c8e6 100644 --- a/ucw/main-block.c +++ b/ucw/main-block.c @@ -56,7 +56,7 @@ block_io_read_handler(struct main_file *fi) { if (errno != EINTR && errno != EAGAIN && bio->error_handler) bio->error_handler(bio, BIO_ERR_READ); - return 0; + return HOOK_IDLE; } else if (!l) break; @@ -66,7 +66,7 @@ block_io_read_handler(struct main_file *fi) fi->read_handler = NULL; file_chg(fi); bio->read_done(bio); - return 1; + return HOOK_RETRY; } static int @@ -82,7 +82,7 @@ block_io_write_handler(struct main_file *fi) { if (errno != EINTR && errno != EAGAIN && bio->error_handler) bio->error_handler(bio, BIO_ERR_WRITE); - return 0; + return HOOK_IDLE; } bio->wpos += l; } @@ -90,7 +90,7 @@ block_io_write_handler(struct main_file *fi) fi->write_handler = NULL; file_chg(fi); bio->write_done(bio); - return 1; + return HOOK_RETRY; } void @@ -132,3 +132,12 @@ block_io_write(struct main_block_io *bio, void *buf, uns len) } file_chg(&bio->file); } + +void +block_io_set_timeout(struct main_block_io *bio, timestamp_t expires_delta) +{ + if (!expires_delta) + timer_del(&bio->timer); + else + timer_add_rel(&bio->timer, expires_delta); +}