Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Nov 2011 13:36:02 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r227081 - in head/sbin: atm/atmconfig badsect camcontrol ccdconfig devfs dmesg dumpfs fdisk ffsinfo fsck fsck_msdosfs fsirand growfs init mount mount_cd9660 mount_nullfs mount_udf natd ...
Message-ID:  <201111041336.pA4Da2M8020263@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Fri Nov  4 13:36:02 2011
New Revision: 227081
URL: http://svn.freebsd.org/changeset/base/227081

Log:
  Add missing static keywords for global variables to tools in sbin/.
  
  These tools declare global variables without using the static keyword,
  even though their use is limited to a single C-file, or without placing
  an extern declaration of them in the proper header file.

Modified:
  head/sbin/atm/atmconfig/atmconfig_device.c
  head/sbin/atm/atmconfig/diag.c
  head/sbin/atm/atmconfig/main.c
  head/sbin/badsect/badsect.c
  head/sbin/camcontrol/camcontrol.c
  head/sbin/ccdconfig/ccdconfig.c
  head/sbin/devfs/rule.c
  head/sbin/dmesg/dmesg.c
  head/sbin/dumpfs/dumpfs.c
  head/sbin/fdisk/fdisk.c
  head/sbin/ffsinfo/ffsinfo.c
  head/sbin/fsck/fsck.c
  head/sbin/fsck/preen.c
  head/sbin/fsck_msdosfs/dir.c
  head/sbin/fsirand/fsirand.c
  head/sbin/growfs/growfs.c
  head/sbin/init/init.c
  head/sbin/mount/mount.c
  head/sbin/mount/mount_fs.c
  head/sbin/mount_cd9660/mount_cd9660.c
  head/sbin/mount_nullfs/mount_nullfs.c
  head/sbin/mount_udf/mount_udf.c
  head/sbin/natd/natd.c
  head/sbin/newfs/mkfs.c
  head/sbin/newfs/newfs.h
  head/sbin/rcorder/rcorder.c
  head/sbin/recoverdisk/recoverdisk.c
  head/sbin/shutdown/shutdown.c
  head/sbin/swapon/swapon.c
  head/sbin/tunefs/tunefs.c
  head/sbin/umount/umount.c

Modified: head/sbin/atm/atmconfig/atmconfig_device.c
==============================================================================
--- head/sbin/atm/atmconfig/atmconfig_device.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/atm/atmconfig/atmconfig_device.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -103,7 +103,7 @@ static struct atmhw_list atmhw_list;
 /*
  * Read ATM hardware table
  */
