summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/ntfs/ntfs_compr.c49
-rw-r--r--sys/ntfs/ntfs_conv.c18
2 files changed, 22 insertions, 45 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;
diff --git a/sys/ntfs/ntfs_conv.c b/sys/ntfs/ntfs_conv.c
index 683d32be269..1eab868c013 100644
--- a/sys/ntfs/ntfs_conv.c
+++ b/sys/ntfs/ntfs_conv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_conv.c,v 1.7 2009/08/13 16:00:53 jasper Exp $ */
+/* $OpenBSD: ntfs_conv.c,v 1.8 2010/08/12 04:26:56 tedu Exp $ */
/* $NetBSD: ntfs_conv.c,v 1.1 2002/12/23 17:38:32 jdolecek Exp $ */
/*-
@@ -36,24 +36,12 @@
#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>
/* #define NTFS_DEBUG 1 */
#include <ntfs/ntfs.h>
-#include <ntfs/ntfsmount.h>
#include <ntfs/ntfs_inode.h>
-#include <ntfs/ntfs_vfsops.h>
#include <ntfs/ntfs_subr.h>
-#include <ntfs/ntfs_compr.h>
-#include <ntfs/ntfs_ihash.h>
/* UTF-8 encoding stuff */
@@ -91,8 +79,8 @@ ntfs_utf8_wget(const char **str)
case 3:
if ((s[1] & 0xC0) != 0x80 || (s[2] & 0xC0) != 0x80)
goto encoding_error;
- rune = ((s[0] & 0x1F) << 12) | ((s[1] & 0x3F) << 6)
- | (s[2] & 0x3F);
+ rune = ((s[0] & 0x1F) << 12) | ((s[1] & 0x3F) << 6) |
+ (s[2] & 0x3F);
break;
}