Module Name: src
Committed By: christos
Date: Sat Aug 13 07:40:10 UTC 2016
Modified Files:
src/sys/ufs/ext2fs: ext2fs_alloc.c ext2fs_balloc.c ext2fs_bmap.c
ext2fs_extents.c ext2fs_hash.c ext2fs_htree.c ext2fs_inode.c
ext2fs_lookup.c ext2fs_readwrite.c ext2fs_rename.c ext2fs_subr.c
ext2fs_vfsops.c ext2fs_vnops.c ext2fs_xattr.c
Log Message:
KNF, no functional changes...
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/ufs/ext2fs/ext2fs_alloc.c
cvs rdiff -u -r1.40 -r1.41 src/sys/ufs/ext2fs/ext2fs_balloc.c
cvs rdiff -u -r1.27 -r1.28 src/sys/ufs/ext2fs/ext2fs_bmap.c
cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/ext2fs/ext2fs_extents.c
cvs rdiff -u -r1.1 -r1.2 src/sys/ufs/ext2fs/ext2fs_hash.c \
src/sys/ufs/ext2fs/ext2fs_xattr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/ext2fs/ext2fs_htree.c
cvs rdiff -u -r1.84 -r1.85 src/sys/ufs/ext2fs/ext2fs_inode.c
cvs rdiff -u -r1.83 -r1.84 src/sys/ufs/ext2fs/ext2fs_lookup.c
cvs rdiff -u -r1.74 -r1.75 src/sys/ufs/ext2fs/ext2fs_readwrite.c
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/ext2fs/ext2fs_rename.c
cvs rdiff -u -r1.32 -r1.33 src/sys/ufs/ext2fs/ext2fs_subr.c
cvs rdiff -u -r1.197 -r1.198 src/sys/ufs/ext2fs/ext2fs_vfsops.c
cvs rdiff -u -r1.121 -r1.122 src/sys/ufs/ext2fs/ext2fs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ufs/ext2fs/ext2fs_alloc.c
diff -u src/sys/ufs/ext2fs/ext2fs_alloc.c:1.47 src/sys/ufs/ext2fs/ext2fs_alloc.c:1.48
--- src/sys/ufs/ext2fs/ext2fs_alloc.c:1.47 Wed Aug 3 17:53:02 2016
+++ src/sys/ufs/ext2fs/ext2fs_alloc.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_alloc.c,v 1.47 2016/08/03 21:53:02 jdolecek Exp $ */
+/* $NetBSD: ext2fs_alloc.c,v 1.48 2016/08/13 07:40:10 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.47 2016/08/03 21:53:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.48 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -138,12 +138,12 @@ ext2fs_alloc(struct inode *ip, daddr_t l
ext2fs_setnblock(ip, ext2fs_nblock(ip) + btodb(fs->e2fs_bsize));
ip->i_flag |= IN_CHANGE | IN_UPDATE;
*bnp = bno;
- return (0);
+ return 0;
}
nospace:
ext2fs_fserr(fs, kauth_cred_geteuid(cred), "file system full");
uprintf("\n%s: write failed, file system is full\n", fs->e2fs_fsmnt);
- return (ENOSPC);
+ return ENOSPC;
}
/*
@@ -188,7 +188,7 @@ ext2fs_valloc(struct vnode *pvp, int mod
error = VFS_VGET(pvp->v_mount, ino, vpp);
if (error) {
ext2fs_vfree(pvp, ino, mode);
- return (error);
+ return error;
}
ip = VTOI(*vpp);
if (ip->i_e2fs_mode && ip->i_e2fs_nlink != 0) {
@@ -206,11 +206,11 @@ ext2fs_valloc(struct vnode *pvp, int mod
if (++ext2gennumber < time_second)
ext2gennumber = time_second;
ip->i_e2fs_gen = ext2gennumber;
- return (0);
+ return 0;
noinodes:
ext2fs_fserr(fs, kauth_cred_geteuid(cred), "out of inodes");
uprintf("\n%s: create/symlink failed, no inodes free\n", fs->e2fs_fsmnt);
- return (ENOSPC);
+ return ENOSPC;
}
/*
@@ -307,7 +307,7 @@ ext2fs_hashalloc(struct inode *ip, int c
*/
result = (*allocator)(ip, cg, pref, size);
if (result)
- return (result);
+ return result;
/*
* 2: quadratic rehash
*/
@@ -317,7 +317,7 @@ ext2fs_hashalloc(struct inode *ip, int c
cg -= fs->e2fs_ncg;
result = (*allocator)(ip, cg, 0, size);
if (result)
- return (result);
+ return result;
}
/*
* 3: brute force search
@@ -328,12 +328,12 @@ ext2fs_hashalloc(struct inode *ip, int c
for (i = 2; i < fs->e2fs_ncg; i++) {
result = (*allocator)(ip, cg, 0, size);
if (result)
- return (result);
+ return result;
cg++;
if (cg == fs->e2fs_ncg)
cg = 0;
}
- return (0);
+ return 0;
}
/*
@@ -354,12 +354,12 @@ ext2fs_alloccg(struct inode *ip, int cg,
fs = ip->i_e2fs;
if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0)
- return (0);
+ return 0;
error = bread(ip->i_devvp, EXT2_FSBTODB(fs,
fs->e2fs_gd[cg].ext2bgd_b_bitmap),
(int)fs->e2fs_bsize, B_MODIFY, &bp);
if (error) {
- return (0);
+ return 0;
}
bbp = (char *)bp->b_data;
@@ -401,7 +401,7 @@ ext2fs_alloccg(struct inode *ip, int cg,
bno = ext2fs_mapsearch(fs, bbp, bpref);
if (bno < 0)
- return (0);
+ return 0;
gotit:
#ifdef DIAGNOSTIC
if (isset(bbp, (daddr_t)bno)) {
@@ -415,7 +415,7 @@ gotit:
fs->e2fs_gd[cg].ext2bgd_nbfree--;
fs->e2fs_fmod = 1;
bdwrite(bp);
- return (cg * fs->e2fs.e2fs_fpg + fs->e2fs.e2fs_first_dblock + bno);
+ return cg * fs->e2fs.e2fs_fpg + fs->e2fs.e2fs_first_dblock + bno;
}
/*
@@ -440,12 +440,12 @@ ext2fs_nodealloccg(struct inode *ip, int
ipref = 0;
fs = ip->i_e2fs;
if (fs->e2fs_gd[cg].ext2bgd_nifree == 0)
- return (0);
+ return 0;
error = bread(ip->i_devvp, EXT2_FSBTODB(fs,
fs->e2fs_gd[cg].ext2bgd_i_bitmap),
(int)fs->e2fs_bsize, B_MODIFY, &bp);
if (error) {
- return (0);
+ return 0;
}
ibp = (char *)bp->b_data;
if (ipref) {
@@ -483,7 +483,7 @@ gotit:
fs->e2fs_gd[cg].ext2bgd_ndirs++;
}
bdwrite(bp);
- return (cg * fs->e2fs.e2fs_ipg + ipref +1);
+ return cg * fs->e2fs.e2fs_ipg + ipref + 1;
}
/*
@@ -555,7 +555,7 @@ ext2fs_vfree(struct vnode *pvp, ino_t in
EXT2_FSBTODB(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap),
(int)fs->e2fs_bsize, B_MODIFY, &bp);
if (error) {
- return (0);
+ return 0;
}
ibp = (char *)bp->b_data;
ino = (ino - 1) % fs->e2fs.e2fs_ipg;
@@ -574,7 +574,7 @@ ext2fs_vfree(struct vnode *pvp, ino_t in
}
fs->e2fs_fmod = 1;
bdwrite(bp);
- return (0);
+ return 0;
}
/*
Index: src/sys/ufs/ext2fs/ext2fs_balloc.c
diff -u src/sys/ufs/ext2fs/ext2fs_balloc.c:1.40 src/sys/ufs/ext2fs/ext2fs_balloc.c:1.41
--- src/sys/ufs/ext2fs/ext2fs_balloc.c:1.40 Sat Mar 28 15:24:04 2015
+++ src/sys/ufs/ext2fs/ext2fs_balloc.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_balloc.c,v 1.40 2015/03/28 19:24:04 maxv Exp $ */
+/* $NetBSD: ext2fs_balloc.c,v 1.41 2016/08/13 07:40:10 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.40 2015/03/28 19:24:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.41 2016/08/13 07:40:10 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_uvmhist.h"
@@ -106,13 +106,13 @@ ext2fs_balloc(struct inode *ip, daddr_t
int unwindidx = -1;
UVMHIST_FUNC("ext2fs_balloc"); UVMHIST_CALLED(ubchist);
- UVMHIST_LOG(ubchist, "bn 0x%x", bn,0,0,0);
+ UVMHIST_LOG(ubchist, "bn 0x%x", bn, 0, 0, 0);
if (bpp != NULL) {
*bpp = NULL;
}
if (bn < 0)
- return (EFBIG);
+ return EFBIG;
fs = ip->i_e2fs;
lbn = bn;
@@ -132,11 +132,11 @@ ext2fs_balloc(struct inode *ip, daddr_t
error = bread(vp, bn, fs->e2fs_bsize,
B_MODIFY, &bp);
if (error) {
- return (error);
+ return error;
}
*bpp = bp;
}
- return (0);
+ return 0;
}
/*
@@ -147,7 +147,7 @@ ext2fs_balloc(struct inode *ip, daddr_t
ext2fs_blkpref(ip, bn, bn, &ip->i_e2fs_blocks[0]),
cred, &newb);
if (error)
- return (error);
+ return error;
ip->i_e2fs_last_lblk = lbn;
ip->i_e2fs_last_blk = newb;
/* XXX ondisk32 */
@@ -160,17 +160,17 @@ ext2fs_balloc(struct inode *ip, daddr_t
clrbuf(bp);
*bpp = bp;
}
- return (0);
+ return 0;
}
/*
* Determine the number of levels of indirection.
*/
pref = 0;
if ((error = ufs_getlbns(vp, bn, indirs, &num)) != 0)
- return(error);
+ return error;
#ifdef DIAGNOSTIC
if (num < 1)
- panic ("ext2fs_balloc: ufs_getlbns returned indirect block\n");
+ panic("%s: ufs_getlbns returned indirect block\n", __func__);
#endif
/*
* Fetch the first indirect block allocating if necessary.
@@ -184,7 +184,7 @@ ext2fs_balloc(struct inode *ip, daddr_t
pref = ext2fs_blkpref(ip, lbn, 0, (int32_t *)0);
error = ext2fs_alloc(ip, lbn, pref, cred, &newb);
if (error)
- return (error);
+ return error;
nb = newb;
*allocblk++ = nb;
ip->i_e2fs_last_blk = newb;
@@ -287,7 +287,7 @@ ext2fs_balloc(struct inode *ip, daddr_t
clrbuf(nbp);
*bpp = nbp;
}
- return (0);
+ return 0;
}
brelse(bp, 0);
if (bpp != NULL) {
@@ -303,7 +303,7 @@ ext2fs_balloc(struct inode *ip, daddr_t
}
*bpp = nbp;
}
- return (0);
+ return 0;
fail:
/*
* If we have failed part way through block allocation, we
@@ -322,7 +322,8 @@ fail:
r = bread(vp, indirs[unwindidx].in_lbn,
(int)fs->e2fs_bsize, B_MODIFY, &bp);
if (r) {
- panic("Could not unwind indirect block, error %d", r);
+ panic("%s: Could not unwind indirect block, "
+ "error %d", __func__, r);
} else {
bap = (int32_t *)bp->b_data; /* XXX ondisk32 */
bap[indirs[unwindidx].in_off] = 0;
@@ -369,7 +370,7 @@ ext2fs_gop_alloc(struct vnode *vp, off_t
error = ext2fs_balloc(ip, ext2_lblkno(fs, off), bsize, cred,
NULL, flags);
if (error) {
- UVMHIST_LOG(ubchist, "error %d", error, 0,0,0);
+ UVMHIST_LOG(ubchist, "error %d", error, 0, 0, 0);
return error;
}
@@ -387,7 +388,8 @@ ext2fs_gop_alloc(struct vnode *vp, off_t
(off + bsize) & 0xffffffff);
error = ext2fs_setsize(ip, off + bsize);
if (error) {
- UVMHIST_LOG(ubchist, "error %d", error, 0,0,0);
+ UVMHIST_LOG(ubchist, "error %d",
+ error, 0, 0, 0);
return error;
}
}
Index: src/sys/ufs/ext2fs/ext2fs_bmap.c
diff -u src/sys/ufs/ext2fs/ext2fs_bmap.c:1.27 src/sys/ufs/ext2fs/ext2fs_bmap.c:1.28
--- src/sys/ufs/ext2fs/ext2fs_bmap.c:1.27 Fri Jun 3 11:35:48 2016
+++ src/sys/ufs/ext2fs/ext2fs_bmap.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_bmap.c,v 1.27 2016/06/03 15:35:48 christos Exp $ */
+/* $NetBSD: ext2fs_bmap.c,v 1.28 2016/08/13 07:40:10 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap.c,v 1.27 2016/06/03 15:35:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap.c,v 1.28 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -113,7 +113,7 @@ ext2fs_bmap(void *v)
if (ap->a_vpp != NULL)
*ap->a_vpp = VTOI(ap->a_vp)->i_devvp;
if (ap->a_bnp == NULL)
- return (0);
+ return 0;
if (VTOI(ap->a_vp)->i_din.e2fs_din->e2di_flags & IN_E4EXTENTS)
@@ -244,14 +244,14 @@ ext2fs_bmaparray(struct vnode *vp, daddr
is_sequential(ump, (daddr_t)fs2h32(ip->i_e2fs_blocks[bn - 1]),
(daddr_t)fs2h32(ip->i_e2fs_blocks[bn]));
++bn, ++*runp);
- return (0);
+ return 0;
}
xap = ap == NULL ? a : ap;
if (!nump)
nump = #
if ((error = ufs_getlbns(vp, bn, xap, nump)) != 0)
- return (error);
+ return error;
num = *nump;
@@ -299,7 +299,7 @@ ext2fs_bmaparray(struct vnode *vp, daddr
* for detail.
*/
- return (ENOMEM);
+ return ENOMEM;
}
if (bp->b_oflags & (BO_DONE | BO_DELWRI)) {
trace(TR_BREADHIT, pack(vp, size), metalbn);
@@ -316,7 +316,7 @@ ext2fs_bmaparray(struct vnode *vp, daddr
curlwp->l_ru.ru_inblock++; /* XXX */
if ((error = biowait(bp)) != 0) {
brelse(bp, 0);
- return (error);
+ return error;
}
}
@@ -335,5 +335,5 @@ ext2fs_bmaparray(struct vnode *vp, daddr
daddr = blkptrtodb(ump, daddr);
*bnp = daddr == 0 ? -1 : daddr;
- return (0);
+ return 0;
}
Index: src/sys/ufs/ext2fs/ext2fs_extents.c
diff -u src/sys/ufs/ext2fs/ext2fs_extents.c:1.2 src/sys/ufs/ext2fs/ext2fs_extents.c:1.3
--- src/sys/ufs/ext2fs/ext2fs_extents.c:1.2 Tue Aug 9 02:40:24 2016
+++ src/sys/ufs/ext2fs/ext2fs_extents.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_extents.c,v 1.2 2016/08/09 06:40:24 christos Exp $ */
+/* $NetBSD: ext2fs_extents.c,v 1.3 2016/08/13 07:40:10 christos Exp $ */
/*-
* Copyright (c) 2010 Zheng Liu <[email protected]>
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_extents.c,v 1.2 2016/08/09 06:40:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_extents.c,v 1.3 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -147,7 +147,7 @@ ext4_ext_in_cache(struct inode *ip, dadd
/* cache is invalid */
if (ecp->ec_type == EXT4_EXT_CACHE_NO)
- return (ret);
+ return ret;
if (lbn >= ecp->ec_blk && lbn < ecp->ec_blk + ecp->ec_len) {
ep->e_blk = ecp->ec_blk;
Index: src/sys/ufs/ext2fs/ext2fs_hash.c
diff -u src/sys/ufs/ext2fs/ext2fs_hash.c:1.1 src/sys/ufs/ext2fs/ext2fs_hash.c:1.2
--- src/sys/ufs/ext2fs/ext2fs_hash.c:1.1 Fri Jun 24 13:21:30 2016
+++ src/sys/ufs/ext2fs/ext2fs_hash.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_hash.c,v 1.1 2016/06/24 17:21:30 christos Exp $ */
+/* $NetBSD: ext2fs_hash.c,v 1.2 2016/08/13 07:40:10 christos Exp $ */
/*-
* Copyright (c) 2010, 2013 Zheng Liu <[email protected]>
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_hash.c,v 1.1 2016/06/24 17:21:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_hash.c,v 1.2 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -247,7 +247,7 @@ ext2fs_htree_hash(const char *name, int
int unsigned_char = 0;
if (!name || !hash_major)
- return (-1);
+ return -1;
if (len < 1 || len > 255)
goto error;
Index: src/sys/ufs/ext2fs/ext2fs_xattr.c
diff -u src/sys/ufs/ext2fs/ext2fs_xattr.c:1.1 src/sys/ufs/ext2fs/ext2fs_xattr.c:1.2
--- src/sys/ufs/ext2fs/ext2fs_xattr.c:1.1 Fri Aug 12 15:04:03 2016
+++ src/sys/ufs/ext2fs/ext2fs_xattr.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_xattr.c,v 1.1 2016/08/12 19:04:03 jdolecek Exp $ */
+/* $NetBSD: ext2fs_xattr.c,v 1.2 2016/08/13 07:40:10 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_xattr.c,v 1.1 2016/08/12 19:04:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_xattr.c,v 1.2 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -99,7 +99,7 @@ ext2fs_find_xattr(struct ext2fs_xattr_en
/* make sure the value offset are sane */
if (&value[value_len] > end)
- return (EINVAL);
+ return EINVAL;
if (uio != NULL) {
/*
@@ -124,10 +124,10 @@ ext2fs_find_xattr(struct ext2fs_xattr_en
}
/* requested attribute not found */
- return (ENODATA);
+ return ENODATA;
found:
- return (0);
+ return 0;
}
static int
@@ -142,7 +142,7 @@ ext2fs_get_inode_xattr(struct inode *ip,
end = &((uint8_t *)di)[EXT2_DINODE_SIZE(ip->i_e2fs)];
if (end <= start || fs2h32(h->h_magic) != EXT2FS_XATTR_MAGIC)
- return (ENODATA);
+ return ENODATA;
return ext2fs_find_xattr(EXT2FS_XATTR_IFIRST(h), start, end, attrnamespace, uio, size, name_index, name);
}
@@ -163,7 +163,7 @@ ext2fs_get_block_xattr(struct inode *ip,
/* don't do anything if no attr block was allocated */
if (xblk == 0)
- return (0);
+ return 0;
error = bread(ip->i_devvp, fsbtodb(ip->i_e2fs, xblk), (int)ip->i_e2fs->e2fs_bsize, 0, &bp);
if (error)
@@ -181,7 +181,7 @@ ext2fs_get_block_xattr(struct inode *ip,
out:
if (bp)
brelse(bp, 0);
- return (error);
+ return error;
}
int
ext2fs_getextattr(void *v)
@@ -210,7 +210,7 @@ ext2fs_getextattr(void *v)
error = extattr_check_cred(ap->a_vp, namebuf, ap->a_cred, VREAD);
if (error)
- return (error);
+ return error;
/*
* Allow only offsets of zero to encourage the read/replace
@@ -218,7 +218,7 @@ ext2fs_getextattr(void *v)
* atomicity, as we don't provide locks for extended attributes.
*/
if (ap->a_uio != NULL && ap->a_uio->uio_offset != 0)
- return (ENXIO);
+ return ENXIO;
/* figure out the name index */
name = ap->a_name;
@@ -246,7 +246,7 @@ ext2fs_getextattr(void *v)
if (ap->a_size != NULL)
*ap->a_size = valuesize;
- return (error);
+ return error;
}
int
@@ -266,7 +266,7 @@ ext2fs_setextattr(void *v)
#endif
/* XXX Not implemented */
- return (EOPNOTSUPP);
+ return EOPNOTSUPP;
}
static int
@@ -317,7 +317,7 @@ ext2fs_list_xattr(struct ext2fs_xattr_en
}
}
- return (0);
+ return 0;
}
static int
@@ -332,7 +332,7 @@ ext2fs_list_inode_xattr(struct inode *ip
end = &((uint8_t *)di)[EXT2_DINODE_SIZE(ip->i_e2fs)];
if (end <= start || fs2h32(h->h_magic) != EXT2FS_XATTR_MAGIC)
- return (0);
+ return 0;
return ext2fs_list_xattr(EXT2FS_XATTR_IFIRST(h), end, attrnamespace, flags, uio, size);
}
@@ -353,7 +353,7 @@ ext2fs_list_block_xattr(struct inode *ip
/* don't do anything if no attr block was allocated */
if (xblk == 0)
- return (0);
+ return 0;
error = bread(ip->i_devvp, fsbtodb(ip->i_e2fs, xblk), (int)ip->i_e2fs->e2fs_bsize, 0, &bp);
if (error)
@@ -370,7 +370,7 @@ ext2fs_list_block_xattr(struct inode *ip
out:
if (bp)
brelse(bp, 0);
- return (error);
+ return error;
}
int
@@ -405,7 +405,7 @@ ext2fs_listextattr(void *v)
prefix = xattr_prefix_index[EXT2FS_XATTR_PREFIX_SYSTEM];
error = extattr_check_cred(ap->a_vp, prefix, ap->a_cred, VREAD);
if (error)
- return (error);
+ return error;
/*
* Allow only offsets of zero to encourage the read/replace
@@ -414,22 +414,22 @@ ext2fs_listextattr(void *v)
* XXX revisit - vnode lock enough?
*/
if (ap->a_uio != NULL && ap->a_uio->uio_offset != 0)
- return (ENXIO);
+ return ENXIO;
/* fetch inode xattrs */
error = ext2fs_list_inode_xattr(ip, ap->a_attrnamespace, ap->a_flag, ap->a_uio, &listsize);
if (error)
- return (error);
+ return error;
error = ext2fs_list_block_xattr(ip, ap->a_attrnamespace, ap->a_flag, ap->a_uio, &listsize);
if (error)
- return (error);
+ return error;
out:
if (ap->a_size != NULL)
*ap->a_size = listsize;
- return (0);
+ return 0;
}
int
@@ -446,5 +446,5 @@ ext2fs_deleteextattr(void *v)
#endif
/* XXX Not implemented */
- return (EOPNOTSUPP);
+ return EOPNOTSUPP;
}
Index: src/sys/ufs/ext2fs/ext2fs_htree.c
diff -u src/sys/ufs/ext2fs/ext2fs_htree.c:1.4 src/sys/ufs/ext2fs/ext2fs_htree.c:1.5
--- src/sys/ufs/ext2fs/ext2fs_htree.c:1.4 Tue Aug 9 17:08:02 2016
+++ src/sys/ufs/ext2fs/ext2fs_htree.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_htree.c,v 1.4 2016/08/09 21:08:02 kre Exp $ */
+/* $NetBSD: ext2fs_htree.c,v 1.5 2016/08/13 07:40:10 christos Exp $ */
/*-
* Copyright (c) 2010, 2012 Zheng Liu <[email protected]>
@@ -29,7 +29,7 @@
* $FreeBSD: head/sys/fs/ext2fs/ext2fs_htree.c 294653 2016-01-24 02:41:49Z pfg $
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_htree.c,v 1.4 2016/08/09 21:08:02 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_htree.c,v 1.5 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -344,7 +344,7 @@ ext2fs_htree_split_dirblock(char *block1
/* Shrink directory entries in block 1. */
last = (struct ext2fs_direct *)block1;
entry_len = 0;
- for (offset = 0; offset < blksize; ) {
+ for (offset = 0; offset < blksize;) {
ep = (struct ext2fs_direct *)(block1 + offset);
offset += ep->e2d_reclen;
if (ep->e2d_ino) {
@@ -508,7 +508,7 @@ ext2fs_htree_add_entry(struct vnode *dvp
blksize = m_fs->e2fs_bsize;
if (ip->i_crap.ulr_count != 0)
- return ext2fs_add_entry(dvp, entry, &(ip->i_crap) );
+ return ext2fs_add_entry(dvp, entry, &(ip->i_crap));
/* Target directory block is full, split it */
memset(&info, 0, sizeof(info));
error = ext2fs_htree_find_leaf(ip, entry->e2d_name, entry->e2d_namlen,
@@ -779,7 +779,7 @@ ext2fs_htree_find_leaf(struct inode *ip,
level_info->h_entries = entp;
level_info->h_entry = found;
if (levels == 0)
- return (0);
+ return 0;
levels--;
if (ext2fs_blkatoff(vp,
ext2fs_htree_get_block(found) * m_fs->e2fs_bsize,
@@ -859,7 +859,7 @@ ext2fs_htree_lookup(struct inode *ip, co
return 0;
}
- brelse(bp,0);
+ brelse(bp, 0);
search_next = ext2fs_htree_check_next(ip, dirhash, name, &info);
} while (search_next);
Index: src/sys/ufs/ext2fs/ext2fs_inode.c
diff -u src/sys/ufs/ext2fs/ext2fs_inode.c:1.84 src/sys/ufs/ext2fs/ext2fs_inode.c:1.85
--- src/sys/ufs/ext2fs/ext2fs_inode.c:1.84 Thu Aug 4 13:43:48 2016
+++ src/sys/ufs/ext2fs/ext2fs_inode.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_inode.c,v 1.84 2016/08/04 17:43:48 jdolecek Exp $ */
+/* $NetBSD: ext2fs_inode.c,v 1.85 2016/08/13 07:40:10 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.84 2016/08/04 17:43:48 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.85 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -224,7 +224,7 @@ out:
*/
*ap->a_recycle = (ip->i_e2fs_dtime != 0);
VOP_UNLOCK(vp);
- return (error);
+ return error;
}
@@ -249,7 +249,7 @@ ext2fs_update(struct vnode *vp, const st
int flags;
if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (0);
+ return 0;
ip = VTOI(vp);
EXT2FS_ITIMES(ip, acc, mod, NULL);
if (updflags & UPDATE_CLOSE)
@@ -257,14 +257,14 @@ ext2fs_update(struct vnode *vp, const st
else
flags = ip->i_flag & IN_MODIFIED;
if (flags == 0)
- return (0);
+ return 0;
fs = ip->i_e2fs;
error = bread(ip->i_devvp,
EXT2_FSBTODB(fs, ino_to_fsba(fs, ip->i_number)),
(int)fs->e2fs_bsize, B_MODIFY, &bp);
if (error) {
- return (error);
+ return error;
}
ip->i_flag &= ~(IN_MODIFIED | IN_ACCESSED);
cp = (char *)bp->b_data +
@@ -273,10 +273,10 @@ ext2fs_update(struct vnode *vp, const st
if ((updflags & (UPDATE_WAIT|UPDATE_DIROP)) != 0 &&
(flags & IN_MODIFIED) != 0 &&
(vp->v_mount->mnt_flag & MNT_ASYNC) == 0)
- return (bwrite(bp));
+ return bwrite(bp);
else {
bdwrite(bp);
- return (0);
+ return 0;
}
}
@@ -311,7 +311,7 @@ ext2fs_truncate(struct vnode *ovp, off_t
}
if (length < 0)
- return (EINVAL);
+ return EINVAL;
if (ovp->v_type == VLNK &&
(ext2fs_size(oip) < ump->um_maxsymlinklen ||
@@ -320,18 +320,16 @@ ext2fs_truncate(struct vnode *ovp, off_t
memset((char *)&oip->i_din.e2fs_din->e2di_shortlink, 0,
(u_int)ext2fs_size(oip));
(void)ext2fs_setsize(oip, 0);
- oip->i_flag |= IN_CHANGE | IN_UPDATE;
- return (ext2fs_update(ovp, NULL, NULL, 0));
+ goto update;
}
if (ext2fs_size(oip) == length) {
/* still do a uvm_vnp_setsize() as writesize may be larger */
uvm_vnp_setsize(ovp, length);
- oip->i_flag |= IN_CHANGE | IN_UPDATE;
- return (ext2fs_update(ovp, NULL, NULL, 0));
+ goto update;
}
fs = oip->i_e2fs;
if (length > ump->um_maxfilesize)
- return (EFBIG);
+ return EFBIG;
osize = ext2fs_size(oip);
@@ -347,12 +345,11 @@ ext2fs_truncate(struct vnode *ovp, off_t
if (error) {
(void) ext2fs_truncate(ovp, osize, ioflag & IO_SYNC,
cred);
- return (error);
+ return error;
}
uvm_vnp_setsize(ovp, length);
- oip->i_flag |= IN_CHANGE | IN_UPDATE;
KASSERT(error || ovp->v_size == ext2fs_size(oip));
- return (ext2fs_update(ovp, NULL, NULL, 0));
+ goto update;
}
/*
* Shorten the size of the file. If the file is not being
@@ -485,7 +482,10 @@ done:
allerror = error;
oip->i_flag |= IN_CHANGE;
KASSERT(ovp->v_type != VREG || ovp->v_size == ext2fs_size(oip));
- return (allerror);
+ return allerror;
+update:
+ oip->i_flag |= IN_CHANGE | IN_UPDATE;
+ return ext2fs_update(ovp, NULL, NULL, 0);
}
/*
@@ -550,7 +550,7 @@ ext2fs_indirtrunc(struct inode *ip, dadd
if (error) {
brelse(bp, 0);
*countp = 0;
- return (error);
+ return error;
}
bap = (int32_t *)bp->b_data; /* XXX ondisk32 */
@@ -611,5 +611,5 @@ ext2fs_indirtrunc(struct inode *ip, dadd
}
*countp = blocksreleased;
- return (allerror);
+ return allerror;
}
Index: src/sys/ufs/ext2fs/ext2fs_lookup.c
diff -u src/sys/ufs/ext2fs/ext2fs_lookup.c:1.83 src/sys/ufs/ext2fs/ext2fs_lookup.c:1.84
--- src/sys/ufs/ext2fs/ext2fs_lookup.c:1.83 Sat Aug 13 03:25:29 2016
+++ src/sys/ufs/ext2fs/ext2fs_lookup.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_lookup.c,v 1.83 2016/08/13 07:25:29 christos Exp $ */
+/* $NetBSD: ext2fs_lookup.c,v 1.84 2016/08/13 07:40:10 christos Exp $ */
/*
* Modified for NetBSD 1.2E
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.83 2016/08/13 07:25:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.84 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -165,13 +165,13 @@ ext2fs_readdir(void *v)
int e2d_reclen;
if (vp->v_type != VDIR)
- return (ENOTDIR);
+ return ENOTDIR;
e2fs_count = uio->uio_resid;
/* Make sure we don't return partial entries. */
e2fs_count -= (uio->uio_offset + e2fs_count) & (fs->e2fs_bsize -1);
if (e2fs_count <= 0)
- return (EINVAL);
+ return EINVAL;
auio = *uio;
auio.uio_iov = &aiov;
@@ -193,7 +193,7 @@ ext2fs_readdir(void *v)
if (error == 0) {
readcnt = e2fs_count - auio.uio_resid;
for (dp = (struct ext2fs_direct *)dirbuf;
- (char *)dp < (char *)dirbuf + readcnt; ) {
+ (char *)dp < (char *)dirbuf + readcnt;) {
e2d_reclen = fs2h16(dp->e2d_reclen);
if (e2d_reclen == 0) {
error = EIO;
@@ -231,7 +231,7 @@ ext2fs_readdir(void *v)
} else
*ap->a_ncookies = nc - ncookies;
}
- return (error);
+ return error;
}
/*
@@ -322,11 +322,11 @@ ext2fs_lookup(void *v)
* Check accessiblity of directory.
*/
if ((error = VOP_ACCESS(vdp, VEXEC, cred)) != 0)
- return (error);
+ return error;
if ((flags & ISLASTCN) && (vdp->v_mount->mnt_flag & MNT_RDONLY) &&
(cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
- return (EROFS);
+ return EROFS;
/*
* We now have a segment name to search for, and a directory to search.
@@ -375,7 +375,7 @@ ext2fs_lookup(void *v)
results->ulr_offset = results->ulr_diroff;
if ((entryoffsetinblock = results->ulr_offset & bmask) &&
(error = ext2fs_blkatoff(vdp, (off_t)results->ulr_offset, NULL, &bp)))
- return (error);
+ return error;
numdirpasses = 2;
namecache_count_2passes();
}
@@ -427,7 +427,7 @@ searchloop:
error = ext2fs_blkatoff(vdp, (off_t)results->ulr_offset, NULL,
&bp);
if (error != 0)
- return (error);
+ return error;
entryoffsetinblock = 0;
}
/*
@@ -541,7 +541,7 @@ notfound:
*/
error = VOP_ACCESS(vdp, VWRITE, cred);
if (error)
- return (error);
+ return error;
/*
* Return an indication of where the new directory
* entry should be put. If we didn't find a slot,
@@ -576,14 +576,14 @@ notfound:
* NB - if the directory is unlocked, then this
* information cannot be used.
*/
- return (EJUSTRETURN);
+ return EJUSTRETURN;
}
/*
* Insert name into cache (as non-existent) if appropriate.
*/
if (nameiop != CREATE) {
cache_enter(vdp, *vpp, cnp->cn_nameptr, cnp->cn_namelen,
- cnp->cn_flags);
+ cnp->cn_flags);
}
return ENOENT;
@@ -600,7 +600,7 @@ found:
results->ulr_offset + EXT2FS_DIRSIZ(ep->e2d_namlen));
if (error) {
brelse(bp, 0);
- return (error);
+ return error;
}
dp->i_flag |= IN_CHANGE | IN_UPDATE;
uvm_vnp_setsize(vdp, ext2fs_size(dp));
@@ -638,14 +638,14 @@ found:
error = vcache_get(vdp->v_mount,
&foundino, sizeof(foundino), &tdp);
if (error)
- return (error);
+ return error;
}
/*
* Write access to directory required to delete files.
*/
if ((error = VOP_ACCESS(vdp, VWRITE, cred)) != 0) {
vrele(tdp);
- return (error);
+ return error;
}
/*
* If directory is "sticky", then user must own
@@ -659,11 +659,11 @@ found:
VTOI(tdp)->i_uid));
if (error) {
vrele(tdp);
- return (EPERM);
+ return EPERM;
}
}
*vpp = tdp;
- return (0);
+ return 0;
}
/*
@@ -675,19 +675,19 @@ found:
if (nameiop == RENAME && (flags & ISLASTCN)) {
error = VOP_ACCESS(vdp, VWRITE, cred);
if (error)
- return (error);
+ return error;
/*
* Careful about locking second inode.
* This can only occur if the target is ".".
*/
if (dp->i_number == foundino)
- return (EISDIR);
+ return EISDIR;
error = vcache_get(vdp->v_mount,
&foundino, sizeof(foundino), &tdp);
if (error)
- return (error);
+ return error;
*vpp = tdp;
- return (0);
+ return 0;
}
if (dp->i_number == foundino) {
@@ -697,7 +697,7 @@ found:
error = vcache_get(vdp->v_mount,
&foundino, sizeof(foundino), &tdp);
if (error)
- return (error);
+ return error;
*vpp = tdp;
}
@@ -932,14 +932,14 @@ ext2fs_direnter(struct inode *ip, struct
error = ext2fs_setsize(dp,
roundup(ext2fs_size(dp), dirblksiz));
if (error)
- return (error);
+ return error;
dp->i_flag |= IN_CHANGE;
uvm_vnp_setsize(dvp, ext2fs_size(dp));
}
return error;
}
- error = ext2fs_add_entry(dvp, &newdir,ulr);
+ error = ext2fs_add_entry(dvp, &newdir, ulr);
if (!error && ulr->ulr_endoff && ulr->ulr_endoff < ext2fs_size(dp))
error = ext2fs_truncate(dvp, (off_t)ulr->ulr_endoff, IO_SYNC,
@@ -978,7 +978,7 @@ ext2fs_add_entry (struct vnode* dvp, str
* Get the block containing the space for the new directory entry.
*/
if ((error = ext2fs_blkatoff(dvp, (off_t)ulr->ulr_offset, &dirbuf, &bp)) != 0)
- return (error);
+ return error;
/*
* Find space for the new entry. In the simple case, the entry at
* offset base will have the space. If it does not, then namei
@@ -989,7 +989,7 @@ ext2fs_add_entry (struct vnode* dvp, str
ep = (struct ext2fs_direct *)dirbuf;
newentrysize = dsize = EXT2FS_DIRSIZ(ep->e2d_namlen);
spacefree = fs2h16(ep->e2d_reclen) - dsize;
- for (loc = fs2h16(ep->e2d_reclen); loc < ulr->ulr_count; ) {
+ for (loc = fs2h16(ep->e2d_reclen); loc < ulr->ulr_count;) {
nep = (struct ext2fs_direct *)(dirbuf + loc);
if (ep->e2d_ino) {
/* trim the existing slot */
@@ -1062,11 +1062,11 @@ ext2fs_dirremove(struct vnode *dvp, cons
error = ext2fs_blkatoff(dvp, (off_t)ulr->ulr_offset,
(void *)&ep, &bp);
if (error != 0)
- return (error);
+ return error;
ep->e2d_ino = 0;
error = VOP_BWRITE(bp->b_vp, bp);
dp->i_flag |= IN_CHANGE | IN_UPDATE;
- return (error);
+ return error;
}
/*
* Collapse new free space into previous entry.
@@ -1074,11 +1074,11 @@ ext2fs_dirremove(struct vnode *dvp, cons
error = ext2fs_blkatoff(dvp, (off_t)(ulr->ulr_offset - ulr->ulr_count),
(void *)&ep, &bp);
if (error != 0)
- return (error);
+ return error;
ep->e2d_reclen = h2fs16(fs2h16(ep->e2d_reclen) + ulr->ulr_reclen);
error = VOP_BWRITE(bp->b_vp, bp);
dp->i_flag |= IN_CHANGE | IN_UPDATE;
- return (error);
+ return error;
}
/*
@@ -1097,7 +1097,7 @@ ext2fs_dirrewrite(struct inode *dp, cons
error = ext2fs_blkatoff(vdp, (off_t)ulr->ulr_offset, (void *)&ep, &bp);
if (error != 0)
- return (error);
+ return error;
ep->e2d_ino = h2fs32(ip->i_number);
if (ip->i_e2fs->e2fs.e2fs_rev > E2FS_REV0 &&
(ip->i_e2fs->e2fs.e2fs_features_incompat & EXT2F_INCOMPAT_FTYPE)) {
@@ -1107,7 +1107,7 @@ ext2fs_dirrewrite(struct inode *dp, cons
}
error = VOP_BWRITE(bp->b_vp, bp);
dp->i_flag |= IN_CHANGE | IN_UPDATE;
- return (error);
+ return error;
}
/*
@@ -1138,19 +1138,19 @@ ext2fs_dirempty(struct inode *ip, ino_t
* be 0 unless we're at end of file.
*/
if (error || count != 0)
- return (0);
+ return 0;
/* avoid infinite loops */
if (dp->e2d_reclen == 0)
- return (0);
+ return 0;
/* skip empty entries */
if (dp->e2d_ino == 0)
continue;
/* accept only "." and ".." */
namlen = dp->e2d_namlen;
if (namlen > 2)
- return (0);
+ return 0;
if (dp->e2d_name[0] != '.')
- return (0);
+ return 0;
/*
* At this point namlen must be 1 or 2.
* 1 implies ".", 2 implies ".." if second
@@ -1160,7 +1160,7 @@ ext2fs_dirempty(struct inode *ip, ino_t
continue;
if (dp->e2d_name[1] == '.' && fs2h32(dp->e2d_ino) == parentino)
continue;
- return (0);
+ return 0;
}
- return (1);
+ return 1;
}
Index: src/sys/ufs/ext2fs/ext2fs_readwrite.c
diff -u src/sys/ufs/ext2fs/ext2fs_readwrite.c:1.74 src/sys/ufs/ext2fs/ext2fs_readwrite.c:1.75
--- src/sys/ufs/ext2fs/ext2fs_readwrite.c:1.74 Sat Mar 28 15:24:04 2015
+++ src/sys/ufs/ext2fs/ext2fs_readwrite.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_readwrite.c,v 1.74 2015/03/28 19:24:04 maxv Exp $ */
+/* $NetBSD: ext2fs_readwrite.c,v 1.75 2016/08/13 07:40:10 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.74 2015/03/28 19:24:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.75 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -120,9 +120,9 @@ ext2fs_read(void *v)
return ext2fs_bufrd(vp, uio, ap->a_ioflag, ap->a_cred);
if ((uint64_t)uio->uio_offset > ump->um_maxfilesize)
- return (EFBIG);
+ return EFBIG;
if (uio->uio_resid == 0)
- return (0);
+ return 0;
if (uio->uio_offset >= ext2fs_size(ip))
goto out;
@@ -142,7 +142,7 @@ ext2fs_read(void *v)
out:
error = ext2fs_post_read_update(vp, ap->a_ioflag, error);
- return (error);
+ return error;
}
/*
@@ -228,7 +228,7 @@ ext2fs_bufrd(struct vnode *vp, struct ui
out:
error = ext2fs_post_read_update(vp, ioflag, error);
- return (error);
+ return error;
}
static int
@@ -289,14 +289,14 @@ ext2fs_write(void *v)
uio->uio_offset = ext2fs_size(ip);
if ((ip->i_e2fs_flags & EXT2_APPEND) &&
uio->uio_offset != ext2fs_size(ip))
- return (EPERM);
+ return EPERM;
fs = ip->i_e2fs;
if (uio->uio_offset < 0 ||
(uint64_t)uio->uio_offset + uio->uio_resid > ump->um_maxfilesize)
- return (EFBIG);
+ return EFBIG;
if (uio->uio_resid == 0)
- return (0);
+ return 0;
async = vp->v_mount->mnt_flag & MNT_ASYNC;
resid = uio->uio_resid;
@@ -351,7 +351,7 @@ ext2fs_write(void *v)
error = ext2fs_post_write_update(vp, uio, ioflag, ap->a_cred, osize,
resid, extended, error);
- return (error);
+ return error;
}
/*
@@ -433,7 +433,7 @@ ext2fs_bufwr(struct vnode *vp, struct ui
error = ext2fs_post_write_update(vp, uio, ioflag, cred, osize, resid,
extended, error);
- return (error);
+ return error;
}
static int
Index: src/sys/ufs/ext2fs/ext2fs_rename.c
diff -u src/sys/ufs/ext2fs/ext2fs_rename.c:1.9 src/sys/ufs/ext2fs/ext2fs_rename.c:1.10
--- src/sys/ufs/ext2fs/ext2fs_rename.c:1.9 Sat Aug 6 17:39:48 2016
+++ src/sys/ufs/ext2fs/ext2fs_rename.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_rename.c,v 1.9 2016/08/06 21:39:48 jdolecek Exp $ */
+/* $NetBSD: ext2fs_rename.c,v 1.10 2016/08/13 07:40:10 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.9 2016/08/06 21:39:48 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.10 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -781,7 +781,7 @@ ext2fs_rmdired_p(struct vnode *vp)
KASSERT(vp->v_type == VDIR);
/* XXX Is this correct? */
- return (ext2fs_size(VTOI(vp)) == 0);
+ return ext2fs_size(VTOI(vp)) == 0;
}
/*
Index: src/sys/ufs/ext2fs/ext2fs_subr.c
diff -u src/sys/ufs/ext2fs/ext2fs_subr.c:1.32 src/sys/ufs/ext2fs/ext2fs_subr.c:1.33
--- src/sys/ufs/ext2fs/ext2fs_subr.c:1.32 Wed Aug 3 19:29:05 2016
+++ src/sys/ufs/ext2fs/ext2fs_subr.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_subr.c,v 1.32 2016/08/03 23:29:05 jdolecek Exp $ */
+/* $NetBSD: ext2fs_subr.c,v 1.33 2016/08/13 07:40:10 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_subr.c,v 1.32 2016/08/03 23:29:05 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_subr.c,v 1.33 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -93,12 +93,12 @@ ext2fs_blkatoff(struct vnode *vp, off_t
*bpp = NULL;
if ((error = bread(vp, lbn, fs->e2fs_bsize, 0, &bp)) != 0) {
- return (error);
+ return error;
}
if (res)
*res = (char *)bp->b_data + ext2_blkoff(fs, offset);
*bpp = bp;
- return (0);
+ return 0;
}
void
Index: src/sys/ufs/ext2fs/ext2fs_vfsops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.197 src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.198
--- src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.197 Fri Aug 5 16:06:55 2016
+++ src/sys/ufs/ext2fs/ext2fs_vfsops.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_vfsops.c,v 1.197 2016/08/05 20:06:55 jdolecek Exp $ */
+/* $NetBSD: ext2fs_vfsops.c,v 1.198 2016/08/13 07:40:10 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.197 2016/08/05 20:06:55 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.198 2016/08/13 07:40:10 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -206,7 +206,7 @@ ext2fs_modcmd(modcmd_t cmd, void *arg)
break;
}
- return (error);
+ return error;
}
/*
@@ -255,17 +255,17 @@ ext2fs_mountroot(void)
int error;
if (device_class(root_device) != DV_DISK)
- return (ENODEV);
+ return ENODEV;
if ((error = vfs_rootmountalloc(MOUNT_EXT2FS, "root_device", &mp))) {
vrele(rootvp);
- return (error);
+ return error;
}
if ((error = ext2fs_mountfs(rootvp, mp)) != 0) {
vfs_unbusy(mp, false, NULL);
vfs_destroy(mp);
- return (error);
+ return error;
}
mountlist_append(mp);
ump = VFSTOUFS(mp);
@@ -281,7 +281,7 @@ ext2fs_mountroot(void)
(void)ext2fs_statvfs(mp, &mp->mnt_stat);
vfs_unbusy(mp, false, NULL);
setrootfstime((time_t)fs->e2fs.e2fs_wtime);
- return (0);
+ return 0;
}
/*
@@ -326,7 +326,7 @@ ext2fs_mount(struct mount *mp, const cha
error = namei_simple_user(args->fspec,
NSM_FOLLOW_NOEMULROOT, &devvp);
if (error != 0)
- return (error);
+ return error;
if (!update) {
/*
@@ -355,7 +355,7 @@ ext2fs_mount(struct mount *mp, const cha
} else {
if (!update) {
/* New mounts must have a filename for the device */
- return (EINVAL);
+ return EINVAL;
} else {
ump = VFSTOUFS(mp);
devvp = ump->um_devvp;
@@ -386,7 +386,7 @@ ext2fs_mount(struct mount *mp, const cha
if (error) {
vrele(devvp);
- return (error);
+ return error;
}
if (!update) {
@@ -440,14 +440,14 @@ ext2fs_mount(struct mount *mp, const cha
(void) ext2fs_sbupdate(ump, MNT_WAIT);
}
if (error)
- return (error);
+ return error;
fs->e2fs_ronly = 1;
}
if (mp->mnt_flag & MNT_RELOAD) {
error = ext2fs_reload(mp, l->l_cred, l);
if (error)
- return (error);
+ return error;
}
if (fs->e2fs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR)) {
@@ -485,11 +485,11 @@ ext2fs_mount(struct mount *mp, const cha
mp->mnt_stat.f_mntfromname);
(void) ext2fs_cgupdate(ump, MNT_WAIT);
}
- return (error);
+ return error;
fail:
vrele(devvp);
- return (error);
+ return error;
}
/*
@@ -522,11 +522,11 @@ ext2fs_loadvnode_content(struct m_ext2fs
ip->i_din.e2fs_din = din;
ext2fs_set_inode_guid(ip);
- return (error);
+ return error;
bad:
kmem_free(din, EXT2_DINODE_SIZE(fs));
- return (error);
+ return error;
}
/*
@@ -555,7 +555,7 @@ ext2fs_reload(struct mount *mp, kauth_cr
struct vnode_iterator *marker;
if ((mp->mnt_flag & MNT_RDONLY) == 0)
- return (EINVAL);
+ return EINVAL;
ump = VFSTOUFS(mp);
/*
@@ -594,7 +594,7 @@ ext2fs_reload(struct mount *mp, kauth_cr
1 /* superblock */ + i),
fs->e2fs_bsize, 0, &bp);
if (error) {
- return (error);
+ return error;
}
e2fs_cgload((struct ext2_gd *)bp->b_data,
&fs->e2fs_gd[i * fs->e2fs_bsize / sizeof(struct ext2_gd)],
@@ -638,7 +638,7 @@ ext2fs_reload(struct mount *mp, kauth_cr
vput(vp);
}
vfs_vnode_iterator_destroy(marker);
- return (error);
+ return error;
}
/*
@@ -664,7 +664,7 @@ ext2fs_mountfs(struct vnode *devvp, stru
error = vinvalbuf(devvp, V_SAVE, cred, l, 0, 0);
VOP_UNLOCK(devvp);
if (error)
- return (error);
+ return error;
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
@@ -744,7 +744,7 @@ ext2fs_mountfs(struct vnode *devvp, stru
ump->um_dirblksiz = m_fs->e2fs_bsize;
ump->um_maxfilesize = ((uint64_t)0x80000000 * m_fs->e2fs_bsize - 1);
spec_node_setmountedfs(devvp, mp);
- return (0);
+ return 0;
out:
if (bp != NULL)
@@ -754,7 +754,7 @@ out:
kmem_free(ump, sizeof(*ump));
mp->mnt_data = NULL;
}
- return (error);
+ return error;
}
/*
@@ -771,7 +771,7 @@ ext2fs_unmount(struct mount *mp, int mnt
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
if ((error = ext2fs_flushfiles(mp, flags)) != 0)
- return (error);
+ return error;
ump = VFSTOUFS(mp);
fs = ump->um_e2fs;
if (fs->e2fs_ronly == 0 &&
@@ -791,7 +791,7 @@ ext2fs_unmount(struct mount *mp, int mnt
kmem_free(ump, sizeof(*ump));
mp->mnt_data = NULL;
mp->mnt_flag &= ~MNT_LOCAL;
- return (error);
+ return error;
}
/*
@@ -806,7 +806,7 @@ ext2fs_flushfiles(struct mount *mp, int
if (!doforce)
flags &= ~FORCECLOSE;
error = vflush(mp, NULLVP, flags);
- return (error);
+ return error;
}
/*
@@ -864,7 +864,7 @@ ext2fs_statvfs(struct mount *mp, struct
sbp->f_favail = fs->e2fs.e2fs_ficount;
sbp->f_fresvd = 0;
copy_statvfs_info(sbp, mp);
- return (0);
+ return 0;
}
static bool
@@ -950,7 +950,7 @@ ext2fs_sync(struct mount *mp, int waitfo
if ((error = ext2fs_cgupdate(ump, waitfor)))
allerror = error;
}
- return (allerror);
+ return allerror;
}
/*
@@ -1060,21 +1060,21 @@ ext2fs_fhtovp(struct mount *mp, struct f
fs = VFSTOUFS(mp)->um_e2fs;
if ((ufh.ufid_ino < EXT2_FIRSTINO && ufh.ufid_ino != EXT2_ROOTINO) ||
ufh.ufid_ino >= fs->e2fs_ncg * fs->e2fs.e2fs_ipg)
- return (ESTALE);
+ return ESTALE;
if ((error = VFS_VGET(mp, ufh.ufid_ino, &nvp)) != 0) {
*vpp = NULLVP;
- return (error);
+ return error;
}
ip = VTOI(nvp);
if (ip->i_e2fs_mode == 0 || ip->i_e2fs_dtime != 0 ||
ip->i_e2fs_gen != ufh.ufid_gen) {
vput(nvp);
*vpp = NULLVP;
- return (ESTALE);
+ return ESTALE;
}
*vpp = nvp;
- return (0);
+ return 0;
}
/*
@@ -1099,7 +1099,7 @@ ext2fs_vptofh(struct vnode *vp, struct f
ufh.ufid_ino = ip->i_number;
ufh.ufid_gen = ip->i_e2fs_gen;
memcpy(fhp, &ufh, sizeof(ufh));
- return (0);
+ return 0;
}
/*
@@ -1118,7 +1118,7 @@ ext2fs_sbupdate(struct ufsmount *mp, int
error = bwrite(bp);
else
bawrite(bp);
- return (error);
+ return error;
}
int
@@ -1144,7 +1144,7 @@ ext2fs_cgupdate(struct ufsmount *mp, int
if (!allerror && error)
allerror = error;
- return (allerror);
+ return allerror;
}
/*
Index: src/sys/ufs/ext2fs/ext2fs_vnops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vnops.c:1.121 src/sys/ufs/ext2fs/ext2fs_vnops.c:1.122
--- src/sys/ufs/ext2fs/ext2fs_vnops.c:1.121 Fri Aug 12 15:04:03 2016
+++ src/sys/ufs/ext2fs/ext2fs_vnops.c Sat Aug 13 03:40:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_vnops.c,v 1.121 2016/08/12 19:04:03 jdolecek Exp $ */
+/* $NetBSD: ext2fs_vnops.c,v 1.122 2016/08/13 07:40:10 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.121 2016/08/12 19:04:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.122 2016/08/13 07:40:10 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -139,10 +139,10 @@ ext2fs_create(void *v)
ap->a_dvp, ap->a_vpp, ap->a_cnp);
if (error)
- return (error);
+ return error;
VN_KNOTE(ap->a_dvp, NOTE_WRITE);
VOP_UNLOCK(*ap->a_vpp);
- return (0);
+ return 0;
}
/*
@@ -167,7 +167,7 @@ ext2fs_mknod(void *v)
if ((error = ext2fs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode),
ap->a_dvp, vpp, ap->a_cnp)) != 0)
- return (error);
+ return error;
VN_KNOTE(ap->a_dvp, NOTE_WRITE);
ip = VTOI(*vpp);
mp = (*vpp)->v_mount;
@@ -191,9 +191,9 @@ ext2fs_mknod(void *v)
error = vcache_get(mp, &ino, sizeof(ino), vpp);
if (error != 0) {
*vpp = NULL;
- return (error);
+ return error;
}
- return (0);
+ return 0;
}
/*
@@ -216,8 +216,8 @@ ext2fs_open(void *v)
*/
if ((VTOI(ap->a_vp)->i_e2fs_flags & EXT2_APPEND) &&
(ap->a_mode & (FWRITE | O_APPEND)) == FWRITE)
- return (EPERM);
- return (0);
+ return EPERM;
+ return 0;
}
static int
@@ -235,7 +235,7 @@ ext2fs_check_possible(struct vnode *vp,
case VLNK:
case VREG:
if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (EROFS);
+ return EROFS;
break;
default:
break;
@@ -244,7 +244,7 @@ ext2fs_check_possible(struct vnode *vp,
/* If immutable bit set, nobody gets to write it. */
if ((mode & VWRITE) && (ip->i_e2fs_flags & EXT2_IMMUTABLE))
- return (EPERM);
+ return EPERM;
return 0;
}
@@ -334,7 +334,7 @@ ext2fs_getattr(void *v)
vap->va_bytes = dbtob(ext2fs_nblock(ip));
vap->va_type = vp->v_type;
vap->va_filerev = ip->i_modrev;
- return (0);
+ return 0;
}
/*
@@ -364,11 +364,11 @@ ext2fs_setattr(void *v)
(vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) ||
(vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) ||
((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) {
- return (EINVAL);
+ return EINVAL;
}
if (vap->va_flags != VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (EROFS);
+ return EROFS;
/*
* Check if we're allowed to change the flags.
@@ -394,7 +394,7 @@ ext2fs_setattr(void *v)
genfs_can_chflags(cred, vp->v_type, ip->i_uid,
changing_sysflags));
if (error)
- return (error);
+ return error;
ip->i_e2fs_flags &= ~(EXT2_APPEND | EXT2_IMMUTABLE | EXT2_NODUMP);
#ifdef EXT2FS_SYSTEM_FLAGS
@@ -410,19 +410,19 @@ ext2fs_setattr(void *v)
(vap->va_flags & UF_NODUMP) ? EXT2_NODUMP : 0;
ip->i_flag |= IN_CHANGE;
if (vap->va_flags & (IMMUTABLE | APPEND))
- return (0);
+ return 0;
}
if (ip->i_e2fs_flags & (EXT2_APPEND | EXT2_IMMUTABLE))
- return (EPERM);
+ return EPERM;
/*
* Go through the fields and update iff not VNOVAL.
*/
if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (EROFS);
+ return EROFS;
error = ext2fs_chown(vp, vap->va_uid, vap->va_gid, cred, l);
if (error)
- return (error);
+ return error;
}
if (vap->va_size != VNOVAL) {
/*
@@ -432,27 +432,27 @@ ext2fs_setattr(void *v)
*/
switch (vp->v_type) {
case VDIR:
- return (EISDIR);
+ return EISDIR;
case VLNK:
case VREG:
if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (EROFS);
+ return EROFS;
default:
break;
}
error = ext2fs_truncate(vp, vap->va_size, 0, cred);
if (error)
- return (error);
+ return error;
}
ip = VTOI(vp);
if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL || vap->va_birthtime.tv_sec != VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (EROFS);
+ return EROFS;
error = kauth_authorize_vnode(cred, KAUTH_VNODE_WRITE_TIMES, vp,
NULL, genfs_can_chtimes(vp, vap->va_vaflags, ip->i_uid,
cred));
if (error)
- return (error);
+ return error;
if (vap->va_atime.tv_sec != VNOVAL)
if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
ip->i_flag |= IN_ACCESS;
@@ -469,16 +469,16 @@ ext2fs_setattr(void *v)
error = ext2fs_update(vp, &vap->va_atime, &vap->va_mtime,
UPDATE_WAIT);
if (error)
- return (error);
+ return error;
}
error = 0;
if (vap->va_mode != (mode_t)VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (EROFS);
+ return EROFS;
error = ext2fs_chmod(vp, (int)vap->va_mode, cred, l);
}
VN_KNOTE(vp, NOTE_ATTRIB);
- return (error);
+ return error;
}
/*
@@ -495,12 +495,12 @@ ext2fs_chmod(struct vnode *vp, int mode,
NULL, genfs_can_chmod(vp->v_type, cred, ip->i_uid, ip->i_gid,
mode));
if (error)
- return (error);
+ return error;
ip->i_e2fs_mode &= ~ALLPERMS;
ip->i_e2fs_mode |= (mode & ALLPERMS);
ip->i_flag |= IN_CHANGE;
- return (0);
+ return 0;
}
/*
@@ -524,7 +524,7 @@ ext2fs_chown(struct vnode *vp, uid_t uid
error = kauth_authorize_vnode(cred, KAUTH_VNODE_CHANGE_OWNERSHIP, vp,
NULL, genfs_can_chown(cred, ip->i_uid, ip->i_gid, uid, gid));
if (error)
- return (error);
+ return error;
ogid = ip->i_gid;
ouid = ip->i_uid;
@@ -550,7 +550,7 @@ ext2fs_chown(struct vnode *vp, uid_t uid
kauth_authorize_vnode(cred, KAUTH_VNODE_RETAIN_SGID,
vp, NULL, EPERM) != 0)
ip->i_e2fs_mode &= ~ISGID;
- return (0);
+ return 0;
}
int
@@ -591,7 +591,7 @@ ext2fs_remove(void *v)
else
vput(vp);
vput(dvp);
- return (error);
+ return error;
}
/*
@@ -650,7 +650,7 @@ out1:
out2:
VN_KNOTE(vp, NOTE_LINK);
VN_KNOTE(dvp, NOTE_WRITE);
- return (error);
+ return error;
}
/*
@@ -779,7 +779,7 @@ bad:
*ap->a_vpp = tvp;
}
out:
- return (error);
+ return error;
}
/*
@@ -813,7 +813,7 @@ ext2fs_rmdir(void *v)
if (dp == ip) {
vrele(dvp);
vput(vp);
- return (EINVAL);
+ return EINVAL;
}
/*
* Verify the directory is empty (and valid).
@@ -866,7 +866,7 @@ out:
if (dvp)
vput(dvp);
vput(vp);
- return (error);
+ return error;
}
/*
@@ -890,13 +890,13 @@ ext2fs_symlink(void *v)
error = ext2fs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp,
vpp, ap->a_cnp);
if (error)
- return (error);
+ return error;
VN_KNOTE(ap->a_dvp, NOTE_WRITE);
vp = *vpp;
len = strlen(ap->a_target);
ip = VTOI(vp);
if (len < ip->i_ump->um_maxsymlinklen) {
- memcpy((char *)ip->i_din.e2fs_din->e2di_shortlink, ap->a_target, len);
+ memcpy(ip->i_din.e2fs_din->e2di_shortlink, ap->a_target, len);
error = ext2fs_setsize(ip, len);
if (error)
goto bad;
@@ -911,7 +911,7 @@ bad:
VOP_UNLOCK(vp);
if (error)
vrele(vp);
- return (error);
+ return error;
}
/*
@@ -933,10 +933,10 @@ ext2fs_readlink(void *v)
isize = ext2fs_size(ip);
if (isize < ump->um_maxsymlinklen ||
(ump->um_maxsymlinklen == 0 && ext2fs_nblock(ip) == 0)) {
- uiomove((char *)ip->i_din.e2fs_din->e2di_shortlink, isize, ap->a_uio);
- return (0);
+ uiomove(ip->i_din.e2fs_din->e2di_shortlink, isize, ap->a_uio);
+ return 0;
}
- return (UFS_BUFRD(vp, ap->a_uio, 0, ap->a_cred));
+ return UFS_BUFRD(vp, ap->a_uio, 0, ap->a_cred);
}
/*
@@ -1030,7 +1030,7 @@ ext2fs_vinit(struct mount *mntp, int (**
SETHIGH(ip->i_modrev, tv.tv_sec);
SETLOW(ip->i_modrev, tv.tv_usec * 4294);
*vpp = vp;
- return (0);
+ return 0;
}
/*
@@ -1056,7 +1056,7 @@ ext2fs_makeinode(int mode, struct vnode
mode |= IFREG;
if ((error = ext2fs_valloc(dvp, mode, cnp->cn_cred, &tvp)) != 0) {
- return (error);
+ return error;
}
ip = VTOI(tvp);
ip->i_uid = kauth_cred_geteuid(cnp->cn_cred);
@@ -1093,7 +1093,7 @@ ext2fs_makeinode(int mode, struct vnode
if (error != 0)
goto bad;
*vpp = tvp;
- return (0);
+ return 0;
bad:
/*
@@ -1104,7 +1104,7 @@ bad:
ip->i_e2fs_nlink = 0;
ip->i_flag |= IN_CHANGE;
vput(tvp);
- return (error);
+ return error;
}
/*
@@ -1128,13 +1128,13 @@ ext2fs_reclaim(void *v)
if (ip->i_omode == 1 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
ext2fs_vfree(vp, ip->i_number, ip->i_e2fs_mode);
if ((error = ufs_reclaim(vp)) != 0)
- return (error);
+ return error;
if (ip->i_din.e2fs_din != NULL)
kmem_free(ip->i_din.e2fs_din, EXT2_DINODE_SIZE(ip->i_e2fs));
genfs_node_destroy(vp);
pool_put(&ext2fs_inode_pool, vp->v_data);
vp->v_data = NULL;
- return (0);
+ return 0;
}
/* Global vfs data structures for ext2fs. */