From: syl Date: Tue, 20 May 2014 13:32:22 +0000 (+0000) Subject: Add -o max_read=XXX support in fuse. This is needed by usmb to have a X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4a254543d5b0c3dbb473efeceb5b5fbf3eee160b;p=openbsd Add -o max_read=XXX support in fuse. This is needed by usmb to have a working read() and write(). ok tedu@ --- diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c index b726b88c81f..ef794b3095a 100644 --- a/lib/libfuse/fuse.c +++ b/lib/libfuse/fuse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse.c,v 1.23 2014/05/20 13:22:06 syl Exp $ */ +/* $OpenBSD: fuse.c,v 1.24 2014/05/20 13:32:22 syl Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * @@ -169,6 +169,7 @@ fuse_mount(const char *dir, unused struct fuse_args *args) } fargs.fd = fc->fd; + fargs.max_read = max_read; if (mount(MOUNT_FUSEFS, fc->dir, 0, &fargs)) { switch (errno) { case EMFILE: diff --git a/sys/miscfs/fuse/fuse_vfsops.c b/sys/miscfs/fuse/fuse_vfsops.c index 6b34645d20c..e3ab7e8d347 100644 --- a/sys/miscfs/fuse/fuse_vfsops.c +++ b/sys/miscfs/fuse/fuse_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vfsops.c,v 1.8 2013/12/10 13:43:05 pelikan Exp $ */ +/* $OpenBSD: fuse_vfsops.c,v 1.9 2014/05/20 13:32:22 syl Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -98,8 +98,12 @@ fusefs_mount(struct mount *mp, const char *path, void *data, fmp->mp = mp; fmp->sess_init = 0; fmp->dev = vp->v_rdev; - mp->mnt_data = fmp; + if (args.max_read > 0) + fmp->max_read = MIN(args.max_read, FUSEBUFMAXSIZE); + else + fmp->max_read = FUSEBUFMAXSIZE; + mp->mnt_data = fmp; mp->mnt_flag |= MNT_LOCAL; vfs_getnewfsid(mp); diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index 7b7f49baa9a..1b6612fe3bf 100644 --- a/sys/miscfs/fuse/fuse_vnops.c +++ b/sys/miscfs/fuse/fuse_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vnops.c,v 1.17 2014/05/19 13:55:29 syl Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.18 2014/05/20 13:32:22 syl Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -681,7 +681,7 @@ fusefs_readdir(void *v) } fbuf->fb_io_fd = ip->fufh[FUFH_RDONLY].fh_id; fbuf->fb_io_off = uio->uio_offset; - fbuf->fb_io_len = MIN(uio->uio_resid, FUSEBUFMAXSIZE); + fbuf->fb_io_len = MIN(uio->uio_resid, fmp->max_read); error = fb_queue(fmp->dev, fbuf); @@ -1014,7 +1014,7 @@ fusefs_read(void *v) while (uio->uio_resid > 0) { fbuf = fb_setup(0, ip->ufs_ino.i_number, FBT_READ, p); - size = MIN(uio->uio_resid, FUSEBUFMAXSIZE); + size = MIN(uio->uio_resid, fmp->max_read); fbuf->fb_io_fd = fusefs_fd_get(ip, FUFH_RDONLY); fbuf->fb_io_off = uio->uio_offset; fbuf->fb_io_len = size; @@ -1071,7 +1071,7 @@ fusefs_write(void *v) } while (uio->uio_resid > 0) { - len = MIN(uio->uio_resid, FUSEBUFMAXSIZE); + len = MIN(uio->uio_resid, fmp->max_read); fbuf = fb_setup(len, ip->ufs_ino.i_number, FBT_WRITE, p); fbuf->fb_io_fd = fusefs_fd_get(ip, FUFH_WRONLY); diff --git a/sys/miscfs/fuse/fusefs.h b/sys/miscfs/fuse/fusefs.h index 1d9c7fbac47..5b7027cbb00 100644 --- a/sys/miscfs/fuse/fusefs.h +++ b/sys/miscfs/fuse/fusefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fusefs.h,v 1.6 2014/01/16 09:31:44 syl Exp $ */ +/* $OpenBSD: fusefs.h,v 1.7 2014/05/20 13:32:22 syl Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -50,7 +50,7 @@ struct fuse_msg; struct fusefs_mnt { struct mount *mp; uint32_t undef_op; - uint32_t max_write; + int max_read; int sess_init; dev_t dev; }; diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 4cd3ecb308b..7bad79b2f4e 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.118 2014/03/24 00:19:48 guenther Exp $ */ +/* $OpenBSD: mount.h,v 1.119 2014/05/20 13:32:22 syl Exp $ */ /* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */ /* @@ -280,9 +280,8 @@ struct procfs_args { */ struct fusefs_args { char *name; - char *url; int fd; - int flags; + int max_read; }; /*