summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2010-06-20 09:40:54 +0000
committerbrian <brian@FreeBSD.org>2010-06-20 09:40:54 +0000
commitf4323232d9473d9b7d302f1a5113254e321b0dd0 (patch)
treeca785311050d789fc6777c8d85b147548a7a5afb /sbin
parentf16fb8206ed902d68fd499178f91de0b8d64c8f9 (diff)
downloadFreeBSD-src-f4323232d9473d9b7d302f1a5113254e321b0dd0.zip
FreeBSD-src-f4323232d9473d9b7d302f1a5113254e321b0dd0.tar.gz
Fix some style(9), although there's a lot more issues here.
Fix some casting errors. PR: 142384 Submitted by: giffunip at tutopia dot com Obtained from: NetBSD MFC after: 3 weeks
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck_msdosfs/Makefile2
-rw-r--r--sbin/fsck_msdosfs/boot.c36
-rw-r--r--sbin/fsck_msdosfs/check.c2
-rw-r--r--sbin/fsck_msdosfs/dir.c15
-rw-r--r--sbin/fsck_msdosfs/fat.c3
5 files changed, 34 insertions, 24 deletions
diff --git a/sbin/fsck_msdosfs/Makefile b/sbin/fsck_msdosfs/Makefile
index fd539b9..ddb8e8a 100644
--- a/sbin/fsck_msdosfs/Makefile
+++ b/sbin/fsck_msdosfs/Makefile
@@ -9,6 +9,6 @@ MAN= fsck_msdosfs.8
SRCS= main.c check.c boot.c fat.c dir.c fsutil.c
CFLAGS+= -I${FSCK}
-WARNS?= 0
+WARNS?= 2
.include <bsd.prog.mk>
diff --git a/sbin/fsck_msdosfs/boot.c b/sbin/fsck_msdosfs/boot.c
index b777d08..fe60f3a 100644
--- a/sbin/fsck_msdosfs/boot.c
+++ b/sbin/fsck_msdosfs/boot.c
@@ -48,13 +48,14 @@ readboot(int dosfs, struct bootblock *boot)
int ret = FSOK;
int i;
- if ((size_t)read(dosfs, block, sizeof block) != sizeof block) {
+ if (read(dosfs, block, sizeof block) != sizeof block) {
perror("could not read boot block");
return FSFATAL;
}
if (block[510] != 0x55 || block[511] != 0xaa) {
- pfatal("Invalid signature in boot block: %02x%02x", block[511], block[510]);
+ pfatal("Invalid signature in boot block: %02x%02x",
+ block[511], block[510]);
return FSFATAL;
}
@@ -72,8 +73,10 @@ readboot(int dosfs, struct bootblock *boot)
boot->bpbFATsmall = block[22] + (block[23] << 8);
boot->SecPerTrack = block[24] + (block[25] << 8);
boot->bpbHeads = block[26] + (block[27] << 8);
- boot->bpbHiddenSecs = block[28] + (block[29] << 8) + (block[30] << 16) + (block[31] << 24);
- boot->bpbHugeSectors = block[32] + (block[33] << 8) + (block[34] << 16) + (block[35] << 24);
+ boot->bpbHiddenSecs = block[28] + (block[29] << 8) +
+ (block[30] << 16) + (block[31] << 24);
+ boot->bpbHugeSectors = block[32] + (block[33] << 8) +
+ (block[34] << 16) + (block[35] << 24);
boot->FATsecs = boot->bpbFATsmall;
@@ -97,10 +100,9 @@ readboot(int dosfs, struct bootblock *boot)
boot->bpbFSInfo = block[48] + (block[49] << 8);
boot->bpbBackup = block[50] + (block[51] << 8);
- if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET)
- != boot->bpbFSInfo * boot->bpbBytesPerSec
- || read(dosfs, fsinfo, sizeof fsinfo)
- != sizeof fsinfo) {
+ if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec,
+ SEEK_SET) != boot->bpbFSInfo * boot->bpbBytesPerSec
+ || read(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) {
perror("could not read fsinfo block");
return FSFATAL;
}
@@ -124,7 +126,8 @@ readboot(int dosfs, struct bootblock *boot)
fsinfo[0x3fc] = fsinfo[0x3fd] = 0;
fsinfo[0x3fe] = 0x55;
fsinfo[0x3ff] = 0xaa;
- if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET)
+ if (lseek(dosfs, boot->bpbFSInfo *
+ boot->bpbBytesPerSec, SEEK_SET)
!= boot->bpbFSInfo * boot->bpbBytesPerSec
|| write(dosfs, fsinfo, sizeof fsinfo)
!= sizeof fsinfo) {
@@ -144,7 +147,8 @@ readboot(int dosfs, struct bootblock *boot)
+ (fsinfo[0x1ef] << 24);
}
- if (lseek(dosfs, boot->bpbBackup * boot->bpbBytesPerSec, SEEK_SET)
+ if (lseek(dosfs, boot->bpbBackup * boot->bpbBytesPerSec,
+ SEEK_SET)
!= boot->bpbBackup * boot->bpbBytesPerSec
|| read(dosfs, backup, sizeof backup) != sizeof backup) {
perror("could not read backup bootblock");
@@ -172,11 +176,10 @@ readboot(int dosfs, struct bootblock *boot)
/* Check backup bpbFSInfo? XXX */
}
- boot->ClusterOffset = (boot->bpbRootDirEnts * 32 + boot->bpbBytesPerSec - 1)
- / boot->bpbBytesPerSec
- + boot->bpbResSectors
- + boot->bpbFATs * boot->FATsecs
- - CLUST_FIRST * boot->bpbSecPerClust;
+ boot->ClusterOffset = (boot->bpbRootDirEnts * 32 +
+ boot->bpbBytesPerSec - 1) / boot->bpbBytesPerSec +
+ boot->bpbResSectors + boot->bpbFATs * boot->FATsecs -
+ CLUST_FIRST * boot->bpbSecPerClust;
if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) {
pfatal("Invalid sector size: %u", boot->bpbBytesPerSec);
@@ -191,7 +194,8 @@ readboot(int dosfs, struct bootblock *boot)
boot->NumSectors = boot->bpbSectors;
} else
boot->NumSectors = boot->bpbHugeSectors;
- boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) / boot->bpbSecPerClust;
+ boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) /
+ boot->bpbSecPerClust;
if (boot->flags&FAT32)
boot->ClustMask = CLUST32_MASK;
diff --git a/sbin/fsck_msdosfs/check.c b/sbin/fsck_msdosfs/check.c
index a762f8a..2f558bd 100644
--- a/sbin/fsck_msdosfs/check.c
+++ b/sbin/fsck_msdosfs/check.c
@@ -98,7 +98,7 @@ checkfilesys(const char *fname)
}
if (boot.ValidFat < 0)
- for (i = 1; i < (int)boot.bpbFATs; i++) {
+ for (i = 1; i < boot.bpbFATs; i++) {
struct fatEntry *currentFat;
mod |= readfat(dosfs, &boot, i, &currentFat);
diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c
index 181fa37..f2ecff3 100644
--- a/sbin/fsck_msdosfs/dir.c
+++ b/sbin/fsck_msdosfs/dir.c
@@ -242,7 +242,8 @@ resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
memset(rootDir, 0, sizeof *rootDir);
if (boot->flags & FAT32) {
- if (boot->bpbRootClust < CLUST_FIRST || boot->bpbRootClust >= boot->NumClusters) {
+ if (boot->bpbRootClust < CLUST_FIRST ||
+ boot->bpbRootClust >= boot->NumClusters) {
pfatal("Root directory starts with cluster out of range(%u)",
boot->bpbRootClust);
return FSFATAL;
@@ -356,7 +357,8 @@ removede(int f, struct bootblock *boot, struct fatEntry *fat, u_char *start,
pwarn("Invalid long filename entry for %s\n", path);
break;
case 1:
- pwarn("Invalid long filename entry at end of directory %s\n", path);
+ pwarn("Invalid long filename entry at end of directory %s\n",
+ path);
break;
case 2:
pwarn("Invalid long filename entry for volume label\n");
@@ -418,7 +420,8 @@ checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p,
cl_t cl;
u_int32_t sz = 0;
- for (cl = dir->head; (sz += boot->ClusterSize) < dir->size;)
+ for (cl = dir->head; (sz += boot->ClusterSize) <
+ dir->size;)
cl = fat[cl].next;
clearchain(boot, fat, fat[cl].next);
fat[cl].next = CLUST_EOF;
@@ -462,7 +465,8 @@ readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
do {
if (!(boot->flags & FAT32) && !dir->parent) {
last = boot->bpbRootDirEnts * 32;
- off = boot->bpbResSectors + boot->bpbFATs * boot->FATsecs;
+ off = boot->bpbResSectors + boot->bpbFATs *
+ boot->FATsecs;
} else {
last = boot->bpbSecPerClust * boot->bpbBytesPerSec;
off = cl * boot->bpbSecPerClust + boot->ClusterOffset;
@@ -547,7 +551,8 @@ readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
}
lidx = *p & LRNOMASK;
t = longName + --lidx * 13;
- for (k = 1; k < 11 && t < longName + sizeof(longName); k += 2) {
+ for (k = 1; k < 11 && t < longName +
+ sizeof(longName); k += 2) {
if (!p[k] && !p[k + 1])
break;
*t++ = p[k];
diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c
index 126c3ef..7a6368c 100644
--- a/sbin/fsck_msdosfs/fat.c
+++ b/sbin/fsck_msdosfs/fat.c
@@ -87,7 +87,8 @@ checkdirty(int fs, struct bootblock *boot)
goto err;
}
- if (read(fs, buffer, boot->bpbBytesPerSec) != boot->bpbBytesPerSec) {
+ if ((size_t)read(fs, buffer, boot->bpbBytesPerSec) !=
+ boot->bpbBytesPerSec) {
perror("Unable to read FAT");
goto err;
}
OpenPOWER on IntegriCloud