Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Fix indentation. u_intN_t -> uintN_t. ntohl -> be3...
details: https://anonhg.NetBSD.org/src/rev/83cbe6d99c94
branches: trunk
changeset: 355411:83cbe6d99c94
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Jul 28 16:22:01 2017 +0000
description:
Fix indentation. u_intN_t -> uintN_t. ntohl -> be32toh.
No functional change intended.
diffstat:
sys/dev/vnd.c | 48 +++++++++++++++++++++++++-----------------------
1 files changed, 25 insertions(+), 23 deletions(-)
diffs (122 lines):
diff -r 782d26a9191c -r 83cbe6d99c94 sys/dev/vnd.c
--- a/sys/dev/vnd.c Fri Jul 28 16:19:20 2017 +0000
+++ b/sys/dev/vnd.c Fri Jul 28 16:22:01 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.260 2017/07/28 16:19:20 riastradh Exp $ */
+/* $NetBSD: vnd.c,v 1.261 2017/07/28 16:22:01 riastradh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.260 2017/07/28 16:19:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.261 2017/07/28 16:22:01 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@@ -1267,34 +1267,34 @@
#ifdef VND_COMPRESSION
struct vnd_comp_header *ch;
int i;
- u_int32_t comp_size;
- u_int32_t comp_maxsize;
+ uint32_t comp_size;
+ uint32_t comp_maxsize;
/* allocate space for compresed file header */
ch = malloc(sizeof(struct vnd_comp_header),
- M_TEMP, M_WAITOK);
+ M_TEMP, M_WAITOK);
/* read compressed file header */
error = vn_rdwr(UIO_READ, nd.ni_vp, (void *)ch,
- sizeof(struct vnd_comp_header), 0, UIO_SYSSPACE,
- IO_UNIT|IO_NODELOCKED, l->l_cred, NULL, NULL);
+ sizeof(struct vnd_comp_header), 0, UIO_SYSSPACE,
+ IO_UNIT|IO_NODELOCKED, l->l_cred, NULL, NULL);
if (error) {
free(ch, M_TEMP);
VOP_UNLOCK(nd.ni_vp);
goto close_and_exit;
}
- if (ntohl(ch->block_size) == 0 ||
- ntohl(ch->num_blocks) > UINT32_MAX - 1) {
+ if (be32toh(ch->block_size) == 0 ||
+ be32toh(ch->num_blocks) > UINT32_MAX - 1) {
free(ch, M_TEMP);
VOP_UNLOCK(nd.ni_vp);
goto close_and_exit;
}
/* save some header info */
- vnd->sc_comp_blksz = ntohl(ch->block_size);
+ vnd->sc_comp_blksz = be32toh(ch->block_size);
/* note last offset is the file byte size */
- vnd->sc_comp_numoffs = ntohl(ch->num_blocks)+1;
+ vnd->sc_comp_numoffs = be32toh(ch->num_blocks) + 1;
free(ch, M_TEMP);
if (!DK_DEV_BSIZE_OK(vnd->sc_comp_blksz)) {
VOP_UNLOCK(nd.ni_vp);
@@ -1325,14 +1325,14 @@
/* allocate space for all the compressed offsets */
__CTASSERT(UINT32_MAX <= UQUAD_MAX/sizeof(uint64_t));
vnd->sc_comp_offsets =
- malloc(sizeof(u_int64_t) * vnd->sc_comp_numoffs,
- M_DEVBUF, M_WAITOK);
+ malloc(sizeof(uint64_t) * vnd->sc_comp_numoffs,
+ M_DEVBUF, M_WAITOK);
/* read in the offsets */
error = vn_rdwr(UIO_READ, nd.ni_vp,
- (void *)vnd->sc_comp_offsets,
- sizeof(u_int64_t) * vnd->sc_comp_numoffs,
- sizeof(struct vnd_comp_header), UIO_SYSSPACE,
+ (void *)vnd->sc_comp_offsets,
+ sizeof(uint64_t) * vnd->sc_comp_numoffs,
+ sizeof(struct vnd_comp_header), UIO_SYSSPACE,
IO_UNIT|IO_NODELOCKED, l->l_cred, NULL, NULL);
if (error) {
VOP_UNLOCK(nd.ni_vp);
@@ -1345,22 +1345,24 @@
comp_maxsize = 0;
for (i = 0; i < vnd->sc_comp_numoffs - 1; i++) {
vnd->sc_comp_offsets[i] =
- be64toh(vnd->sc_comp_offsets[i]);
- comp_size = be64toh(vnd->sc_comp_offsets[i + 1])
- - vnd->sc_comp_offsets[i];
+ be64toh(vnd->sc_comp_offsets[i]);
+ comp_size =
+ be64toh(vnd->sc_comp_offsets[i + 1])
+ - vnd->sc_comp_offsets[i];
if (comp_size > comp_maxsize)
comp_maxsize = comp_size;
}
vnd->sc_comp_offsets[vnd->sc_comp_numoffs - 1] =
- be64toh(vnd->sc_comp_offsets[vnd->sc_comp_numoffs - 1]);
+ be64toh(vnd->sc_comp_offsets[vnd->sc_comp_numoffs
+ - 1]);
/* create compressed data buffer */
vnd->sc_comp_buff = malloc(comp_maxsize,
- M_DEVBUF, M_WAITOK);
+ M_DEVBUF, M_WAITOK);
/* create decompressed buffer */
vnd->sc_comp_decombuf = malloc(vnd->sc_comp_blksz,
- M_DEVBUF, M_WAITOK);
+ M_DEVBUF, M_WAITOK);
vnd->sc_comp_buffblk = -1;
/* Initialize decompress stream */
@@ -1371,7 +1373,7 @@
if (error) {
if (vnd->sc_comp_stream.msg)
printf("vnd%d: compressed file, %s\n",
- unit, vnd->sc_comp_stream.msg);
+ unit, vnd->sc_comp_stream.msg);
VOP_UNLOCK(nd.ni_vp);
error = EINVAL;
goto close_and_exit;
Home |
Main Index |
Thread Index |
Old Index