From bc68cd14ccaebc17e7e03a08e51fddfb91007624 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 10 Mar 2006 19:22:06 +0000 Subject: Patch from Denis Vlasenko turning static const int (which gets emitted into the busybox binary) into enums (which don't). --- archival/gzip.c | 12 +++--- archival/libunarchive/decompress_unzip.c | 2 +- console-tools/chvt.c | 6 ++- console-tools/deallocvt.c | 2 +- console-tools/loadfont.c | 16 ++++---- console-tools/setkeycodes.c | 4 +- coreutils/cut.c | 8 ++-- coreutils/stty.c | 13 ++++--- editors/awk.c | 2 +- editors/vi.c | 26 +++++++------ init/init.c | 25 +++++++------ libbb/get_console.c | 2 +- libbb/speed_table.c | 2 +- libbb/xreadlink.c | 2 +- modutils/insmod.c | 39 ++++++++++--------- modutils/lsmod.c | 24 ++++++------ networking/dnsd.c | 16 ++++---- networking/fakeidentd.c | 2 +- networking/ping.c | 16 ++++---- networking/ping6.c | 16 ++++---- networking/telnet.c | 14 +++---- networking/zcip.c | 24 ++++++------ shell/lash.c | 12 +++--- util-linux/fbset.c | 28 ++++++++------ util-linux/fsck_minix.c | 51 +++++++++++++------------ util-linux/getopt.c | 8 ++-- util-linux/mkswap.c | 2 +- util-linux/nfsmount.c | 64 +++++++++++++++++--------------- 28 files changed, 244 insertions(+), 194 deletions(-) diff --git a/archival/gzip.c b/archival/gzip.c index 783a453a7..fa6e85b66 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -732,25 +732,26 @@ static unsigned match_start; /* start of matching string */ static int eofile; /* flag set at end of input file */ static unsigned lookahead; /* number of valid bytes ahead in window */ -static const unsigned max_chain_length = 4096; +enum { + max_chain_length = 4096, /* To speed up deflation, hash chains are never searched beyond this length. * A higher limit improves compression ratio but degrades the speed. */ -static const unsigned int max_lazy_match = 258; + max_lazy_match = 258, /* Attempt to find a better match only when the current match is strictly * smaller than this value. This mechanism is used only for compression * levels >= 4. */ -#define max_insert_length max_lazy_match + max_insert_length = max_lazy_match, /* Insert new strings in the hash table only if the match length * is not greater than this length. This saves time but degrades compression. * max_insert_length is used only for compression levels <= 3. */ -static const unsigned good_match = 32; + good_match = 32, /* Use a faster search when the previous match is longer than this */ @@ -761,12 +762,13 @@ static const unsigned good_match = 32; * found for specific files. */ -static const int nice_match = 258; /* Stop searching when current match exceeds this */ + nice_match = 258 /* Stop searching when current match exceeds this */ /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different * meaning. */ +}; #define EQUAL 0 /* result of memcmp for equal strings */ diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 7776dee69..7c43bed12 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c @@ -92,7 +92,7 @@ static unsigned int gunzip_outbuf_count; /* bytes in output buffer */ /* gunzip_window size--must be a power of two, and * at least 32K for zip's deflate method */ -static const unsigned int gunzip_wsize = 0x8000; +enum { gunzip_wsize = 0x8000 }; static unsigned char *gunzip_window; static unsigned int *gunzip_crc_table; diff --git a/console-tools/chvt.c b/console-tools/chvt.c index b1a429eb3..252aed740 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c @@ -29,8 +29,10 @@ #include "busybox.h" /* From */ -static const int VT_ACTIVATE = 0x5606; /* make vt active */ -static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */ +enum { + VT_ACTIVATE = 0x5606, /* make vt active */ + VT_WAITACTIVE = 0x5607 /* wait for vt active */ +}; int chvt_main(int argc, char **argv) { diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index 00ddf4236..ad3cebfef 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c @@ -30,7 +30,7 @@ #include "busybox.h" /* From */ -static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */ +enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */ int deallocvt_main(int argc, char *argv[]) { diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 31c6d2495..31221e080 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c @@ -21,13 +21,15 @@ #include #include "busybox.h" -static const int PSF_MAGIC1 = 0x36; -static const int PSF_MAGIC2 = 0x04; - -static const int PSF_MODE512 = 0x01; -static const int PSF_MODEHASTAB = 0x02; -static const int PSF_MAXMODE = 0x03; -static const int PSF_SEPARATOR = 0xFFFF; +enum{ + PSF_MAGIC1 = 0x36, + PSF_MAGIC2 = 0x04, + + PSF_MODE512 = 0x01, + PSF_MODEHASTAB = 0x02, + PSF_MAXMODE = 0x03, + PSF_SEPARATOR = 0xFFFF +}; struct psf_header { unsigned char magic1, magic2; /* Magic number */ diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index efb6e658f..dacf37b12 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c @@ -33,7 +33,9 @@ struct kbkeycode { unsigned int scancode, keycode; }; -static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */ +enum { + KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */ +}; extern int setkeycodes_main(int argc, char** argv) diff --git a/coreutils/cut.c b/coreutils/cut.c index 526a99393..11e9d5e87 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -45,9 +45,11 @@ struct cut_list { int endpos; }; -static const int BOL = 0; -static const int EOL = INT_MAX; -static const int NON_RANGE = -1; +enum { + BOL = 0, + EOL = INT_MAX, + NON_RANGE = -1 +}; static struct cut_list *cut_lists = NULL; /* growable array holding a series of lists */ static unsigned int nlists = 0; /* number of elements in above list */ diff --git a/coreutils/stty.c b/coreutils/stty.c index a3526136f..8b70af65e 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -343,9 +343,10 @@ static const struct mode_info mode_info[] = { MI_ENTRY(stty_dec, combination, OMIT, 0, 0 ), }; -static const int NUM_mode_info = - - (sizeof(mode_info) / sizeof(struct mode_info)); +enum { + NUM_mode_info = + (sizeof(mode_info) / sizeof(struct mode_info)) +}; /* Control character settings. */ struct control_info { @@ -395,8 +396,10 @@ static const struct control_info control_info[] = { {stty_time, 0, VTIME}, }; -static const int NUM_control_info = - (sizeof(control_info) / sizeof(struct control_info)); +enum { + NUM_control_info = + (sizeof(control_info) / sizeof(struct control_info)) +}; #define EMT(t) ((enum mode_type)(t)) diff --git a/editors/awk.c b/editors/awk.c index 65856aa55..cce3b562a 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -392,7 +392,7 @@ static char * vValues = /* hash size may grow to these values */ #define FIRST_PRIME 61; static const unsigned int PRIMES[] = { 251, 1021, 4093, 16381, 65521 }; -static const unsigned int NPRIMES = sizeof(PRIMES) / sizeof(unsigned int); +enum { NPRIMES = sizeof(PRIMES) / sizeof(unsigned int) }; /* globals */ diff --git a/editors/vi.c b/editors/vi.c index 4dcef68f9..3bf9ac3f9 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -138,18 +138,20 @@ static const char CMup[] = "\033[A"; static const char CMdown[] = "\n"; -static const int YANKONLY = FALSE; -static const int YANKDEL = TRUE; -static const int FORWARD = 1; // code depends on "1" for array index -static const int BACK = -1; // code depends on "-1" for array index -static const int LIMITED = 0; // how much of text[] in char_search -static const int FULL = 1; // how much of text[] in char_search - -static const int S_BEFORE_WS = 1; // used in skip_thing() for moving "dot" -static const int S_TO_WS = 2; // used in skip_thing() for moving "dot" -static const int S_OVER_WS = 3; // used in skip_thing() for moving "dot" -static const int S_END_PUNCT = 4; // used in skip_thing() for moving "dot" -static const int S_END_ALNUM = 5; // used in skip_thing() for moving "dot" +enum { + YANKONLY = FALSE, + YANKDEL = TRUE, + FORWARD = 1, // code depends on "1" for array index + BACK = -1, // code depends on "-1" for array index + LIMITED = 0, // how much of text[] in char_search + FULL = 1, // how much of text[] in char_search + + S_BEFORE_WS = 1, // used in skip_thing() for moving "dot" + S_TO_WS = 2, // used in skip_thing() for moving "dot" + S_OVER_WS = 3, // used in skip_thing() for moving "dot" + S_END_PUNCT = 4, // used in skip_thing() for moving "dot" + S_END_ALNUM = 5 // used in skip_thing() for moving "dot" +}; typedef unsigned char Byte; diff --git a/init/init.c b/init/init.c index b7bc7ef9f..2ddcef936 100644 --- a/init/init.c +++ b/init/init.c @@ -47,7 +47,7 @@ struct vt_stat { unsigned short v_signal; /* signal to send */ unsigned short v_state; /* vt bitmask */ }; -static const int VT_GETSTATE = 0x5603; /* get global vt state info */ +enum { VT_GETSTATE = 0x5603 }; /* get global vt state info */ /* From */ struct serial_struct { @@ -145,22 +145,25 @@ static char console[CONSOLE_BUFF_SIZE] = _PATH_CONSOLE; static char *log_console = VC_5; #endif static sig_atomic_t got_cont = 0; -static const int LOG = 0x1; -static const int CONSOLE = 0x2; + +enum { + LOG = 0x1, + CONSOLE = 0x2, #if defined CONFIG_FEATURE_EXTRA_QUIET -static const int MAYBE_CONSOLE = 0x0; + MAYBE_CONSOLE = 0x0, #else -#define MAYBE_CONSOLE CONSOLE + MAYBE_CONSOLE = CONSOLE, #endif -#ifndef RB_HALT_SYSTEM -static const int RB_HALT_SYSTEM = 0xcdef0123; -static const int RB_ENABLE_CAD = 0x89abcdef; -static const int RB_DISABLE_CAD = 0; -#define RB_POWER_OFF 0x4321fedc -static const int RB_AUTOBOOT = 0x01234567; +#ifndef RB_HALT_SYSTEM + RB_HALT_SYSTEM = 0xcdef0123, + RB_ENABLE_CAD = 0x89abcdef, + RB_DISABLE_CAD = 0, + RB_POWER_OFF = 0x4321fedc, + RB_AUTOBOOT = 0x01234567, #endif +}; static const char * const environment[] = { "HOME=/", diff --git a/libbb/get_console.c b/libbb/get_console.c index bfb7468a8..a5903d0c3 100644 --- a/libbb/get_console.c +++ b/libbb/get_console.c @@ -30,7 +30,7 @@ /* From */ -static const int KDGKBTYPE = 0x4B33; /* get keyboard type */ +enum { KDGKBTYPE = 0x4B33 }; /* get keyboard type */ static int open_a_console(const char *fnam) diff --git a/libbb/speed_table.c b/libbb/speed_table.c index b04429e91..4075562db 100644 --- a/libbb/speed_table.c +++ b/libbb/speed_table.c @@ -67,7 +67,7 @@ static const struct speed_map speeds[] = { #endif }; -static const int NUM_SPEEDS = (sizeof(speeds) / sizeof(struct speed_map)); +enum { NUM_SPEEDS = (sizeof(speeds) / sizeof(struct speed_map)) }; unsigned long bb_baud_to_value(speed_t speed) { diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index 1bc166bbc..c7227d1dd 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c @@ -15,7 +15,7 @@ char *xreadlink(const char *path) { - static const int GROWBY = 80; /* how large we will grow strings by */ + enum { GROWBY = 80 }; /* how large we will grow strings by */ char *buf = NULL; int bufsize = 0, readsize = 0; diff --git a/modutils/insmod.c b/modutils/insmod.c index 8b112787f..26dd9783b 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -343,7 +343,7 @@ extern int insmod_ng_main( int argc, char **argv); #ifndef MODUTILS_MODULE_H -static const int MODUTILS_MODULE_H = 1; +/* Why? static const int MODUTILS_MODULE_H = 1;*/ #ident "$Id: insmod.c,v 1.126 2004/12/26 09:13:32 vapier Exp $" @@ -364,9 +364,11 @@ static const int MODUTILS_MODULE_H = 1; #undef tgt_sizeof_char_p #undef tgt_sizeof_void_p #undef tgt_long -static const int tgt_sizeof_long = 8; -static const int tgt_sizeof_char_p = 8; -static const int tgt_sizeof_void_p = 8; +enum { + tgt_sizeof_long = 8, + tgt_sizeof_char_p = 8, + tgt_sizeof_void_p = 8 +}; #define tgt_long long long #endif @@ -441,23 +443,26 @@ struct new_module_info }; /* Bits of module.flags. */ -static const int NEW_MOD_RUNNING = 1; -static const int NEW_MOD_DELETED = 2; -static const int NEW_MOD_AUTOCLEAN = 4; -static const int NEW_MOD_VISITED = 8; -static const int NEW_MOD_USED_ONCE = 16; +enum { + NEW_MOD_RUNNING = 1, + NEW_MOD_DELETED = 2, + NEW_MOD_AUTOCLEAN = 4, + NEW_MOD_VISITED = 8, + NEW_MOD_USED_ONCE = 16 +}; int init_module(const char *name, const struct new_module *); int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret); /* Values for query_module's which. */ - -static const int QM_MODULES = 1; -static const int QM_DEPS = 2; -static const int QM_REFS = 3; -static const int QM_SYMBOLS = 4; -static const int QM_INFO = 5; +enum { + QM_MODULES = 1, + QM_DEPS = 2, + QM_REFS = 3, + QM_SYMBOLS = 4, + QM_INFO = 5 +}; /*======================================================================*/ /* The system calls unchanged between 2.0 and 2.1. */ @@ -501,7 +506,7 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H -static const int MODUTILS_OBJ_H = 1; +/* Why? static const int MODUTILS_OBJ_H = 1; */ #ident "$Id: insmod.c,v 1.126 2004/12/26 09:13:32 vapier Exp $" @@ -700,7 +705,7 @@ static int obj_gpl_license(struct obj_file *f, const char **license); #define _PATH_MODULES "/lib/modules" -static const int STRVERSIONLEN = 32; +enum { STRVERSIONLEN = 32 }; /*======================================================================*/ diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 82136dd0f..3bbf89e58 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c @@ -82,20 +82,22 @@ struct module_info int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret); +enum { /* Values for query_module's which. */ -static const int QM_MODULES = 1; -static const int QM_DEPS = 2; -static const int QM_REFS = 3; -static const int QM_SYMBOLS = 4; -static const int QM_INFO = 5; + QM_MODULES = 1, + QM_DEPS = 2, + QM_REFS = 3, + QM_SYMBOLS = 4, + QM_INFO = 5, /* Bits of module.flags. */ -static const int NEW_MOD_RUNNING = 1; -static const int NEW_MOD_DELETED = 2; -static const int NEW_MOD_AUTOCLEAN = 4; -static const int NEW_MOD_VISITED = 8; -static const int NEW_MOD_USED_ONCE = 16; -static const int NEW_MOD_INITIALIZING = 64; + NEW_MOD_RUNNING = 1, + NEW_MOD_DELETED = 2, + NEW_MOD_AUTOCLEAN = 4, + NEW_MOD_VISITED = 8, + NEW_MOD_USED_ONCE = 16, + NEW_MOD_INITIALIZING = 64 +}; int lsmod_main(int argc, char **argv) { diff --git a/networking/dnsd.c b/networking/dnsd.c index 433b12443..9ca4105d3 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -27,11 +27,12 @@ static char *fileconf = "/etc/dnsd.conf"; #define LOCK_FILE "/var/run/dnsd.lock" #define LOG_FILE "/var/log/dnsd.log" -#define MAX_HOST_LEN 16 // longest host name allowed is 15 -#define IP_STRING_LEN 18 // .xxx.xxx.xxx.xxx\0 +enum { + MAX_HOST_LEN = 16, // longest host name allowed is 15 + IP_STRING_LEN = 18, // .xxx.xxx.xxx.xxx\0 //must be strlen('.in-addr.arpa') larger than IP_STRING_LEN -static const int MAX_NAME_LEN = (IP_STRING_LEN + 13); + MAX_NAME_LEN = (IP_STRING_LEN + 13), /* Cannot get bigger packets than 512 per RFC1035 In practice this can be set considerably smaller: @@ -39,12 +40,13 @@ static const int MAX_NAME_LEN = (IP_STRING_LEN + 13); ttl(4B) + rlen(2B) + r (MAX_NAME_LEN =21B) + 2*querystring (2 MAX_NAME_LEN= 42B), all together 90 Byte */ -static const int MAX_PACK_LEN = 512 + 1; + MAX_PACK_LEN = 512 + 1, -#define DEFAULT_TTL 30; // increase this when not testing? + DEFAULT_TTL = 30, // increase this when not testing? -static const int REQ_A = 1; -static const int REQ_PTR = 12; + REQ_A = 1, + REQ_PTR = 12 +}; struct dns_repl { // resource record, add 0 or 1 to accepted dns_msg in resp uint16_t rlen; diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c index c7fb42fc4..5442c22c2 100644 --- a/networking/fakeidentd.c +++ b/networking/fakeidentd.c @@ -51,7 +51,7 @@ #define MAXIDLETIME 45 static const char ident_substr[] = " : USERID : UNIX : "; -static const int ident_substr_len = sizeof(ident_substr) - 1; +enum { ident_substr_len = sizeof(ident_substr) - 1 }; #define PIDFILE "/var/run/identd.pid" /* diff --git a/networking/ping.c b/networking/ping.c index 47b9f8f52..ecfd125ae 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -33,13 +33,15 @@ #include "busybox.h" -static const int DEFDATALEN = 56; -static const int MAXIPLEN = 60; -static const int MAXICMPLEN = 76; -static const int MAXPACKET = 65468; -#define MAX_DUP_CHK (8 * 128) -static const int MAXWAIT = 10; -static const int PINGINTERVAL = 1; /* second */ +enum { + DEFDATALEN = 56, + MAXIPLEN = 60, + MAXICMPLEN = 76, + MAXPACKET = 65468, + MAX_DUP_CHK = (8 * 128), + MAXWAIT = 10, + PINGINTERVAL = 1 /* second */ +}; #define O_QUIET (1 << 0) diff --git a/networking/ping6.c b/networking/ping6.c index 42cf2785c..72d1d667a 100644 --- a/networking/ping6.c +++ b/networking/ping6.c @@ -56,13 +56,15 @@ #include /* offsetof */ #include "busybox.h" -static const int DEFDATALEN = 56; -static const int MAXIPLEN = 60; -static const int MAXICMPLEN = 76; -static const int MAXPACKET = 65468; -#define MAX_DUP_CHK (8 * 128) -static const int MAXWAIT = 10; -static const int PINGINTERVAL = 1; /* second */ +enum { + DEFDATALEN = 56, + MAXIPLEN = 60, + MAXICMPLEN = 76, + MAXPACKET = 65468, + MAX_DUP_CHK = (8 * 128), + MAXWAIT = 10, + PINGINTERVAL = 1 /* second */ +}; #define O_QUIET (1 << 0) #define O_VERBOSE (1 << 1) diff --git a/networking/telnet.c b/networking/telnet.c index ca4896bf0..2ad44d429 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -35,7 +35,7 @@ #include "busybox.h" #if 0 -static const int DOTRACE = 1; +enum { DOTRACE = 1 }; #endif #ifdef DOTRACE @@ -55,14 +55,14 @@ static const int DOTRACE = 1; #define DATABUFSIZE 128 #define IACBUFSIZE 128 -static const int CHM_TRY = 0; -static const int CHM_ON = 1; -static const int CHM_OFF = 2; +enum { + CHM_TRY = 0, + CHM_ON = 1, + CHM_OFF = 2, -static const int UF_ECHO = 0x01; -static const int UF_SGA = 0x02; + UF_ECHO = 0x01, + UF_SGA = 0x02, -enum { TS_0 = 1, TS_IAC = 2, TS_OPT = 3, diff --git a/networking/zcip.c b/networking/zcip.c index 11b2db526..716c4a5e1 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -62,20 +62,22 @@ struct arp_packet { struct in_addr target_ip; } ATTRIBUTE_PACKED; +enum { /* 169.254.0.0 */ -static const uint32_t LINKLOCAL_ADDR = 0xa9fe0000; + LINKLOCAL_ADDR = 0xa9fe0000, /* protocol timeout parameters, specified in seconds */ -static const unsigned PROBE_WAIT = 1; -static const unsigned PROBE_MIN = 1; -static const unsigned PROBE_MAX = 2; -static const unsigned PROBE_NUM = 3; -static const unsigned MAX_CONFLICTS = 10; -static const unsigned RATE_LIMIT_INTERVAL = 60; -static const unsigned ANNOUNCE_WAIT = 2; -static const unsigned ANNOUNCE_NUM = 2; -static const unsigned ANNOUNCE_INTERVAL = 2; -static const time_t DEFEND_INTERVAL = 10; + PROBE_WAIT = 1, + PROBE_MIN = 1, + PROBE_MAX = 2, + PROBE_NUM = 3, + MAX_CONFLICTS = 10, + RATE_LIMIT_INTERVAL = 60, + ANNOUNCE_WAIT = 2, + ANNOUNCE_NUM = 2, + ANNOUNCE_INTERVAL = 2, + DEFEND_INTERVAL = 10 +}; static const unsigned char ZCIP_VERSION[] = "0.75 (18 April 2005)"; static char *prog; diff --git a/shell/lash.c b/shell/lash.c index 968396e41..8e8d45ae9 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -57,11 +57,13 @@ enum redir_type { REDIRECT_INPUT, REDIRECT_OVERWRITE, }; #endif -static const unsigned int DEFAULT_CONTEXT=0x1; -static const unsigned int IF_TRUE_CONTEXT=0x2; -static const unsigned int IF_FALSE_CONTEXT=0x4; -static const unsigned int THEN_EXP_CONTEXT=0x8; -static const unsigned int ELSE_EXP_CONTEXT=0x10; +enum { + DEFAULT_CONTEXT = 0x1, + IF_TRUE_CONTEXT = 0x2, + IF_FALSE_CONTEXT = 0x4, + THEN_EXP_CONTEXT = 0x8, + ELSE_EXP_CONTEXT = 0x10 +}; #ifdef CONFIG_LASH_PIPE_N_REDIRECTS struct redir_struct { 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 #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<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<= 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) */ +}; /* -- cgit v1.2.3