From b1dd38f4083352b6c8dc4a2945470f1e72abaeca Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 16 Aug 2013 14:22:20 +0000 Subject: Restore the previous sendfile(2) behaviour on the block devices. Provide valid .fo_sendfile method for several missed struct fileops. Reviewed by: glebius Sponsored by: The FreeBSD Foundation --- sys/dev/streams/streams.c | 1 + sys/fs/devfs/devfs_vnops.c | 1 + sys/kern/sys_procdesc.c | 1 + sys/kern/vfs_vnops.c | 1 - sys/sys/file.h | 2 ++ 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index ad2817f5ca669..3ddbcc7563a80 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -98,6 +98,7 @@ static struct fileops svr4_netops = { .fo_close = svr4_soo_close, .fo_chmod = invfo_chmod, .fo_chown = invfo_chown, + .fo_sendfile = invfo_sendfile, }; static struct cdevsw streams_cdevsw = { diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 7da9b11af2a4f..468e76bbbb84f 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -1696,6 +1696,7 @@ static struct fileops devfs_ops_f = { .fo_close = devfs_close_f, .fo_chmod = vn_chmod, .fo_chown = vn_chown, + .fo_sendfile = vn_sendfile, .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE }; diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index f40004182f539..bacaf182e1c2e 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -113,6 +113,7 @@ static struct fileops procdesc_ops = { .fo_close = procdesc_close, .fo_chmod = procdesc_chmod, .fo_chown = procdesc_chown, + .fo_sendfile = invfo_sendfile, .fo_flags = DFLAG_PASSABLE, }; diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 2fcbf978a34d8..59b8995ce6661 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -88,7 +88,6 @@ static fo_poll_t vn_poll; static fo_kqfilter_t vn_kqfilter; static fo_stat_t vn_statfile; static fo_close_t vn_closefile; -extern fo_sendfile_t vn_sendfile; struct fileops vnops = { .fo_read = vn_io_fault, diff --git a/sys/sys/file.h b/sys/sys/file.h index 63a7e8f4ec94f..cc4e900df7731 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -241,6 +241,8 @@ fo_chmod_t invfo_chmod; fo_chown_t invfo_chown; fo_sendfile_t invfo_sendfile; +fo_sendfile_t vn_sendfile; + void finit(struct file *, u_int, short, void *, struct fileops *); int fgetvp(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp); int fgetvp_exec(struct thread *td, int fd, cap_rights_t rights, -- cgit v1.2.3