summaryrefslogtreecommitdiff
path: root/sys/ufs/ext2fs
diff options
context:
space:
mode:
authornatano <natano@cvs.openbsd.org>2016-02-27 18:50:39 +0000
committernatano <natano@cvs.openbsd.org>2016-02-27 18:50:39 +0000
commitdf586c8726847c9ce8c64145618e8ee188652913 (patch)
tree5453d31c673c4c3a563248238861420dd6dd6311 /sys/ufs/ext2fs
parentcaac7ff8319232d834371496689306fb450bbad7 (diff)
Move mnt_maxsymlink from struct mount to struct ufsmount.
The concept of differentiating between "short" and "long" symlinks is specific to ufs/, so it shouldn't creep into the generic fs layer. Inspired by a similar commit to NetBSD. While there replace all references to mnt_maxsymlinklen in ufs/ext2fs with EXT2_MAXSYMLINKLEN, which is the constant max short symlink len for ext2fs. This allows to get rid of some (mnt_maxsymlinklen == 0) checks there, which is always false for ext2fs. input and ok stefan@ ok millert@
Diffstat (limited to 'sys/ufs/ext2fs')
-rw-r--r--sys/ufs/ext2fs/ext2fs_inode.c7
-rw-r--r--sys/ufs/ext2fs/ext2fs_readwrite.c6
-rw-r--r--sys/ufs/ext2fs/ext2fs_vfsops.c4
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c7
4 files changed, 9 insertions, 15 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c
index 97349af5fcd..c3edcad6ad2 100644
--- a/sys/ufs/ext2fs/ext2fs_inode.c
+++ b/sys/ufs/ext2fs/ext2fs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_inode.c,v 1.56 2015/03/14 03:38:52 jsg Exp $ */
+/* $OpenBSD: ext2fs_inode.c,v 1.57 2016/02/27 18:50:38 natano Exp $ */
/* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */
/*
@@ -227,10 +227,7 @@ ext2fs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
ovp->v_type != VLNK)
return (0);
- if (ovp->v_type == VLNK &&
- (ext2fs_size(oip) < ovp->v_mount->mnt_maxsymlinklen ||
- (ovp->v_mount->mnt_maxsymlinklen == 0 &&
- oip->i_e2fs_nblock == 0))) {
+ if (ovp->v_type == VLNK && ext2fs_size(oip) < EXT2_MAXSYMLINKLEN) {
#ifdef DIAGNOSTIC
if (length != 0)
panic("ext2fs_truncate: partial truncate of symlink");
diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c
index f836bee528b..ef73a2a34cb 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.38 2016/02/26 08:56:10 natano Exp $ */
+/* $OpenBSD: ext2fs_readwrite.c,v 1.39 2016/02/27 18:50:38 natano Exp $ */
/* $NetBSD: ext2fs_readwrite.c,v 1.16 2001/02/27 04:37:47 chs Exp $ */
/*-
@@ -95,9 +95,7 @@ ext2_ind_read(struct vnode *vp, struct inode *ip, struct m_ext2fs *fs,
panic("%s: mode", "ext2fs_read");
if (vp->v_type == VLNK) {
- if (ext2fs_size(ip) < vp->v_mount->mnt_maxsymlinklen ||
- (vp->v_mount->mnt_maxsymlinklen == 0 &&
- ip->i_e2fs_nblock == 0))
+ if (ext2fs_size(ip) < EXT2_MAXSYMLINKLEN)
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);
diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c
index f1b81e51b74..4acfa333d58 100644
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vfsops.c,v 1.85 2015/03/14 03:38:52 jsg Exp $ */
+/* $OpenBSD: ext2fs_vfsops.c,v 1.86 2016/02/27 18:50:38 natano Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */
/*
@@ -583,7 +583,6 @@ ext2fs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
mp->mnt_data = (qaddr_t)ump;
mp->mnt_stat.f_fsid.val[0] = (long)dev;
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
- mp->mnt_maxsymlinklen = EXT2_MAXSYMLINKLEN;
mp->mnt_flag |= MNT_LOCAL;
ump->um_mountp = mp;
ump->um_dev = dev;
@@ -591,6 +590,7 @@ ext2fs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
ump->um_nindir = NINDIR(ump->um_e2fs);
ump->um_bptrtodb = ump->um_e2fs->e2fs_fsbtodb;
ump->um_seqinc = 1; /* no frags */
+ ump->um_maxsymlinklen = EXT2_MAXSYMLINKLEN;
devvp->v_specmountpoint = mp;
return (0);
out:
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index 1c39a2b61b8..7d1ad1e2784 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.75 2016/02/26 08:56:10 natano Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.76 2016/02/27 18:50:38 natano Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
@@ -1091,7 +1091,7 @@ ext2fs_symlink(void *v)
return (error);
vp = *vpp;
len = strlen(ap->a_target);
- if (len < vp->v_mount->mnt_maxsymlinklen) {
+ if (len < EXT2_MAXSYMLINKLEN) {
ip = VTOI(vp);
memcpy(ip->i_e2din->e2di_shortlink, ap->a_target, len);
error = ext2fs_setsize(ip, len);
@@ -1119,8 +1119,7 @@ ext2fs_readlink(void *v)
u_int64_t isize;
isize = ext2fs_size(ip);
- if (isize < vp->v_mount->mnt_maxsymlinklen ||
- (vp->v_mount->mnt_maxsymlinklen == 0 && ip->i_e2fs_nblock == 0)) {
+ if (isize < EXT2_MAXSYMLINKLEN) {
return (uiomove((char *)ip->i_e2din->e2di_shortlink, isize,
ap->a_uio));
}