Module Name: src
Committed By: maxv
Date: Sun Jun 21 13:43:58 UTC 2015
Modified Files:
src/sys/fs/hfs: hfs_subr.c
Log Message:
KNF
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/hfs/hfs_subr.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_subr.c
diff -u src/sys/fs/hfs/hfs_subr.c:1.18 src/sys/fs/hfs/hfs_subr.c:1.19
--- src/sys/fs/hfs/hfs_subr.c:1.18 Sat Mar 28 19:24:05 2015
+++ src/sys/fs/hfs/hfs_subr.c Sun Jun 21 13:43:58 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: hfs_subr.c,v 1.18 2015/03/28 19:24:05 maxv Exp $ */
+/* $NetBSD: hfs_subr.c,v 1.19 2015/06/21 13:43:58 maxv Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hfs_subr.c,v 1.18 2015/03/28 19:24:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_subr.c,v 1.19 2015/06/21 13:43:58 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -173,9 +173,9 @@ hfs_libcb_opendev(
goto error;
}
vol->cbdata = cbdata;
-
+
cbdata->devvp = NULL;
-
+
/* Open the device node. */
mode = vol->readonly ? FREAD : FREAD|FWRITE;
vn_lock(args->devvp, LK_EXCLUSIVE | LK_RETRY);
@@ -200,7 +200,7 @@ hfs_libcb_opendev(
cbdata->devblksz = DEV_BSIZE;
else
cbdata->devblksz = secsize;
-
+
return 0;
error:
@@ -222,10 +222,10 @@ void
hfs_libcb_closedev(hfs_volume* in_vol, hfs_callback_args* cbargs)
{
struct vnode *devvp;
-
+
if (in_vol == NULL)
return;
-
+
if (in_vol->cbdata != NULL) {
devvp = ((hfs_libcb_data*)in_vol->cbdata)->devvp;
if (devvp != NULL) {
@@ -252,10 +252,10 @@ hfs_libcb_read(
hfs_libcb_argsread* argsread;
kauth_cred_t cred;
uint64_t physoffset; /* physical offset from start of device(?) */
-
+
if (vol == NULL || outbytes == NULL)
return -1;
-
+
cbdata = (hfs_libcb_data*)vol->cbdata;
if (cbargs != NULL
@@ -264,7 +264,7 @@ hfs_libcb_read(
cred = argsread->cred;
else
cred = NOCRED;
-
+
/*
* Since bread() only reads data in terms of integral blocks, it may have
* read some data before and/or after our desired offset & length. So when
@@ -293,13 +293,13 @@ hfs_pread(struct vnode *vp, void *buf, s
uint64_t curoff; /* relative to 'start' variable */
uint64_t start;
int error;
-
+
if (vp == NULL || buf == NULL)
return EINVAL;
-
+
if (len == 0)
return 0;
-
+
curoff = 0;
error = 0;
@@ -324,12 +324,12 @@ hfs_pread(struct vnode *vp, void *buf, s
if (error == 0)
memcpy((uint8_t*)buf + curoff, (uint8_t*)bp->b_data +
(off - start), min(len - curoff, MAXBSIZE - (off - start)));
-
+
if (bp != NULL)
brelse(bp, 0);
if (error != 0)
return error;
-
+
curoff += MAXBSIZE;
}
#undef ABSZ
@@ -352,12 +352,12 @@ hfs_time_to_timespec(uint32_t hfstime, s
* precisely a 66 year difference between them, which is equal to
* 2,082,844,800 seconds. No, I didn't count them by hand.
*/
-
+
if (hfstime < 2082844800)
unixtime->tv_sec = 0; /* dates before 1970 are bs anyway, so use epoch*/
else
unixtime->tv_sec = hfstime - 2082844800;
-
+
unixtime->tv_nsec = 0; /* we don't have nanosecond resolution */
}
@@ -368,21 +368,20 @@ hfs_time_to_timespec(uint32_t hfstime, s
uint16_t be16tohp(void** inout_ptr)
{
uint16_t result;
-
- if(inout_ptr == NULL)
+
+ if (inout_ptr == NULL)
return 0;
-
+
memcpy(&result, *inout_ptr, sizeof(result));
*inout_ptr = (char *)*inout_ptr + sizeof(result);
-
return be16toh(result);
}
uint32_t be32tohp(void** inout_ptr)
{
uint32_t result;
-
- if(inout_ptr == NULL)
+
+ if (inout_ptr == NULL)
return 0;
memcpy(&result, *inout_ptr, sizeof(result));
@@ -393,8 +392,8 @@ uint32_t be32tohp(void** inout_ptr)
uint64_t be64tohp(void** inout_ptr)
{
uint64_t result;
-
- if(inout_ptr == NULL)
+
+ if (inout_ptr == NULL)
return 0;
memcpy(&result, *inout_ptr, sizeof(result));
@@ -405,7 +404,7 @@ uint64_t be64tohp(void** inout_ptr)
enum vtype
hfs_catalog_keyed_record_vtype(const hfs_catalog_keyed_record_t *rec)
{
- if (rec->type == HFS_REC_FILE) {
+ if (rec->type == HFS_REC_FILE) {
uint32_t mode;
mode = ((const hfs_file_record_t *)rec)->bsd.file_mode;
@@ -413,7 +412,6 @@ hfs_catalog_keyed_record_vtype(const hfs
return IFTOVT(mode);
else
return VREG;
- }
- else
+ } else
return VDIR;
}