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.
This commit is contained in:
ed 2011-11-04 13:36:02 +00:00
parent 89ec155d24
commit 5b02333e84
31 changed files with 48 additions and 49 deletions

View File

@ -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),

View File

@ -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 },

View File

@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include "private.h"
/* verbosity level */
int verbose;
static int verbose;
/* notitle option */
static int notitle;

View File

@ -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);

View File

@ -140,7 +140,7 @@ static const char smppc_opts[] = "a:A:d:lm:M:o:p:s:S:T:";
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 @@ smpreportgeneral(struct cam_device *device, int argc, char **argv,
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},

View File

@ -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[] = {

View File

@ -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)

View File

@ -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 },
};

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -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[])

View File

@ -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. */
/*

View File

@ -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;

View File

@ -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;

View File

@ -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
};

View File

@ -68,7 +68,7 @@ static const char rcsid[] =
#include "mntopts.h"
struct mntopt mopts[] = {
static struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_UPDATE,
MOPT_END

View File

@ -57,7 +57,7 @@ static const char rcsid[] =
#include "mntopts.h"
struct mntopt mopts[] = {
static struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_END
};

View File

@ -61,7 +61,7 @@
#include "mntopts.h"
struct mntopt mopts[] = {
static struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_UPDATE,
MOPT_END

View File

@ -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

View File

@ -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, ".." },
};

View File

@ -81,6 +81,7 @@ extern int Nflag; /* run mkfs without writing file system */
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 */

View File

@ -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

View File

@ -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;

View File

@ -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 },

View File

@ -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)

View File

@ -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

View File

@ -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 **);