makefs: clean up warnings

- make functions and variables static where appropriate
- use const char * where appropriate
- remove unused variables

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2017-05-03 14:57:04 +00:00
parent c36036beff
commit 9e96f90b50
4 changed files with 18 additions and 16 deletions

View File

@ -1498,7 +1498,7 @@ cd9660_free_structure(cd9660node *root)
* instead of having the TAILQ_ENTRY as part of the cd9660node, * instead of having the TAILQ_ENTRY as part of the cd9660node,
* just create a temporary structure * just create a temporary structure
*/ */
struct ptq_entry static struct ptq_entry
{ {
TAILQ_ENTRY(ptq_entry) ptq; TAILQ_ENTRY(ptq_entry) ptq;
cd9660node *node; cd9660node *node;

View File

@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
#include "makefs.h" #include "makefs.h"
#include "buf.h" #include "buf.h"
TAILQ_HEAD(buftailhead,buf) buftail; static TAILQ_HEAD(buftailhead,buf) buftail;
int int
bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused, bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused,

View File

@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$");
#define BBSIZE 8192 /* size of boot area, with label */ #define BBSIZE 8192 /* size of boot area, with label */
#endif #endif
static void initcg(int, time_t, const fsinfo_t *); static void initcg(uint32_t, time_t, const fsinfo_t *);
static int ilog2(int); static int ilog2(int);
static int count_digits(int); static int count_digits(int);
@ -78,23 +78,22 @@ static int count_digits(int);
#define UMASK 0755 #define UMASK 0755
#define POWEROF2(num) (((num) & ((num) - 1)) == 0) #define POWEROF2(num) (((num) & ((num) - 1)) == 0)
union { static union {
struct fs fs; struct fs fs;
char pad[SBLOCKSIZE]; char pad[SBLOCKSIZE];
} fsun; } fsun;
#define sblock fsun.fs #define sblock fsun.fs
struct csum *fscs;
union { static union {
struct cg cg; struct cg cg;
char pad[FFS_MAXBSIZE]; char pad[FFS_MAXBSIZE];
} cgun; } cgun;
#define acg cgun.cg #define acg cgun.cg
char *iobuf; static char *iobuf;
int iobufsize; static int iobufsize;
char writebuf[FFS_MAXBSIZE]; static char writebuf[FFS_MAXBSIZE];
static int Oflag; /* format as an 4.3BSD file system */ static int Oflag; /* format as an 4.3BSD file system */
static int64_t fssize; /* file system size */ static int64_t fssize; /* file system size */
@ -117,7 +116,8 @@ struct fs *
ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp)
{ {
int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg; int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg;
int32_t cylno, i, csfrags; int32_t csfrags;
uint32_t i, cylno;
long long sizepb; long long sizepb;
void *space; void *space;
int size; int size;
@ -537,7 +537,8 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp)
void void
ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts) ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts)
{ {
int cylno, size, blks, i, saveflag; int size, blks, i, saveflag;
uint32_t cylno;
void *space; void *space;
char *wrbuf; char *wrbuf;
@ -579,10 +580,11 @@ ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts)
* Initialize a cylinder group. * Initialize a cylinder group.
*/ */
static void static void
initcg(int cylno, time_t utime, const fsinfo_t *fsopts) initcg(uint32_t cylno, time_t utime, const fsinfo_t *fsopts)
{ {
daddr_t cbase, dmax; daddr_t cbase, dmax;
int32_t i, j, d, dlower, dupper, blkno; int32_t blkno;
uint32_t i, j, d, dlower, dupper;
struct ufs1_dinode *dp1; struct ufs1_dinode *dp1;
struct ufs2_dinode *dp2; struct ufs2_dinode *dp2;
int start; int start;
@ -643,7 +645,7 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts)
acg.cg_nextfreeoff = acg.cg_clusteroff + acg.cg_nextfreeoff = acg.cg_clusteroff +
howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT);
} }
if (acg.cg_nextfreeoff > sblock.fs_cgsize) { if (acg.cg_nextfreeoff > (uint32_t)sblock.fs_cgsize) {
printf("Panic: cylinder group too big\n"); printf("Panic: cylinder group too big\n");
exit(37); exit(37);
} }

View File

@ -95,8 +95,8 @@ main(int argc, char *argv[])
fsinfo_t fsoptions; fsinfo_t fsoptions;
fsnode *root; fsnode *root;
int ch, i, len; int ch, i, len;
char *subtree; const char *subtree;
char *specfile; const char *specfile;
setprogname(argv[0]); setprogname(argv[0]);