@@ -93,6 +93,7 @@ struct sparsebundle_t {
9393 struct {
9494 bool allow_other = false ;
9595 bool allow_root = false ;
96+ bool noreadbuf = false ;
9697 } options;
9798};
9899
@@ -495,13 +496,15 @@ static int sparsebundle_show_usage(char *program_name)
495496
496497enum {
497498 SPARSEBUNDLE_OPT_HANDLED = 0 , SPARSEBUNDLE_OPT_IGNORED = 1 ,
498- SPARSEBUNDLE_OPT_DEBUG, SPARSEBUNDLE_OPT_ALLOW_OTHER, SPARSEBUNDLE_OPT_ALLOW_ROOT
499+ SPARSEBUNDLE_OPT_DEBUG, SPARSEBUNDLE_OPT_ALLOW_OTHER, SPARSEBUNDLE_OPT_ALLOW_ROOT,
500+ SPARSEBUNDLE_OPT_NOREADBUF
499501};
500502
501503struct fuse_opt sparsebundle_options[] = {
502504 FUSE_OPT_KEY (" -D" , SPARSEBUNDLE_OPT_DEBUG),
503505 FUSE_OPT_KEY (" allow_other" , SPARSEBUNDLE_OPT_ALLOW_OTHER),
504506 FUSE_OPT_KEY (" allow_root" , SPARSEBUNDLE_OPT_ALLOW_ROOT),
507+ FUSE_OPT_KEY (" noreadbuf" , SPARSEBUNDLE_OPT_NOREADBUF),
505508 FUSE_OPT_END
506509};
507510
@@ -522,6 +525,10 @@ static int sparsebundle_opt_proc(void *data, const char *arg, int key, struct fu
522525 sparsebundle->options .allow_root = true ;
523526 return SPARSEBUNDLE_OPT_IGNORED;
524527
528+ case SPARSEBUNDLE_OPT_NOREADBUF:
529+ sparsebundle->options .noreadbuf = true ;
530+ return SPARSEBUNDLE_OPT_HANDLED;
531+
525532 case FUSE_OPT_KEY_NONOPT:
526533 if (!sparsebundle->path ) {
527534 sparsebundle->path = realpath (arg, 0 );
@@ -612,7 +619,11 @@ int main(int argc, char **argv)
612619 sparsebundle_filesystem_operations.readdir = sparsebundle_readdir;
613620 sparsebundle_filesystem_operations.release = sparsebundle_release;
614621#if FUSE_SUPPORTS_ZERO_COPY
615- sparsebundle_filesystem_operations.read_buf = sparsebundle_read_buf;
622+ syslog (LOG_DEBUG, " fuse supports zero-copy" );
623+ if (sparsebundle.options .noreadbuf )
624+ syslog (LOG_DEBUG, " disabling zero-copy" );
625+ else
626+ sparsebundle_filesystem_operations.read_buf = sparsebundle_read_buf;
616627#endif
617628
618629 int ret = fuse_main (args.argc , args.argv , &sparsebundle_filesystem_operations, &sparsebundle);
0 commit comments