svn commit: r317746 - in head/usr.sbin/makefs: . ffs

Ed Maste emaste at FreeBSD.org
Wed May 3 14:57:06 UTC 2017


Author: emaste
Date: Wed May  3 14:57:04 2017
New Revision: 317746
URL: https://svnweb.freebsd.org/changeset/base/317746

Log:
  makefs: clean up warnings
  
  - make functions and variables static where appropriate
  - use const char * where appropriate
  - remove unused variables
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/makefs/cd9660.c
  head/usr.sbin/makefs/ffs/buf.c
  head/usr.sbin/makefs/ffs/mkfs.c
  head/usr.sbin/makefs/makefs.c

Modified: head/usr.sbin/makefs/cd9660.c
==============================================================================
--- head/usr.sbin/makefs/cd9660.c	Wed May  3 14:53:27 2017	(r317745)
+++ head/usr.sbin/makefs/cd9660.c	Wed May  3 14:57:04 2017	(r317746)
@@ -1498,7 +1498,7 @@ cd9660_free_structure(cd9660node *root)
  * instead of having the TAILQ_ENTRY as part of the cd9660node,
  * just create a temporary structure
  */
-struct ptq_entry
+static struct ptq_entry
 {
 	TAILQ_ENTRY(ptq_entry) ptq;
 	cd9660node *node;

Modified: head/usr.sbin/makefs/ffs/buf.c
==============================================================================
--- head/usr.sbin/makefs/ffs/buf.c	Wed May  3 14:53:27 2017	(r317745)
+++ head/usr.sbin/makefs/ffs/buf.c	Wed May  3 14:57:04 2017	(r317746)
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
 #include "makefs.h"
 #include "buf.h"
 
-TAILQ_HEAD(buftailhead,buf) buftail;
+static TAILQ_HEAD(buftailhead,buf) buftail;
 
 int
 bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused,

Modified: head/usr.sbin/makefs/ffs/mkfs.c
==============================================================================
--- head/usr.sbin/makefs/ffs/mkfs.c	Wed May  3 14:53:27 2017	(r317745)
+++ head/usr.sbin/makefs/ffs/mkfs.c	Wed May  3 14:57:04 2017	(r317746)
@@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$");
 #define	BBSIZE	8192			/* size of boot area, with label */
 #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 count_digits(int);
@@ -78,23 +78,22 @@ static int count_digits(int);
 #define	UMASK		0755
 #define	POWEROF2(num)	(((num) & ((num) - 1)) == 0)
 
-union {
+static union {
 	struct fs fs;
 	char pad[SBLOCKSIZE];
 } fsun;
 #define	sblock	fsun.fs
-struct	csum *fscs;
 
-union {
+static union {
 	struct cg cg;
 	char pad[FFS_MAXBSIZE];
 } cgun;
 #define	acg	cgun.cg
 
-char *iobuf;
-int iobufsize;
+static char *iobuf;
+static int iobufsize;
 
-char writebuf[FFS_MAXBSIZE];
+static char writebuf[FFS_MAXBSIZE];
 
 static int     Oflag;	   /* format as an 4.3BSD file system */
 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)
 {
 	int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg;
-	int32_t cylno, i, csfrags;
+	int32_t csfrags;
+	uint32_t i, cylno;
 	long long sizepb;
 	void *space;
 	int size;
@@ -537,7 +537,8 @@ ffs_mkfs(const char *fsys, const fsinfo_
 void
 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;
 	char *wrbuf;
 
@@ -579,10 +580,11 @@ ffs_write_superblock(struct fs *fs, cons
  * Initialize a cylinder group.
  */
 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;
-	int32_t i, j, d, dlower, dupper, blkno;
+	int32_t blkno;
+	uint32_t i, j, d, dlower, dupper;
 	struct ufs1_dinode *dp1;
 	struct ufs2_dinode *dp2;
 	int start;
@@ -643,7 +645,7 @@ initcg(int cylno, time_t utime, const fs
 		acg.cg_nextfreeoff = acg.cg_clusteroff +
 		    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");
 		exit(37);
 	}

Modified: head/usr.sbin/makefs/makefs.c
==============================================================================
--- head/usr.sbin/makefs/makefs.c	Wed May  3 14:53:27 2017	(r317745)
+++ head/usr.sbin/makefs/makefs.c	Wed May  3 14:57:04 2017	(r317746)
@@ -95,8 +95,8 @@ main(int argc, char *argv[])
 	fsinfo_t	 fsoptions;
 	fsnode		*root;
 	int	 	 ch, i, len;
-	char		*subtree;
-	char		*specfile;
+	const char	*subtree;
+	const char	*specfile;
 
 	setprogname(argv[0]);
 


More information about the svn-src-all mailing list