X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=fusefile.c;h=a0f09818da187d7958c75d6117ef5ed6bdebd06c;hb=5e65b7ecf2c54b600c5d98f06031ecf62e5a6cec;hp=a976660e29fb56a5c73297e27e24ab0e212db5a7;hpb=9c63c2c9b00d4e1faa0482f5cc2dc21a26ff2c03;p=rrq%2Ffusefile.git diff --git a/fusefile.c b/fusefile.c index a976660..a0f0981 100644 --- a/fusefile.c +++ b/fusefile.c @@ -217,7 +217,7 @@ static int fusefile_read(const char *path, char *buf, size_t size, #endif int i = find_source( off ); if ( i < 0 ) { - return ( off == sources.size )? 0 : -ENOENT; + return ( off == sources.size )? rr : -ENOENT; } if ( sources.array[i].fd < 0 ) { return -ENOENT; @@ -256,6 +256,25 @@ static int fusefile_read(const char *path, char *buf, size_t size, return rr; } +/** + * Poll for IO readiness. + */ +int fusefile_poll(const char *path, struct fuse_file_info *fi, + struct fuse_pollhandle *ph, unsigned *reventsp ) +{ +#if DEBUG + fprintf( stderr, "fusefile_poll( %s ) %p %d\n", path, ph, *reventsp ); +#endif + if( strcmp( path, "/" ) != 0 ) { + return -ENOENT; + } + if ( ph ) { + return fuse_notify_poll( ph ); + } + return 0; +} + + /** * Write a full block of data over the sources at the offset */ @@ -397,6 +416,7 @@ static struct fuse_operations fusefile_oper = { .chmod = fusefile_chmod, .open = fusefile_open, .read = fusefile_read, + .poll = fusefile_poll, .write = fusefile_write, .write_buf = fusefile_write_buf, .destroy = fusefile_destroy,