Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/hfs KNF
details: https://anonhg.NetBSD.org/src/rev/6a3c37baaa24
branches: trunk
changeset: 338993:6a3c37baaa24
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Jun 21 13:50:34 2015 +0000
description:
KNF
diffstat:
sys/fs/hfs/hfs_vnops.c | 62 ++++------
sys/fs/hfs/libhfs.h | 275 ++++++++++++++++++++----------------------------
2 files changed, 145 insertions(+), 192 deletions(-)
diffs (truncated from 760 to 300 lines):
diff -r 6818502f3e05 -r 6a3c37baaa24 sys/fs/hfs/hfs_vnops.c
--- a/sys/fs/hfs/hfs_vnops.c Sun Jun 21 13:40:25 2015 +0000
+++ b/sys/fs/hfs/hfs_vnops.c Sun Jun 21 13:50:34 2015 +0000
@@ -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 @@
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_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_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 @@
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 @@
*ap->a_runp = (MAXBSIZE >> bshift) - 1;
else
*ap->a_runp = nblk;
-
}
free(extents, M_TEMP);
@@ -827,7 +822,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
*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 @@
}
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 @@
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 @@
vrele(hp->h_devvp);
hp->h_devvp = 0;
}
-
+
genfs_node_destroy(vp);
pool_put(&hfs_node_pool, hp);
vp->v_data = NULL;
diff -r 6818502f3e05 -r 6a3c37baaa24 sys/fs/hfs/libhfs.h
--- a/sys/fs/hfs/libhfs.h Sun Jun 21 13:40:25 2015 +0000
+++ b/sys/fs/hfs/libhfs.h Sun Jun 21 13:50:34 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: libhfs.h,v 1.6 2012/07/28 00:43:23 matt Exp $ */
+/* $NetBSD: libhfs.h,v 1.7 2015/06/21 14:00:40 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.
- */
+ */
#ifndef _FS_HFS_LIBHFS_H_
#define _FS_HFS_LIBHFS_H_
@@ -72,15 +72,13 @@
#endif
-enum
-{
+enum {
HFS_SIG_HFSP = 0x482B, /* 'H+' */
HFS_SIG_HFSX = 0x4858, /* 'HX' */
HFS_SIG_HFS = 0x4244 /* 'BD' */
}; /* volume signatures */
-typedef enum
-{
+typedef enum {
/* bits 0-6 are reserved */
HFS_VOL_HWLOCK = 7,
HFS_VOL_UNMOUNTED = 8,
@@ -94,23 +92,20 @@
/* bits 16-31 are reserved */
} hfs_volume_attribute_bit; /* volume header attribute bits */
-typedef enum
-{
+typedef enum {
HFS_LEAFNODE = -1,
HFS_INDEXNODE = 0,
HFS_HEADERNODE = 1,
HFS_MAPNODE = 2
} hfs_node_kind; /* btree node kinds */
-enum
-{
+enum {
HFS_BAD_CLOSE_MASK = 0x00000001,
HFS_BIG_KEYS_MASK = 0x00000002,
HFS_VAR_INDEX_KEYS_MASK = 0x00000004
}; /* btree header attribute masks */
-typedef enum
-{
+typedef enum {
HFS_CNID_ROOT_PARENT = 1,
HFS_CNID_ROOT_FOLDER = 2,
HFS_CNID_EXTENTS = 3,
@@ -125,49 +120,43 @@
HFS_CNID_USER = 16
} hfs_special_cnid; /* special CNID values */
-typedef enum
-{
+typedef enum {
HFS_REC_FLDR = 0x0001,
HFS_REC_FILE = 0x0002,
HFS_REC_FLDR_THREAD = 0x0003,
HFS_REC_FILE_THREAD = 0x0004
} hfs_catalog_rec_kind; /* catalog record types */
-enum
-{
- HFS_JOURNAL_ON_DISK_MASK = 0x00000001, /* journal on same volume */
- HFS_JOURNAL_ON_OTHER_MASK = 0x00000002, /* journal elsewhere */
- HFS_JOURNAL_NEEDS_INIT_MASK = 0x00000004
+enum {
+ HFS_JOURNAL_ON_DISK_MASK = 0x00000001, /* journal on same volume */
+ HFS_JOURNAL_ON_OTHER_MASK = 0x00000002, /* journal elsewhere */
+ HFS_JOURNAL_NEEDS_INIT_MASK = 0x00000004
}; /* journal flag masks */
-enum
-{
+enum {
HFS_JOURNAL_HEADER_MAGIC = 0x4a4e4c78,
HFS_JOURNAL_ENDIAN_MAGIC = 0x12345678
Home |
Main Index |
Thread Index |
Old Index