Module Name: src
Committed By: maxv
Date: Sun Jun 21 13:50:34 UTC 2015
Modified Files:
src/sys/fs/hfs: hfs_vnops.c
Log Message:
KNF
To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/fs/hfs/hfs_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/fs/hfs/hfs_vnops.c
diff -u src/sys/fs/hfs/hfs_vnops.c:1.31 src/sys/fs/hfs/hfs_vnops.c:1.32
--- src/sys/fs/hfs/hfs_vnops.c:1.31 Sun Aug 10 08:53:22 2014
+++ src/sys/fs/hfs/hfs_vnops.c Sun Jun 21 13:50:34 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: hfs_vnops.c,v 1.31 2014/08/10 08:53:22 hannken Exp $ */
+/* $NetBSD: hfs_vnops.c,v 1.32 2015/06/21 13:50:34 maxv Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- */
+ */
/*
* Copyright (c) 1992, 1993
@@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.31 2014/08/10 08:53:22 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.32 2015/06/21 13:50:34 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@@ -463,8 +463,7 @@ hfs_vop_lookup(void *v)
cnp->cn_flags &= ~REQUIREDIR; /* XXX: needed? */
error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
HFS_RSRCFORK, &tdp);
- }
- else
+ } else
error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
HFS_DATAFORK, &tdp);
if (error != 0)
@@ -630,8 +629,7 @@ hfs_vop_getattr(void *v)
hfs_time_to_timespec(f->date_content_mod, &vap->va_mtime);
hfs_time_to_timespec(f->date_accessed, &vap->va_atime);
vap->va_nlink = 1;
- }
- else if (hp->h_rec.u.rec_type == HFS_REC_FLDR) {
+ } else if (hp->h_rec.u.rec_type == HFS_REC_FLDR) {
hfs_folder_record_t *f = &hp->h_rec.folder;
vap->va_fileid = hp->h_rec.folder.cnid;
bsd = &f->bsd;
@@ -641,8 +639,7 @@ hfs_vop_getattr(void *v)
hfs_time_to_timespec(f->date_content_mod,&vap->va_mtime);
hfs_time_to_timespec(f->date_accessed, &vap->va_atime);
vap->va_nlink = 2; /* XXX */
- }
- else {
+ } else {
DPRINTF(("hfs+: hfs_vop_getattr(): invalid record type %i",
hp->h_rec.u.rec_type));
return EINVAL;
@@ -656,8 +653,7 @@ hfs_vop_getattr(void *v)
vap->va_mode = (S_IFDIR | HFS_DEFAULT_DIR_MODE);
vap->va_uid = HFS_DEFAULT_UID;
vap->va_gid = HFS_DEFAULT_GID;
- }
- else {
+ } else {
vap->va_mode = bsd->file_mode;
vap->va_uid = bsd->owner_id;
vap->va_gid = bsd->group_id;
@@ -805,7 +801,6 @@ hfs_vop_bmap(void *v)
*ap->a_runp = (MAXBSIZE >> bshift) - 1;
else
*ap->a_runp = nblk;
-
}
free(extents, M_TEMP);
@@ -827,7 +822,7 @@ hfs_vop_read(void *v)
struct uio *uio;
uint64_t fsize; /* logical size of file */
int advice;
- int error;
+ int error;
vp = ap->a_vp;
hp = VTOH(vp);
@@ -839,13 +834,13 @@ hfs_vop_read(void *v)
error = 0;
advice = IO_ADV_DECODE(ap->a_ioflag);
- if (uio->uio_offset < 0)
- return EINVAL;
+ if (uio->uio_offset < 0)
+ return EINVAL;
- if (uio->uio_resid == 0 || uio->uio_offset >= fsize)
- return 0;
+ if (uio->uio_resid == 0 || uio->uio_offset >= fsize)
+ return 0;
- if (vp->v_type != VREG && vp->v_type != VLNK)
+ if (vp->v_type != VREG && vp->v_type != VLNK)
return EINVAL;
error = 0;
@@ -860,13 +855,13 @@ hfs_vop_read(void *v)
UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
}
- return error;
+ return error;
}
int
hfs_vop_readdir(void *v)
{
-struct vop_readdir_args /* {
+ struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
kauth_cred_t a_cred;
@@ -890,14 +885,14 @@ struct vop_readdir_args /* {
size_t namlen, ni;
int error;
int i; /* dummy variable */
-
+
bufoff = 0;
children = NULL;
error = 0;
numchildren = 0;
hp = VTOH(ap->a_vp);
uio = ap->a_uio;
-
+
if (uio->uio_offset < 0)
return EINVAL;
if (ap->a_eofflag != NULL)
@@ -915,7 +910,7 @@ struct vop_readdir_args /* {
argsread.cred = ap->a_cred;
argsread.l = NULL;
cbargs.read = &argsread;
-
+
/* XXX Should we cache this? */
if (hfslib_get_directory_contents(&hp->h_hmp->hm_vol, hp->h_rec.u.cnid,
&children, &childnames, &numchildren, &cbargs) != 0) {
@@ -940,7 +935,7 @@ struct vop_readdir_args /* {
curent.d_name[ni] = ':';
curent.d_namlen = namlen;
curent.d_reclen = _DIRENT_SIZE(&curent);
-
+
/* Skip to desired dirent. */
bufoff += curent.d_reclen;
if (bufoff - curent.d_reclen < uio->uio_offset)
@@ -953,7 +948,7 @@ struct vop_readdir_args /* {
*ap->a_eofflag = 1;
break;
}
-
+
curent.d_fileno = children[curchild].file.cnid;
switch (hfs_catalog_keyed_record_vtype(children+curchild)) {
case VREG:
@@ -983,19 +978,18 @@ struct vop_readdir_args /* {
}
DPRINTF(("curchildname = %s\t\t", curchildname));
/* pad curent.d_name to aligned byte boundary */
- for (i = curent.d_namlen;
- i < curent.d_reclen - _DIRENT_NAMEOFF(&curent); i++)
- curent.d_name[i] = 0;
-
+ for (i = curent.d_namlen;
+ i < curent.d_reclen - _DIRENT_NAMEOFF(&curent); i++)
+ curent.d_name[i] = 0;
+
DPRINTF(("curent.d_name = %s\n", curent.d_name));
if ((error = uiomove(&curent, curent.d_reclen, uio)) != 0)
goto error;
}
-
/* FALLTHROUGH */
-
+
error:
if (numchildren > 0) {
if (children != NULL)
@@ -1015,8 +1009,8 @@ int
hfs_vop_readlink(void *v) {
struct vop_readlink_args /* {
struct vnode *a_vp;
- struct uio *a_uio;
- kauth_cred_t a_cred;
+ struct uio *a_uio;
+ kauth_cred_t a_cred;
} */ *ap = v;
return VOP_READ(ap->a_vp, ap->a_uio, 0, ap->a_cred);
@@ -1044,7 +1038,7 @@ hfs_vop_reclaim(void *v)
vrele(hp->h_devvp);
hp->h_devvp = 0;
}
-
+
genfs_node_destroy(vp);
pool_put(&hfs_node_pool, hp);
vp->v_data = NULL;