aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/file.h
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2013-12-01 03:53:21 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2013-12-01 03:53:21 +0000
commit79750e3b364e1356fb070572186cd57fc556f99f (patch)
treee3a2f725c4c9350bd7a0727c06a7497a8c4c68e3 /sys/sys/file.h
parent4be4358fd16443974a3de1355d15a84642c4f8ba (diff)
downloadsrc-79750e3b364e1356fb070572186cd57fc556f99f.tar.gz
src-79750e3b364e1356fb070572186cd57fc556f99f.zip
Migrate the sendfile_sync structure into a public(ish) API in preparation
for extending and reusing it. The sendfile_sync wrapper is mostly just a "mbuf transaction" wrapper, used to indicate that the backing store for a group of mbufs has completed. It's only being used by sendfile for now and it's only implementing a sleep/wakeup rendezvous. However, there are other potential signaling paths (kqueue) and other potential uses (socket zero-copy write) where the same mechanism would also be useful. So, with that in mind: * extract the sendfile_sync code out into sf_sync_*() methods * teach the sf_sync_alloc method about the current config flag - it will eventually know about kqueue. * move the sendfile_sync code out of do_sendfile() - the only thing it now knows about is the sfs pointer. The guts of the sync rendezvous (setup, rendezvous/wait, free) is now done in the syscall wrapper. * .. and teach the 32-bit compat sendfile call the same. This should be a no-op. It's primarily preparation work for teaching the sendfile_sync about kqueue notification. Tested: * Peter Holm's sendfile stress / regression scripts Sponsored by: Netflix, Inc.
Notes
Notes: svn path=/head/; revision=258788
Diffstat (limited to 'sys/sys/file.h')
-rw-r--r--sys/sys/file.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/sys/file.h b/sys/sys/file.h
index 7b373f0d7091..b7d358b7643c 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -88,6 +88,9 @@ foffset_get(struct file *fp)
return (foffset_lock(fp, FOF_NOLOCK));
}
+/* XXX pollution? */
+struct sendfile_sync;
+
typedef int fo_rdwr_t(struct file *fp, struct uio *uio,
struct ucred *active_cred, int flags,
struct thread *td);
@@ -107,7 +110,8 @@ typedef int fo_chown_t(struct file *fp, uid_t uid, gid_t gid,
struct ucred *active_cred, struct thread *td);
typedef int fo_sendfile_t(struct file *fp, int sockfd, struct uio *hdr_uio,
struct uio *trl_uio, off_t offset, size_t nbytes,
- off_t *sent, int flags, int kflags, struct thread *td);
+ off_t *sent, int flags, int kflags,
+ struct sendfile_sync *sfs, struct thread *td);
typedef int fo_seek_t(struct file *fp, off_t offset, int whence,
struct thread *td);
typedef int fo_flags_t;
@@ -368,11 +372,11 @@ fo_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,
static __inline int
fo_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags,
- int kflags, struct thread *td)
+ int kflags, struct sendfile_sync *sfs, struct thread *td)
{
return ((*fp->f_ops->fo_sendfile)(fp, sockfd, hdr_uio, trl_uio, offset,
- nbytes, sent, flags, kflags, td));
+ nbytes, sent, flags, kflags, sfs, td));
}
static __inline int