diff options
author | Rob Landley <rob@landley.net> | 2006-03-10 22:22:06 +0300 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-03-10 22:22:06 +0300 |
commit | bc68cd14ccaebc17e7e03a08e51fddfb91007624 (patch) | |
tree | beb32cedafc6232bf8a49fe90f0769d471ea6791 /util-linux | |
parent | dae6aa28598cb2353291f18ca52e768c3259165a (diff) |
Patch from Denis Vlasenko turning static const int (which gets emitted into
the busybox binary) into enums (which don't).
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/fbset.c | 28 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 51 | ||||
-rw-r--r-- | util-linux/getopt.c | 8 | ||||
-rw-r--r-- | util-linux/mkswap.c | 2 | ||||
-rw-r--r-- | util-linux/nfsmount.c | 64 |
5 files changed, 84 insertions, 69 deletions
diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 2e895be8d..d2667cf84 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -38,11 +38,11 @@ #define DEFAULTFBDEV FB_0 #define DEFAULTFBMODE "/etc/fb.modes" -static const int OPT_CHANGE = (1 << 0); -static const int OPT_INFO = (1 << 1); -static const int OPT_READMODE = (1 << 2); - enum { + OPT_CHANGE = (1 << 0), + OPT_INFO = (1 << 1), + OPT_READMODE = (1 << 2), + CMD_FB = 1, CMD_DB = 2, CMD_GEOMETRY = 3, @@ -84,8 +84,10 @@ enum { static unsigned int g_options = 0; /* Stuff stolen from the kernel's fb.h */ -static const int FBIOGET_VSCREENINFO = 0x4600; -static const int FBIOPUT_VSCREENINFO = 0x4601; +enum { + FBIOGET_VSCREENINFO = 0x4600, + FBIOPUT_VSCREENINFO = 0x4601 +}; struct fb_bitfield { uint32_t offset; /* beginning of bitfield */ uint32_t length; /* length of bitfield */ @@ -179,12 +181,14 @@ static const struct cmdoptions_t { #ifdef CONFIG_FEATURE_FBSET_READMODE /* taken from linux/fb.h */ -static const int FB_VMODE_INTERLACED = 1; /* interlaced */ -static const int FB_VMODE_DOUBLE = 2; /* double scan */ -static const int FB_SYNC_HOR_HIGH_ACT = 1; /* horizontal sync high active */ -static const int FB_SYNC_VERT_HIGH_ACT = 2; /* vertical sync high active */ -static const int FB_SYNC_EXT = 4; /* external sync */ -static const int FB_SYNC_COMP_HIGH_ACT = 8; /* composite sync high active */ +enum { + FB_VMODE_INTERLACED = 1, /* interlaced */ + FB_VMODE_DOUBLE = 2, /* double scan */ + FB_SYNC_HOR_HIGH_ACT = 1, /* horizontal sync high active */ + FB_SYNC_VERT_HIGH_ACT = 2, /* vertical sync high active */ + FB_SYNC_EXT = 4, /* external sync */ + FB_SYNC_COMP_HIGH_ACT = 8 /* composite sync high active */ +}; #endif static int readmode(struct fb_var_screeninfo *base, const char *fn, const char *mode) diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 1d3e90aa8..d7d81f130 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c @@ -98,26 +98,8 @@ #include <sys/param.h> #include "busybox.h" -static const int MINIX_ROOT_INO = 1; -static const int MINIX_LINK_MAX = 250; -static const int MINIX2_LINK_MAX = 65530; - -static const int MINIX_I_MAP_SLOTS = 8; -static const int MINIX_Z_MAP_SLOTS = 64; -static const int MINIX_SUPER_MAGIC = 0x137F; /* original minix fs */ -static const int MINIX_SUPER_MAGIC2 = 0x138F; /* minix fs, 30 char names */ -static const int MINIX2_SUPER_MAGIC = 0x2468; /* minix V2 fs */ -static const int MINIX2_SUPER_MAGIC2 = 0x2478; /* minix V2 fs, 30 char names */ -static const int MINIX_VALID_FS = 0x0001; /* Clean fs. */ -static const int MINIX_ERROR_FS = 0x0002; /* fs has errors. */ - -#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) -#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode))) - -static const int MINIX_V1 = 0x0001; /* original minix fs */ -static const int MINIX_V2 = 0x0002; /* minix V2 fs */ - -#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version +#define BLOCK_SIZE_BITS 10 +#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) /* * This is the original minix inode layout on disk. @@ -151,6 +133,29 @@ struct minix2_inode { uint32_t i_zone[10]; }; +enum { + MINIX_ROOT_INO = 1, + MINIX_LINK_MAX = 250, + MINIX2_LINK_MAX = 65530, + + MINIX_I_MAP_SLOTS = 8, + MINIX_Z_MAP_SLOTS = 64, + MINIX_SUPER_MAGIC = 0x137F, /* original minix fs */ + MINIX_SUPER_MAGIC2 = 0x138F, /* minix fs, 30 char names */ + MINIX2_SUPER_MAGIC = 0x2468, /* minix V2 fs */ + MINIX2_SUPER_MAGIC2 = 0x2478, /* minix V2 fs, 30 char names */ + MINIX_VALID_FS = 0x0001, /* Clean fs. */ + MINIX_ERROR_FS = 0x0002, /* fs has errors. */ + + MINIX_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix_inode))), + MINIX2_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix2_inode))), + + MINIX_V1 = 0x0001, /* original minix fs */ + MINIX_V2 = 0x0002 /* minix V2 fs */ +}; + +#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version + /* * minix super-block data on disk */ @@ -172,8 +177,6 @@ struct minix_dir_entry { char name[0]; }; -#define BLOCK_SIZE_BITS 10 -#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) #define NAME_MAX 255 /* # chars in a file name */ @@ -187,7 +190,7 @@ struct minix_dir_entry { #define volatile #endif -static const int ROOT_INO = 1; +enum { ROOT_INO = 1 }; #define UPPER(size,n) ((size+((n)-1))/(n)) #define INODE_SIZE (sizeof(struct minix_inode)) @@ -219,7 +222,7 @@ static struct termios termios; static int termios_set = 0; /* File-name data */ -static const int MAX_DEPTH = 32; +enum { MAX_DEPTH = 32 }; static int name_depth = 0; // static char name_list[MAX_DEPTH][BUFSIZ + 1]; static char **name_list = NULL; diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 16dcbbca0..9e33b79bf 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -53,9 +53,11 @@ /* NON_OPT is the code that is returned when a non-option is found in '+' mode */ -static const int NON_OPT = 1; +enum { + NON_OPT = 1, /* LONG_OPT is the code that is returned when a long option is found. */ -static const int LONG_OPT = 2; + LONG_OPT = 2 +}; /* The shells recognized. */ typedef enum {BASH,TCSH} shell_t; @@ -195,7 +197,7 @@ int generate_output(char * argv[],int argc,const char *optstr, static struct option *long_options; static int long_options_length; /* Length of array */ static int long_options_nr; /* Nr of used elements in array */ -static const int LONG_OPTIONS_INCR = 10; +enum { LONG_OPTIONS_INCR = 10 }; #define init_longopt() add_longopt(NULL,0) /* Register a long option. The contents of name is copied. */ diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index e203f0db6..4107329a6 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -48,7 +48,7 @@ #ifndef _IO /* pre-1.3.45 */ -static const int BLKGETSIZE = 0x1260; +enum { BLKGETSIZE = 0x1260 }; #else /* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */ #define BLKGETSIZE _IO(0x12,96) diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index a51fe817e..1acec606f 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c @@ -105,13 +105,14 @@ enum nfs_stat { #define NFS_PROGRAM 100003 - +enum { #ifndef NFS_FHSIZE -static const int NFS_FHSIZE = 32; + NFS_FHSIZE = 32, #endif #ifndef NFS_PORT -static const int NFS_PORT = 2049; + NFS_PORT = 2049 #endif +}; /* Disable the nls stuff */ # undef bindtextdomain @@ -119,19 +120,21 @@ static const int NFS_PORT = 2049; # undef textdomain # define textdomain(Domain) /* empty */ -static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */ -static const int MS_RDONLY = 1; /* Mount read-only */ -static const int MS_NOSUID = 2; /* Ignore suid and sgid bits */ -static const int MS_NODEV = 4; /* Disallow access to device special files */ -static const int MS_NOEXEC = 8; /* Disallow program execution */ -static const int MS_SYNCHRONOUS = 16; /* Writes are synced at once */ -static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS */ -static const int MS_MANDLOCK = 64; /* Allow mandatory locks on an FS */ -static const int S_QUOTA = 128; /* Quota initialized for file/directory/symlink */ -static const int S_APPEND = 256; /* Append-only file */ -static const int S_IMMUTABLE = 512; /* Immutable file */ -static const int MS_NOATIME = 1024; /* Do not update access times. */ -static const int MS_NODIRATIME = 2048; /* Do not update directory access times */ +enum { + MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */ + MS_RDONLY = 1, /* Mount read-only */ + MS_NOSUID = 2, /* Ignore suid and sgid bits */ + MS_NODEV = 4, /* Disallow access to device special files */ + MS_NOEXEC = 8, /* Disallow program execution */ + MS_SYNCHRONOUS = 16, /* Writes are synced at once */ + MS_REMOUNT = 32, /* Alter flags of a mounted FS */ + MS_MANDLOCK = 64, /* Allow mandatory locks on an FS */ + S_QUOTA = 128, /* Quota initialized for file/directory/symlink */ + S_APPEND = 256, /* Append-only file */ + S_IMMUTABLE = 512, /* Immutable file */ + MS_NOATIME = 1024, /* Do not update access times. */ + MS_NODIRATIME = 2048 /* Do not update directory access times */ +}; /* @@ -177,17 +180,18 @@ struct nfs_mount_data { }; /* bits in the flags field */ - -static const int NFS_MOUNT_SOFT = 0x0001; /* 1 */ -static const int NFS_MOUNT_INTR = 0x0002; /* 1 */ -static const int NFS_MOUNT_SECURE = 0x0004; /* 1 */ -static const int NFS_MOUNT_POSIX = 0x0008; /* 1 */ -static const int NFS_MOUNT_NOCTO = 0x0010; /* 1 */ -static const int NFS_MOUNT_NOAC = 0x0020; /* 1 */ -static const int NFS_MOUNT_TCP = 0x0040; /* 2 */ -static const int NFS_MOUNT_VER3 = 0x0080; /* 3 */ -static const int NFS_MOUNT_KERBEROS = 0x0100; /* 3 */ -static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */ +enum { + NFS_MOUNT_SOFT = 0x0001, /* 1 */ + NFS_MOUNT_INTR = 0x0002, /* 1 */ + NFS_MOUNT_SECURE = 0x0004, /* 1 */ + NFS_MOUNT_POSIX = 0x0008, /* 1 */ + NFS_MOUNT_NOCTO = 0x0010, /* 1 */ + NFS_MOUNT_NOAC = 0x0020, /* 1 */ + NFS_MOUNT_TCP = 0x0040, /* 2 */ + NFS_MOUNT_VER3 = 0x0080, /* 3 */ + NFS_MOUNT_KERBEROS = 0x0100, /* 3 */ + NFS_MOUNT_NONLM = 0x0200 /* 3 */ +}; #define UTIL_LINUX_VERSION "2.10m" @@ -213,8 +217,10 @@ static char *nfs_strerror(int status); #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) -static const int EX_FAIL = 32; /* mount failure */ -static const int EX_BG = 256; /* retry in background (internal only) */ +enum { + EX_FAIL = 32, /* mount failure */ + EX_BG = 256 /* retry in background (internal only) */ +}; /* |