-const struct snmp_table atmhw_table = {
+static const struct snmp_table atmhw_table = {
 	OIDX_begemotAtmHWTable,
 	OIDX_begemotAtmIfTableLastChange, 2,
 	sizeof(struct atmhw),

Modified: head/sbin/atm/atmconfig/diag.c
==============================================================================
--- head/sbin/atm/atmconfig/diag.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/atm/atmconfig/diag.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -57,7 +57,7 @@ static void diag_phy_print(int, char *[]
 static void diag_phy_stats(int, char *[]);
 static void diag_stats(int, char *[]);
 
-const struct cmdtab diag_phy_tab[] = {
+static const struct cmdtab diag_phy_tab[] = {
 	{ "show",	NULL, 		diag_phy_show },
 	{ "set",	NULL, 		diag_phy_set },
 	{ "stats",	NULL,		diag_phy_stats },

Modified: head/sbin/atm/atmconfig/main.c
==============================================================================
--- head/sbin/atm/atmconfig/main.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/atm/atmconfig/main.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
 #include "private.h"
 
 /* verbosity level */
-int verbose;
+static int verbose;
 
 /* notitle option */
 static int notitle;

Modified: head/sbin/badsect/badsect.c
==============================================================================
--- head/sbin/badsect/badsect.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/badsect/badsect.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -71,9 +71,9 @@ __FBSDID("$FreeBSD$");
 
 #define sblock	disk.d_fs
 #define	acg	disk.d_cg
-struct	uufsd disk;
-struct	fs *fs = &sblock;
-int	errs;
+static struct	uufsd disk;
+static struct	fs *fs = &sblock;
+static int	errs;
 
 int	chkuse(daddr_t, int);
 

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/camcontrol/camcontrol.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -140,7 +140,7 @@ static const char smppc_opts[] = "a:A:d:
 static const char smpphylist_opts[] = "lq";
 #endif
 
-struct camcontrol_opts option_table[] = {
+static struct camcontrol_opts option_table[] = {
 #ifndef MINIMALISTIC
 	{"tur", CAM_CMD_TUR, CAM_ARG_NONE, NULL},
 	{"inquiry", CAM_CMD_INQUIRY, CAM_ARG_NONE, "DSR"},
@@ -207,8 +207,8 @@ struct cam_devlist {
 	path_id_t path_id;
 };
 
-cam_cmdmask cmdlist;
-cam_argmask arglist;
+static cam_cmdmask cmdlist;
+static cam_argmask arglist;
 
 camcontrol_optret getoption(struct camcontrol_opts *table, char *arg,
 			    uint32_t *cmdnum, cam_argmask *argnum,
@@ -4646,7 +4646,7 @@ bailout:
 	return (error);
 }
 
-struct camcontrol_opts phy_ops[] = {
+static struct camcontrol_opts phy_ops[] = {
 	{"nop", SMP_PC_PHY_OP_NOP, CAM_ARG_NONE, NULL},
 	{"linkreset", SMP_PC_PHY_OP_LINK_RESET, CAM_ARG_NONE, NULL},
 	{"hardreset", SMP_PC_PHY_OP_HARD_RESET, CAM_ARG_NONE, NULL},

Modified: head/sbin/ccdconfig/ccdconfig.c
==============================================================================
--- head/sbin/ccdconfig/ccdconfig.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/ccdconfig/ccdconfig.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -59,7 +59,7 @@ static	int lineno = 0;
 static	int verbose = 0;
 static	const char *ccdconf = _PATH_CCDCONF;
 
-struct	flagval {
+static struct flagval {
 	const char	*fv_flag;
 	int		fv_val;
 } flagvaltab[] = {

Modified: head/sbin/devfs/rule.c
==============================================================================
--- head/sbin/devfs/rule.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/devfs/rule.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -76,7 +76,7 @@ static struct intstr ist_type[] = {
 	{ NULL,			-1 }
 };
 
-devfs_rsnum in_rsnum;
+static devfs_rsnum in_rsnum;
 
 int
 rule_main(int ac, char **av)

Modified: head/sbin/dmesg/dmesg.c
==============================================================================
--- head/sbin/dmesg/dmesg.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/dmesg/dmesg.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -60,11 +60,9 @@ __FBSDID("$FreeBSD$");
 #include <vis.h>
 #include <sys/syslog.h>
 
-char s_msgbufp[] = "_msgbufp";
-
-struct nlist nl[] = {
+static struct nlist nl[] = {
 #define	X_MSGBUF	0
-	{ s_msgbufp, 0, 0, 0, 0 },
+	{ "_msgbufp", 0, 0, 0, 0 },
 	{ NULL, 0, 0, 0, 0 },
 };
 

Modified: head/sbin/dumpfs/dumpfs.c
==============================================================================
--- head/sbin/dumpfs/dumpfs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/dumpfs/dumpfs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -77,7 +77,7 @@ static const char rcsid[] =
 #define	afs	disk.d_fs
 #define	acg	disk.d_cg
 
-struct uufsd disk;
+static struct uufsd disk;
 
 int	dumpfs(const char *);
 int	dumpfsid(void);

Modified: head/sbin/fdisk/fdisk.c
==============================================================================
--- head/sbin/fdisk/fdisk.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fdisk/fdisk.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <unistd.h>
 
-int iotest;
+static int iotest;
 
 #define NO_DISK_SECTORS ((u_int32_t)-1)
 #define NO_TRACK_CYLINDERS 1023

Modified: head/sbin/ffsinfo/ffsinfo.c
==============================================================================
--- head/sbin/ffsinfo/ffsinfo.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/ffsinfo/ffsinfo.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -79,7 +79,7 @@ static const char rcsid[] =
 int	_dbg_lvl_ = (DL_INFO); /* DL_TRC */
 #endif /* FS_DEBUG */
 
-struct uufsd disk;
+static struct uufsd disk;
 
 #define sblock disk.d_fs
 #define acg    disk.d_cg

Modified: head/sbin/fsck/fsck.c
==============================================================================
--- head/sbin/fsck/fsck.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fsck/fsck.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
 
 static enum { IN_LIST, NOT_IN_LIST } which = NOT_IN_LIST;
 
-TAILQ_HEAD(fstypelist, entry) opthead, selhead;
+static TAILQ_HEAD(fstypelist, entry) opthead, selhead;
 
 struct entry {
 	char *type;

Modified: head/sbin/fsck/preen.c
==============================================================================
--- head/sbin/fsck/preen.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fsck/preen.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -62,7 +62,7 @@ struct partentry {
 	char		  	*p_type;	/* file system type */
 };
 
-TAILQ_HEAD(part, partentry) badh;
+static TAILQ_HEAD(part, partentry) badh;
 
 struct diskentry {
 	TAILQ_ENTRY(diskentry) 	    d_entries;
@@ -71,7 +71,7 @@ struct diskentry {
 	int			    d_pid;	/* 0 or pid of fsck proc */
 };
 
-TAILQ_HEAD(disk, diskentry) diskh;
+static TAILQ_HEAD(disk, diskentry) diskh;
 
 static int nrun = 0, ndisks = 0;
 

Modified: head/sbin/fsck_msdosfs/dir.c
==============================================================================
--- head/sbin/fsck_msdosfs/dir.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fsck_msdosfs/dir.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -153,7 +153,7 @@ freeDirTodo(struct dirTodoNode *dt)
 /*
  * The stack of unread directories
  */
-struct dirTodoNode *pendingDirectories = NULL;
+static struct dirTodoNode *pendingDirectories = NULL;
 
 /*
  * Return the full pathname for a directory entry.

Modified: head/sbin/fsirand/fsirand.c
==============================================================================
--- head/sbin/fsirand/fsirand.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fsirand/fsirand.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -60,7 +60,7 @@ int fsirand(char *);
  */
 static int sblock_try[] = SBLOCKSEARCH;
 
-int printonly = 0, force = 0, ignorelabel = 0;
+static int printonly = 0, force = 0, ignorelabel = 0;
 
 int
 main(int argc, char *argv[])

Modified: head/sbin/growfs/growfs.c
==============================================================================
--- head/sbin/growfs/growfs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/growfs/growfs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -116,7 +116,7 @@ union dinode {
 	} while (0)
 static ufs2_daddr_t 	inoblk;			/* inode block address */
 static char		inobuf[MAXBSIZE];	/* inode block */
-ino_t			maxino;			/* last valid inode */
+static ino_t		maxino;			/* last valid inode */
 static int		unlabeled;     /* unlabeled partition, e.g. vinum volume etc. */
 
 /*

Modified: head/sbin/init/init.c
==============================================================================
--- head/sbin/init/init.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/init/init.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -126,14 +126,14 @@ static state_func_t death_single(void);
 
 static state_func_t run_script(const char *);
 
-enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT;
+static enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT;
 #define FALSE	0
 #define TRUE	1
 
-int Reboot = FALSE;
-int howto = RB_AUTOBOOT;
+static int Reboot = FALSE;
+static int howto = RB_AUTOBOOT;
 
-int devfs;
+static int devfs;
 
 static void transition(state_t);
 static state_t requested_transition;

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount/mount.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
 #define MOUNT_META_OPTION_FSTAB		"fstab"
 #define MOUNT_META_OPTION_CURRENT	"current"
 
-int debug, fstab_style, verbose;
+static int debug, fstab_style, verbose;
 
 struct cpa {
 	char	**a;

Modified: head/sbin/mount/mount_fs.c
==============================================================================
--- head/sbin/mount/mount_fs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount/mount_fs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -58,7 +58,7 @@ static const char rcsid[] =
 #include "extern.h"
 #include "mntopts.h"
 
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_END
 };

Modified: head/sbin/mount_cd9660/mount_cd9660.c
==============================================================================
--- head/sbin/mount_cd9660/mount_cd9660.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount_cd9660/mount_cd9660.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -68,7 +68,7 @@ static const char rcsid[] =
 
 #include "mntopts.h"
 
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_UPDATE,
 	MOPT_END

Modified: head/sbin/mount_nullfs/mount_nullfs.c
==============================================================================
--- head/sbin/mount_nullfs/mount_nullfs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount_nullfs/mount_nullfs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -57,7 +57,7 @@ static const char rcsid[] =
 
 #include "mntopts.h"
 
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_END
 };

Modified: head/sbin/mount_udf/mount_udf.c
==============================================================================
--- head/sbin/mount_udf/mount_udf.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount_udf/mount_udf.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -61,7 +61,7 @@
 
 #include "mntopts.h"
 
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_UPDATE,
 	MOPT_END

Modified: head/sbin/natd/natd.c
==============================================================================
--- head/sbin/natd/natd.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/natd/natd.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -71,8 +71,8 @@ struct instance {
 static LIST_HEAD(, instance) root = LIST_HEAD_INITIALIZER(root);
 
 struct libalias *mla;
-struct instance *mip;
-int ninstance = 1;
+static struct instance *mip;
+static int ninstance = 1;
 
 /* 
  * Default values for input and output

Modified: head/sbin/newfs/mkfs.c
==============================================================================
--- head/sbin/newfs/mkfs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/newfs/mkfs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -804,7 +804,7 @@ initcg(int cylno, time_t utime)
  */
 #define ROOTLINKCNT 3
 
-struct direct root_dir[] = {
+static struct direct root_dir[] = {
 	{ ROOTINO, sizeof(struct direct), DT_DIR, 1, "." },
 	{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
 	{ ROOTINO + 1, sizeof(struct direct), DT_DIR, 5, ".snap" },
@@ -812,7 +812,7 @@ struct direct root_dir[] = {
 
 #define SNAPLINKCNT 2
 
-struct direct snap_dir[] = {
+static struct direct snap_dir[] = {
 	{ ROOTINO + 1, sizeof(struct direct), DT_DIR, 1, "." },
 	{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
 };

Modified: head/sbin/newfs/newfs.h
==============================================================================
--- head/sbin/newfs/newfs.h	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/newfs/newfs.h	Fri Nov  4 13:36:02 2011	(r227081)
@@ -81,6 +81,7 @@ extern int	Nflag;		/* run mkfs without w
 extern int	Oflag;		/* build UFS1 format file system */
 extern int	Rflag;		/* regression test */
 extern int	Uflag;		/* enable soft updates for file system */
+extern int	jflag;		/* enable soft updates journaling for filesys */
 extern int	Xflag;		/* exit in middle of newfs for testing */
 extern int	Jflag;		/* enable gjournal for file system */
 extern int	lflag;		/* enable multilabel MAC for file system */

Modified: head/sbin/rcorder/rcorder.c
==============================================================================
--- head/sbin/rcorder/rcorder.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/rcorder/rcorder.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -73,9 +73,9 @@ int debug = 0;
 #define KEYWORDS_STR	"# KEYWORDS:"
 #define KEYWORDS_LEN	(sizeof(KEYWORDS_STR) - 1)
 
-int exit_code;
-int file_count;
-char **file_list;
+static int exit_code;
+static int file_count;
+static char **file_list;
 
 typedef int bool;
 #define TRUE 1

Modified: head/sbin/recoverdisk/recoverdisk.c
==============================================================================
--- head/sbin/recoverdisk/recoverdisk.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/recoverdisk/recoverdisk.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -24,7 +24,7 @@
 #include <time.h>
 #include <unistd.h>
 
-volatile sig_atomic_t aborting = 0;
+static volatile sig_atomic_t aborting = 0;
 static size_t bigsize = 1024 * 1024;
 static size_t medsize;
 static size_t minsize = 512;

Modified: head/sbin/shutdown/shutdown.c
==============================================================================
--- head/sbin/shutdown/shutdown.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/shutdown/shutdown.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$");
 #define	M		*60
 #define	S		*1
 #define	NOLOG_TIME	5*60
-struct interval {
+static struct interval {
 	int timeleft, timetowait;
 } tlist[] = {
 	{ 10 H,  5 H },

Modified: head/sbin/swapon/swapon.c
==============================================================================
--- head/sbin/swapon/swapon.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/swapon/swapon.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -60,7 +60,7 @@ static void usage(void);
 static int swap_on_off(char *name, int ignoreebusy);
 static void swaplist(int, int, int);
 
-enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL;
+static enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL;
 
 int
 main(int argc, char **argv)

Modified: head/sbin/tunefs/tunefs.c
==============================================================================
--- head/sbin/tunefs/tunefs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/tunefs/tunefs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
 /* the optimization warning string template */
 #define	OPTWARN	"should optimize for %s with minfree %s %d%%"
 
-struct uufsd disk;
+static struct uufsd disk;
 #define	sblock disk.d_fs
 
 void usage(void);
@@ -553,7 +553,7 @@ sbdirty(void)
 	disk.d_fs.fs_clean = 0;
 }
 
-int blocks;
+static int blocks;
 static char clrbuf[MAXBSIZE];
 
 static ufs2_daddr_t

Modified: head/sbin/umount/umount.c
==============================================================================
--- head/sbin/umount/umount.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/umount/umount.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -63,9 +63,9 @@ static const char rcsid[] =
 
 typedef enum { FIND, REMOVE, CHECKUNIQUE } dowhat;
 
-struct  addrinfo *nfshost_ai = NULL;
-int	fflag, vflag;
-char   *nfshost;
+static struct addrinfo *nfshost_ai = NULL;
+static int	fflag, vflag;
+static char	*nfshost;
 
 struct statfs *checkmntlist(char *);
 int	 checkvfsname (const char *, char **);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111041336.pA4Da2M8020263>