summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelikan <pelikan@openbsd.org>2014-07-11 15:11:00 +0000
committerpelikan <pelikan@openbsd.org>2014-07-11 15:11:00 +0000
commit1217b0a4fe8a92442b914b439089743c1ed1a023 (patch)
tree5cf2d4bfa6c9e10a19e8adf0486101af2940a13a
parentmove IPv6 prefix adding from workq to taskq; as a happy benefit, we (diff)
downloadwireguard-openbsd-1217b0a4fe8a92442b914b439089743c1ed1a023.tar.xz
wireguard-openbsd-1217b0a4fe8a92442b914b439089743c1ed1a023.zip
split ext2fs_read for the upcoming ext4 extent bits, like FreeBSD has done
ok guenther
-rw-r--r--sys/ufs/ext2fs/ext2fs_readwrite.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c
index 118f9ce5961..e01a785ab8b 100644
--- a/sys/ufs/ext2fs/ext2fs_readwrite.c
+++ b/sys/ufs/ext2fs/ext2fs_readwrite.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_readwrite.c,v 1.30 2014/07/11 14:30:52 pelikan Exp $ */
+/* $OpenBSD: ext2fs_readwrite.c,v 1.31 2014/07/11 15:11:00 pelikan Exp $ */
/* $NetBSD: ext2fs_readwrite.c,v 1.16 2001/02/27 04:37:47 chs Exp $ */
/*-
@@ -54,6 +54,8 @@
#include <ufs/ext2fs/ext2fs_extern.h>
+static int ext2_ind_read(struct vnode *, struct inode *, struct m_ext2fs *, struct uio *);
+
#define doclusterread 0 /* XXX underway */
#define doclusterwrite 0
@@ -69,29 +71,37 @@ ext2fs_read(void *v)
struct inode *ip;
struct uio *uio;
struct m_ext2fs *fs;
+
+ vp = ap->a_vp;
+ ip = VTOI(vp);
+ uio = ap->a_uio;
+ fs = ip->i_e2fs;
+
+ return ext2_ind_read(vp, ip, fs, uio);
+}
+
+static int
+ext2_ind_read(struct vnode *vp, struct inode *ip, struct m_ext2fs *fs,
+ struct uio *uio)
+{
struct buf *bp;
daddr_t lbn, nextlbn;
off_t bytesinfile;
long size, xfersize, blkoffset;
int error;
- vp = ap->a_vp;
- ip = VTOI(vp);
- uio = ap->a_uio;
-
#ifdef DIAGNOSTIC
if (uio->uio_rw != UIO_READ)
panic("%s: mode", "ext2fs_read");
if (vp->v_type == VLNK) {
if ((int)ext2fs_size(ip) < vp->v_mount->mnt_maxsymlinklen ||
- (vp->v_mount->mnt_maxsymlinklen == 0 &&
- ip->i_e2fs_nblock == 0))
+ (vp->v_mount->mnt_maxsymlinklen == 0 &&
+ ip->i_e2fs_nblock == 0))
panic("%s: short symlink", "ext2fs_read");
} else if (vp->v_type != VREG && vp->v_type != VDIR)
panic("%s: type %d", "ext2fs_read", vp->v_type);
#endif
- fs = ip->i_e2fs;
if (e2fs_overflow(fs, 0, uio->uio_offset))
return (EFBIG);
if (uio->uio_resid == 0)