summaryrefslogtreecommitdiff
path: root/sys/ntfs/ntfs_compr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ntfs/ntfs_compr.c')
-rw-r--r--sys/ntfs/ntfs_compr.c49
1 files changed, 19 insertions, 30 deletions
diff --git a/sys/ntfs/ntfs_compr.c b/sys/ntfs/ntfs_compr.c
index 50d08ed3b5e..5bbbacac5e1 100644
--- a/sys/ntfs/ntfs_compr.c
+++ b/sys/ntfs/ntfs_compr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_compr.c,v 1.4 2009/08/13 16:00:53 jasper Exp $ */
+/* $OpenBSD: ntfs_compr.c,v 1.5 2010/08/12 04:26:56 tedu Exp $ */
/* $NetBSD: ntfs_compr.c,v 1.1 2002/12/23 17:38:31 jdolecek Exp $ */
/*-
@@ -31,16 +31,7 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/vnode.h>
#include <sys/mount.h>
-#include <sys/buf.h>
-#include <sys/file.h>
-#include <sys/malloc.h>
-
-#include <miscfs/specfs/specdev.h>
#include <ntfs/ntfs.h>
#include <ntfs/ntfs_compr.h>
@@ -48,15 +39,13 @@
#define GET_UINT16(addr) (*((u_int16_t *)(addr)))
int
-ntfs_uncompblock(
- u_int8_t * buf,
- u_int8_t * cbuf)
+ntfs_uncompblock(u_int8_t * buf, u_int8_t * cbuf)
{
- u_int32_t ctag;
- int len, dshift, lmask;
- int blen, boff;
- int i, j;
- int pos, cpos;
+ u_int32_t ctag;
+ int len, dshift, lmask;
+ int blen, boff;
+ int i, j;
+ int pos, cpos;
len = GET_UINT16(cbuf) & 0xFFF;
dprintf(("ntfs_uncompblock: block length: %d + 3, 0x%x,0x%04x\n",
@@ -69,7 +58,7 @@ ntfs_uncompblock(
}
memcpy(buf, cbuf + 2, len + 1);
bzero(buf + len + 1, NTFS_COMPBLOCK_SIZE - 1 - len);
- return len + 3;
+ return (len + 3);
}
cpos = 2;
pos = 0;
@@ -84,7 +73,8 @@ ntfs_uncompblock(
}
boff = -1 - (GET_UINT16(cbuf + cpos) >> dshift);
blen = 3 + (GET_UINT16(cbuf + cpos) & lmask);
- for (j = 0; (j < blen) && (pos < NTFS_COMPBLOCK_SIZE); j++) {
+ for (j = 0; (j < blen) &&
+ (pos < NTFS_COMPBLOCK_SIZE); j++) {
buf[pos] = buf[pos + boff];
pos++;
}
@@ -95,21 +85,20 @@ ntfs_uncompblock(
ctag >>= 1;
}
}
- return len + 3;
+ return (len + 3);
}
int
-ntfs_uncompunit(
- struct ntfsmount * ntmp,
- u_int8_t * uup,
- u_int8_t * cup)
+ntfs_uncompunit(struct ntfsmount * ntmp, u_int8_t * uup, u_int8_t * cup)
{
- int i;
- int off = 0;
- int new;
+ int i;
+ int off = 0;
+ int new;
- for (i = 0; i * NTFS_COMPBLOCK_SIZE < ntfs_cntob(NTFS_COMPUNIT_CL); i++) {
- new = ntfs_uncompblock(uup + i * NTFS_COMPBLOCK_SIZE, cup + off);
+ for (i = 0; i * NTFS_COMPBLOCK_SIZE < ntfs_cntob(NTFS_COMPUNIT_CL);
+ i++) {
+ new = ntfs_uncompblock(uup + i * NTFS_COMPBLOCK_SIZE,
+ cup + off);
if (new == 0)
return (EINVAL);
off += new;