summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_msdosfs
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-03-20 22:57:10 +0000
committerimp <imp@FreeBSD.org>2002-03-20 22:57:10 +0000
commit120c3c211a8089f3738404796935729d10069e44 (patch)
treeb0afc6442896204ba707723c961e59b4de37a932 /sbin/fsck_msdosfs
parent90c76cbe1ef31e40c4b9b9cd46731d2716307ef0 (diff)
downloadFreeBSD-src-120c3c211a8089f3738404796935729d10069e44.zip
FreeBSD-src-120c3c211a8089f3738404796935729d10069e44.tar.gz
o __P removed
o ansi function prototypes o unifdef -D__STDC__ o __dead2 on usage prototype o remove now-bogus main prototype
Diffstat (limited to 'sbin/fsck_msdosfs')
-rw-r--r--sbin/fsck_msdosfs/dir.c101
-rw-r--r--sbin/fsck_msdosfs/ext.h32
-rw-r--r--sbin/fsck_msdosfs/fat.c68
-rw-r--r--sbin/fsck_msdosfs/main.c22
4 files changed, 67 insertions, 156 deletions
diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c
index 64636cb..b87a916 100644
--- a/sbin/fsck_msdosfs/dir.c
+++ b/sbin/fsck_msdosfs/dir.c
@@ -93,20 +93,20 @@ static const char rcsid[] =
/* dir.c */
-static struct dosDirEntry *newDosDirEntry __P((void));
-static void freeDosDirEntry __P((struct dosDirEntry *));
-static struct dirTodoNode *newDirTodo __P((void));
-static void freeDirTodo __P((struct dirTodoNode *));
-static char *fullpath __P((struct dosDirEntry *));
-static u_char calcShortSum __P((u_char *));
-static int delete __P((int, struct bootblock *, struct fatEntry *, cl_t, int,
- cl_t, int, int));
-static int removede __P((int, struct bootblock *, struct fatEntry *, u_char *,
- u_char *, cl_t, cl_t, cl_t, char *, int));
-static int checksize __P((struct bootblock *, struct fatEntry *, u_char *,
- struct dosDirEntry *));
-static int readDosDirSection __P((int, struct bootblock *, struct fatEntry *,
- struct dosDirEntry *));
+static struct dosDirEntry *newDosDirEntry(void);
+static void freeDosDirEntry(struct dosDirEntry *);
+static struct dirTodoNode *newDirTodo(void);
+static void freeDirTodo(struct dirTodoNode *);
+static char *fullpath(struct dosDirEntry *);
+static u_char calcShortSum(u_char *);
+static int delete(int, struct bootblock *, struct fatEntry *, cl_t, int,
+ cl_t, int, int);
+static int removede(int, struct bootblock *, struct fatEntry *, u_char *,
+ u_char *, cl_t, cl_t, cl_t, char *, int);
+static int checksize(struct bootblock *, struct fatEntry *, u_char *,
+ struct dosDirEntry *);
+static int readDosDirSection(int, struct bootblock *, struct fatEntry *,
+ struct dosDirEntry *);
/*
* Manage free dosDirEntry structures.
@@ -114,7 +114,7 @@ static int readDosDirSection __P((int, struct bootblock *, struct fatEntry *,
static struct dosDirEntry *freede;
static struct dosDirEntry *
-newDosDirEntry()
+newDosDirEntry(void)
{
struct dosDirEntry *de;
@@ -127,8 +127,7 @@ newDosDirEntry()
}
static void
-freeDosDirEntry(de)
- struct dosDirEntry *de;
+freeDosDirEntry(struct dosDirEntry *de)
{
de->next = freede;
freede = de;
@@ -140,7 +139,7 @@ freeDosDirEntry(de)
static struct dirTodoNode *freedt;
static struct dirTodoNode *
-newDirTodo()
+newDirTodo(void)
{
struct dirTodoNode *dt;
@@ -153,8 +152,7 @@ newDirTodo()
}
static void
-freeDirTodo(dt)
- struct dirTodoNode *dt;
+freeDirTodo(struct dirTodoNode *dt)
{
dt->next = freedt;
freedt = dt;
@@ -169,8 +167,7 @@ struct dirTodoNode *pendingDirectories = NULL;
* Return the full pathname for a directory entry.
*/
static char *
-fullpath(dir)
- struct dosDirEntry *dir;
+fullpath(struct dosDirEntry *dir)
{
static char namebuf[MAXPATHLEN + 1];
char *cp, *np;
@@ -197,8 +194,7 @@ fullpath(dir)
* Calculate a checksum over an 8.3 alias name
*/
static u_char
-calcShortSum(p)
- u_char *p;
+calcShortSum(u_char *p)
{
u_char sum = 0;
int i;
@@ -225,9 +221,7 @@ static struct dosDirEntry *lostDir;
* Init internal state for a new directory scan.
*/
int
-resetDosDirSection(boot, fat)
- struct bootblock *boot;
- struct fatEntry *fat;
+resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
{
int b1, b2;
cl_t cl;
@@ -280,7 +274,7 @@ resetDosDirSection(boot, fat)
* Cleanup after a directory scan
*/
void
-finishDosDirSection()
+finishDosDirSection(void)
{
struct dirTodoNode *p, *np;
struct dosDirEntry *d, *nd;
@@ -310,15 +304,8 @@ finishDosDirSection()
* Delete directory entries between startcl, startoff and endcl, endoff.
*/
static int
-delete(f, boot, fat, startcl, startoff, endcl, endoff, notlast)
- int f;
- struct bootblock *boot;
- struct fatEntry *fat;
- cl_t startcl;
- int startoff;
- cl_t endcl;
- int endoff;
- int notlast;
+delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
+ int startoff, cl_t endcl, int endoff, int notlast)
{
u_char *s, *e;
off_t off;
@@ -357,17 +344,8 @@ delete(f, boot, fat, startcl, startoff, endcl, endoff, notlast)
}
static int
-removede(f, boot, fat, start, end, startcl, endcl, curcl, path, type)
- int f;
- struct bootblock *boot;
- struct fatEntry *fat;
- u_char *start;
- u_char *end;
- cl_t startcl;
- cl_t endcl;
- cl_t curcl;
- char *path;
- int type;
+removede(int f, struct bootblock *boot, struct fatEntry *fat, u_char *start,
+ u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, char *path, int type)
{
switch (type) {
case 0:
@@ -401,11 +379,8 @@ removede(f, boot, fat, start, end, startcl, endcl, curcl, path, type)
* Check an in-memory file entry
*/
static int
-checksize(boot, fat, p, dir)
- struct bootblock *boot;
- struct fatEntry *fat;
- u_char *p;
- struct dosDirEntry *dir;
+checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p,
+ struct dosDirEntry *dir)
{
/*
* Check size on ordinary files
@@ -456,11 +431,8 @@ checksize(boot, fat, p, dir)
* - push directories onto the todo-stack
*/
static int
-readDosDirSection(f, boot, fat, dir)
- int f;
- struct bootblock *boot;
- struct fatEntry *fat;
- struct dosDirEntry *dir;
+readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
+ struct dosDirEntry *dir)
{
struct dosDirEntry dirent, *d;
u_char *p, *vallfn, *invlfn, *empty;
@@ -879,10 +851,7 @@ readDosDirSection(f, boot, fat, dir)
}
int
-handleDirTree(dosfs, boot, fat)
- int dosfs;
- struct bootblock *boot;
- struct fatEntry *fat;
+handleDirTree(int dosfs, struct bootblock *boot, struct fatEntry *fat)
{
int mod;
@@ -923,11 +892,7 @@ static cl_t lfcl;
static off_t lfoff;
int
-reconnect(dosfs, boot, fat, head)
- int dosfs;
- struct bootblock *boot;
- struct fatEntry *fat;
- cl_t head;
+reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
{
struct dosDirEntry d;
u_char *p;
@@ -1009,7 +974,7 @@ reconnect(dosfs, boot, fat, head)
}
void
-finishlf()
+finishlf(void)
{
if (lfbuf)
free(lfbuf);
diff --git a/sbin/fsck_msdosfs/ext.h b/sbin/fsck_msdosfs/ext.h
index effb546..fab080f 100644
--- a/sbin/fsck_msdosfs/ext.h
+++ b/sbin/fsck_msdosfs/ext.h
@@ -56,12 +56,12 @@ extern struct dosDirEntry *rootDir;
/*
* function declarations
*/
-int ask __P((int, const char *, ...)) __attribute__((__format__(__printf__,2,3)));
+int ask(int, const char *, ...) __attribute__((__format__(__printf__,2,3)));
/*
* Check filesystem given as arg
*/
-int checkfilesys __P((const char *));
+int checkfilesys(const char *);
/*
* Return values of various functions
@@ -79,41 +79,41 @@ int checkfilesys __P((const char *));
* read a boot block in a machine independend fashion and translate
* it into our struct bootblock.
*/
-int readboot __P((int, struct bootblock *));
+int readboot(int, struct bootblock *);
/*
* Correct the FSInfo block.
*/
-int writefsinfo __P((int, struct bootblock *));
+int writefsinfo(int, struct bootblock *);
/*
* Read one of the FAT copies and return a pointer to the new
* allocated array holding our description of it.
*/
-int readfat __P((int, struct bootblock *, int, struct fatEntry **));
+int readfat(int, struct bootblock *, int, struct fatEntry **);
/*
* Check two FAT copies for consistency and merge changes into the
* first if neccessary.
*/
-int comparefat __P((struct bootblock *, struct fatEntry *, struct fatEntry *, int));
+int comparefat(struct bootblock *, struct fatEntry *, struct fatEntry *, int);
/*
* Check a FAT
*/
-int checkfat __P((struct bootblock *, struct fatEntry *));
+int checkfat(struct bootblock *, struct fatEntry *);
/*
* Write back FAT entries
*/
-int writefat __P((int, struct bootblock *, struct fatEntry *, int));
+int writefat(int, struct bootblock *, struct fatEntry *, int);
/*
* Read a directory
*/
-int resetDosDirSection __P((struct bootblock *, struct fatEntry *));
-void finishDosDirSection __P((void));
-int handleDirTree __P((int, struct bootblock *, struct fatEntry *));
+int resetDosDirSection(struct bootblock *, struct fatEntry *);
+void finishDosDirSection(void);
+int handleDirTree(int, struct bootblock *, struct fatEntry *);
/*
* Cross-check routines run after everything is completely in memory
@@ -121,12 +121,12 @@ int handleDirTree __P((int, struct bootblock *, struct fatEntry *));
/*
* Check for lost cluster chains
*/
-int checklost __P((int, struct bootblock *, struct fatEntry *));
+int checklost(int, struct bootblock *, struct fatEntry *);
/*
* Try to reconnect a lost cluster chain
*/
-int reconnect __P((int, struct bootblock *, struct fatEntry *, cl_t));
-void finishlf __P((void));
+int reconnect(int, struct bootblock *, struct fatEntry *, cl_t);
+void finishlf(void);
/*
* Small helper functions
@@ -134,11 +134,11 @@ void finishlf __P((void));
/*
* Return the type of a reserved cluster as text
*/
-char *rsrvdcltype __P((cl_t));
+char *rsrvdcltype(cl_t);
/*
* Clear a cluster chain in a FAT
*/
-void clearchain __P((struct bootblock *, struct fatEntry *, cl_t));
+void clearchain(struct bootblock *, struct fatEntry *, cl_t);
#endif
diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c
index ff21f41..e8b004e 100644
--- a/sbin/fsck_msdosfs/fat.c
+++ b/sbin/fsck_msdosfs/fat.c
@@ -47,20 +47,16 @@ static const char rcsid[] =
#include "ext.h"
#include "fsutil.h"
-static int checkclnum __P((struct bootblock *, int, cl_t, cl_t *));
-static int clustdiffer __P((cl_t, cl_t *, cl_t *, int));
-static int tryclear __P((struct bootblock *, struct fatEntry *, cl_t, cl_t *));
-static int _readfat __P((int, struct bootblock *, int, u_char **));
+static int checkclnum(struct bootblock *, int, cl_t, cl_t *);
+static int clustdiffer(cl_t, cl_t *, cl_t *, int);
+static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *);
+static int _readfat(int, struct bootblock *, int, u_char **);
/*
* Check a cluster number for valid value
*/
static int
-checkclnum(boot, fat, cl, next)
- struct bootblock *boot;
- int fat;
- cl_t cl;
- cl_t *next;
+checkclnum(struct bootblock *boot, int fat, cl_t cl, cl_t *next)
{
if (*next >= (CLUST_RSRVD&boot->ClustMask))
*next |= ~boot->ClustMask;
@@ -91,11 +87,7 @@ checkclnum(boot, fat, cl, next)
* Read a FAT from disk. Returns 1 if successful, 0 otherwise.
*/
static int
-_readfat(fs, boot, no, buffer)
- int fs;
- struct bootblock *boot;
- int no;
- u_char **buffer;
+_readfat(int fs, struct bootblock *boot, int no, u_char **buffer)
{
off_t off;
@@ -130,11 +122,7 @@ _readfat(fs, boot, no, buffer)
* Read a FAT and decode it into internal format
*/
int
-readfat(fs, boot, no, fp)
- int fs;
- struct bootblock *boot;
- int no;
- struct fatEntry **fp;
+readfat(int fs, struct bootblock *boot, int no, struct fatEntry **fp)
{
struct fatEntry *fat;
u_char *buffer, *p;
@@ -252,8 +240,7 @@ readfat(fs, boot, no, fp)
* Get type of reserved cluster
*/
char *
-rsrvdcltype(cl)
- cl_t cl;
+rsrvdcltype(cl_t cl)
{
if (cl == CLUST_FREE)
return "free";
@@ -265,11 +252,7 @@ rsrvdcltype(cl)
}
static int
-clustdiffer(cl, cp1, cp2, fatnum)
- cl_t cl;
- cl_t *cp1;
- cl_t *cp2;
- int fatnum;
+clustdiffer(cl_t cl, cl_t *cp1, cl_t *cp2, int fatnum)
{
if (*cp1 == CLUST_FREE || *cp1 >= CLUST_RSRVD) {
if (*cp2 == CLUST_FREE || *cp2 >= CLUST_RSRVD) {
@@ -339,11 +322,8 @@ clustdiffer(cl, cp1, cp2, fatnum)
* into the first one.
*/
int
-comparefat(boot, first, second, fatnum)
- struct bootblock *boot;
- struct fatEntry *first;
- struct fatEntry *second;
- int fatnum;
+comparefat(struct bootblock *boot, struct fatEntry *first,
+ struct fatEntry *second, int fatnum)
{
cl_t cl;
int ret = FSOK;
@@ -355,10 +335,7 @@ comparefat(boot, first, second, fatnum)
}
void
-clearchain(boot, fat, head)
- struct bootblock *boot;
- struct fatEntry *fat;
- cl_t head;
+clearchain(struct bootblock *boot, struct fatEntry *fat, cl_t head)
{
cl_t p, q;
@@ -372,11 +349,7 @@ clearchain(boot, fat, head)
}
int
-tryclear(boot, fat, head, trunc)
- struct bootblock *boot;
- struct fatEntry *fat;
- cl_t head;
- cl_t *trunc;
+tryclear(struct bootblock *boot, struct fatEntry *fat, cl_t head, cl_t *trunc)
{
if (ask(0, "Clear chain starting at %u", head)) {
clearchain(boot, fat, head);
@@ -392,9 +365,7 @@ tryclear(boot, fat, head, trunc)
* Check a complete FAT in-memory for crosslinks
*/
int
-checkfat(boot, fat)
- struct bootblock *boot;
- struct fatEntry *fat;
+checkfat(struct bootblock *boot, struct fatEntry *fat)
{
cl_t head, p, h, n;
u_int len;
@@ -488,11 +459,7 @@ checkfat(boot, fat)
* Write out FATs encoding them from the internal format
*/
int
-writefat(fs, boot, fat, correct_fat)
- int fs;
- struct bootblock *boot;
- struct fatEntry *fat;
- int correct_fat;
+writefat(int fs, struct bootblock *boot, struct fatEntry *fat, int correct_fat)
{
u_char *buffer, *p;
cl_t cl;
@@ -600,10 +567,7 @@ writefat(fs, boot, fat, correct_fat)
* Check a complete in-memory FAT for lost cluster chains
*/
int
-checklost(dosfs, boot, fat)
- int dosfs;
- struct bootblock *boot;
- struct fatEntry *fat;
+checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat)
{
cl_t head;
int mod = FSOK;
diff --git a/sbin/fsck_msdosfs/main.c b/sbin/fsck_msdosfs/main.c
index 3591467..110b360 100644
--- a/sbin/fsck_msdosfs/main.c
+++ b/sbin/fsck_msdosfs/main.c
@@ -44,11 +44,7 @@ static const char rcsid[] =
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
-#if __STDC__
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include "fsutil.h"
#include "ext.h"
@@ -58,8 +54,7 @@ int alwaysyes; /* assume "yes" for all questions */
int preen; /* set when preening */
int rdonly; /* device is opened read only (supersedes above) */
-static void usage __P((void));
-int main __P((int, char **));
+static void usage(void) __dead2;
static void
usage()
@@ -68,9 +63,7 @@ usage()
}
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
int ret = 0, erg;
int ch;
@@ -125,14 +118,7 @@ main(argc, argv)
/*VARARGS*/
int
-#if __STDC__
ask(int def, const char *fmt, ...)
-#else
-ask(def, fmt, va_alist)
- int def;
- char *fmt;
- va_dcl
-#endif
{
va_list ap;
@@ -147,11 +133,7 @@ ask(def, fmt, va_alist)
return def;
}
-#if __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
vsnprintf(prompt, sizeof(prompt), fmt, ap);
if (alwaysyes || rdonly) {
printf("%s? %s\n", prompt, rdonly ? "no" : "yes");
OpenPOWER on IntegriCloud