Patch from Denis Vlasenko turning static const int (which gets emitted into

the busybox binary) into enums (which don't).
This commit is contained in:
Rob Landley 2006-03-10 19:22:06 +00:00
parent dae6aa2859
commit bc68cd14cc
28 changed files with 243 additions and 193 deletions

View File

@ -732,25 +732,26 @@ static unsigned match_start; /* start of matching string */
static int eofile; /* flag set at end of input file */ static int eofile; /* flag set at end of input file */
static unsigned lookahead; /* number of valid bytes ahead in window */ 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. /* To speed up deflation, hash chains are never searched beyond this length.
* A higher limit improves compression ratio but degrades the speed. * 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 /* Attempt to find a better match only when the current match is strictly
* smaller than this value. This mechanism is used only for compression * smaller than this value. This mechanism is used only for compression
* levels >= 4. * 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 /* Insert new strings in the hash table only if the match length
* is not greater than this length. This saves time but degrades compression. * is not greater than this length. This saves time but degrades compression.
* max_insert_length is used only for compression levels <= 3. * 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 */ /* 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. * 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 /* 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 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
* meaning. * meaning.
*/ */
};
#define EQUAL 0 #define EQUAL 0
/* result of memcmp for equal strings */ /* result of memcmp for equal strings */

View File

@ -92,7 +92,7 @@ static unsigned int gunzip_outbuf_count; /* bytes in output buffer */
/* gunzip_window size--must be a power of two, and /* gunzip_window size--must be a power of two, and
* at least 32K for zip's deflate method */ * 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 char *gunzip_window;
static unsigned int *gunzip_crc_table; static unsigned int *gunzip_crc_table;

View File

@ -29,8 +29,10 @@
#include "busybox.h" #include "busybox.h"
/* From <linux/vt.h> */ /* From <linux/vt.h> */
static const int VT_ACTIVATE = 0x5606; /* make vt active */ enum {
static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */ VT_ACTIVATE = 0x5606, /* make vt active */
VT_WAITACTIVE = 0x5607 /* wait for vt active */
};
int chvt_main(int argc, char **argv) int chvt_main(int argc, char **argv)
{ {

View File

@ -30,7 +30,7 @@
#include "busybox.h" #include "busybox.h"
/* From <linux/vt.h> */ /* From <linux/vt.h> */
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[]) int deallocvt_main(int argc, char *argv[])
{ {

View File

@ -21,13 +21,15 @@
#include <endian.h> #include <endian.h>
#include "busybox.h" #include "busybox.h"
static const int PSF_MAGIC1 = 0x36; enum{
static const int PSF_MAGIC2 = 0x04; PSF_MAGIC1 = 0x36,
PSF_MAGIC2 = 0x04,
static const int PSF_MODE512 = 0x01; PSF_MODE512 = 0x01,
static const int PSF_MODEHASTAB = 0x02; PSF_MODEHASTAB = 0x02,
static const int PSF_MAXMODE = 0x03; PSF_MAXMODE = 0x03,
static const int PSF_SEPARATOR = 0xFFFF; PSF_SEPARATOR = 0xFFFF
};
struct psf_header { struct psf_header {
unsigned char magic1, magic2; /* Magic number */ unsigned char magic1, magic2; /* Magic number */

View File

@ -33,7 +33,9 @@
struct kbkeycode { struct kbkeycode {
unsigned int scancode, keycode; unsigned int scancode, keycode;
}; };
static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */ enum {
KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */
};
extern int extern int
setkeycodes_main(int argc, char** argv) setkeycodes_main(int argc, char** argv)

View File

@ -45,9 +45,11 @@ struct cut_list {
int endpos; int endpos;
}; };
static const int BOL = 0; enum {
static const int EOL = INT_MAX; BOL = 0,
static const int NON_RANGE = -1; EOL = INT_MAX,
NON_RANGE = -1
};
static struct cut_list *cut_lists = NULL; /* growable array holding a series of lists */ 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 */ static unsigned int nlists = 0; /* number of elements in above list */

View File

@ -343,9 +343,10 @@ static const struct mode_info mode_info[] = {
MI_ENTRY(stty_dec, combination, OMIT, 0, 0 ), MI_ENTRY(stty_dec, combination, OMIT, 0, 0 ),
}; };
static const int NUM_mode_info = enum {
NUM_mode_info =
(sizeof(mode_info) / sizeof(struct mode_info)); (sizeof(mode_info) / sizeof(struct mode_info))
};
/* Control character settings. */ /* Control character settings. */
struct control_info { struct control_info {
@ -395,8 +396,10 @@ static const struct control_info control_info[] = {
{stty_time, 0, VTIME}, {stty_time, 0, VTIME},
}; };
static const int NUM_control_info = enum {
(sizeof(control_info) / sizeof(struct control_info)); NUM_control_info =
(sizeof(control_info) / sizeof(struct control_info))
};
#define EMT(t) ((enum mode_type)(t)) #define EMT(t) ((enum mode_type)(t))

View File

@ -392,7 +392,7 @@ static char * vValues =
/* hash size may grow to these values */ /* hash size may grow to these values */
#define FIRST_PRIME 61; #define FIRST_PRIME 61;
static const unsigned int PRIMES[] = { 251, 1021, 4093, 16381, 65521 }; 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 */ /* globals */

View File

@ -138,18 +138,20 @@ static const char CMup[] = "\033[A";
static const char CMdown[] = "\n"; static const char CMdown[] = "\n";
static const int YANKONLY = FALSE; enum {
static const int YANKDEL = TRUE; YANKONLY = FALSE,
static const int FORWARD = 1; // code depends on "1" for array index YANKDEL = TRUE,
static const int BACK = -1; // code depends on "-1" for array index FORWARD = 1, // code depends on "1" for array index
static const int LIMITED = 0; // how much of text[] in char_search BACK = -1, // code depends on "-1" for array index
static const int FULL = 1; // how much of text[] in char_search LIMITED = 0, // how much of text[] in char_search
FULL = 1, // how much of text[] in char_search
static const int S_BEFORE_WS = 1; // used in skip_thing() for moving "dot" 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" 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" 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" 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" S_END_ALNUM = 5 // used in skip_thing() for moving "dot"
};
typedef unsigned char Byte; typedef unsigned char Byte;

View File

@ -47,7 +47,7 @@ struct vt_stat {
unsigned short v_signal; /* signal to send */ unsigned short v_signal; /* signal to send */
unsigned short v_state; /* vt bitmask */ 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 <linux/serial.h> */ /* From <linux/serial.h> */
struct serial_struct { struct serial_struct {
@ -145,22 +145,25 @@ static char console[CONSOLE_BUFF_SIZE] = _PATH_CONSOLE;
static char *log_console = VC_5; static char *log_console = VC_5;
#endif #endif
static sig_atomic_t got_cont = 0; 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 #if defined CONFIG_FEATURE_EXTRA_QUIET
static const int MAYBE_CONSOLE = 0x0; MAYBE_CONSOLE = 0x0,
#else #else
#define MAYBE_CONSOLE CONSOLE MAYBE_CONSOLE = CONSOLE,
#endif #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 #ifndef RB_HALT_SYSTEM
static const int RB_AUTOBOOT = 0x01234567; RB_HALT_SYSTEM = 0xcdef0123,
RB_ENABLE_CAD = 0x89abcdef,
RB_DISABLE_CAD = 0,
RB_POWER_OFF = 0x4321fedc,
RB_AUTOBOOT = 0x01234567,
#endif #endif
};
static const char * const environment[] = { static const char * const environment[] = {
"HOME=/", "HOME=/",

View File

@ -30,7 +30,7 @@
/* From <linux/kd.h> */ /* From <linux/kd.h> */
static const int KDGKBTYPE = 0x4B33; /* get keyboard type */ enum { KDGKBTYPE = 0x4B33 }; /* get keyboard type */
static int open_a_console(const char *fnam) static int open_a_console(const char *fnam)

View File

@ -67,7 +67,7 @@ static const struct speed_map speeds[] = {
#endif #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) unsigned long bb_baud_to_value(speed_t speed)
{ {

View File

@ -15,7 +15,7 @@
char *xreadlink(const char *path) 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; char *buf = NULL;
int bufsize = 0, readsize = 0; int bufsize = 0, readsize = 0;

View File

@ -343,7 +343,7 @@ extern int insmod_ng_main( int argc, char **argv);
#ifndef MODUTILS_MODULE_H #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 $" #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_char_p
#undef tgt_sizeof_void_p #undef tgt_sizeof_void_p
#undef tgt_long #undef tgt_long
static const int tgt_sizeof_long = 8; enum {
static const int tgt_sizeof_char_p = 8; tgt_sizeof_long = 8,
static const int tgt_sizeof_void_p = 8; tgt_sizeof_char_p = 8,
tgt_sizeof_void_p = 8
};
#define tgt_long long long #define tgt_long long long
#endif #endif
@ -441,23 +443,26 @@ struct new_module_info
}; };
/* Bits of module.flags. */ /* Bits of module.flags. */
static const int NEW_MOD_RUNNING = 1; enum {
static const int NEW_MOD_DELETED = 2; NEW_MOD_RUNNING = 1,
static const int NEW_MOD_AUTOCLEAN = 4; NEW_MOD_DELETED = 2,
static const int NEW_MOD_VISITED = 8; NEW_MOD_AUTOCLEAN = 4,
static const int NEW_MOD_USED_ONCE = 16; NEW_MOD_VISITED = 8,
NEW_MOD_USED_ONCE = 16
};
int init_module(const char *name, const struct new_module *); int init_module(const char *name, const struct new_module *);
int query_module(const char *name, int which, void *buf, int query_module(const char *name, int which, void *buf,
size_t bufsize, size_t *ret); size_t bufsize, size_t *ret);
/* Values for query_module's which. */ /* Values for query_module's which. */
enum {
static const int QM_MODULES = 1; QM_MODULES = 1,
static const int QM_DEPS = 2; QM_DEPS = 2,
static const int QM_REFS = 3; QM_REFS = 3,
static const int QM_SYMBOLS = 4; QM_SYMBOLS = 4,
static const int QM_INFO = 5; QM_INFO = 5
};
/*======================================================================*/ /*======================================================================*/
/* The system calls unchanged between 2.0 and 2.1. */ /* The system calls unchanged between 2.0 and 2.1. */
@ -501,7 +506,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H #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 $" #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" #define _PATH_MODULES "/lib/modules"
static const int STRVERSIONLEN = 32; enum { STRVERSIONLEN = 32 };
/*======================================================================*/ /*======================================================================*/

View File

@ -82,20 +82,22 @@ struct module_info
int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret); int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
enum {
/* Values for query_module's which. */ /* Values for query_module's which. */
static const int QM_MODULES = 1; QM_MODULES = 1,
static const int QM_DEPS = 2; QM_DEPS = 2,
static const int QM_REFS = 3; QM_REFS = 3,
static const int QM_SYMBOLS = 4; QM_SYMBOLS = 4,
static const int QM_INFO = 5; QM_INFO = 5,
/* Bits of module.flags. */ /* Bits of module.flags. */
static const int NEW_MOD_RUNNING = 1; NEW_MOD_RUNNING = 1,
static const int NEW_MOD_DELETED = 2; NEW_MOD_DELETED = 2,
static const int NEW_MOD_AUTOCLEAN = 4; NEW_MOD_AUTOCLEAN = 4,
static const int NEW_MOD_VISITED = 8; NEW_MOD_VISITED = 8,
static const int NEW_MOD_USED_ONCE = 16; NEW_MOD_USED_ONCE = 16,
static const int NEW_MOD_INITIALIZING = 64; NEW_MOD_INITIALIZING = 64
};
int lsmod_main(int argc, char **argv) int lsmod_main(int argc, char **argv)
{ {

View File

@ -27,11 +27,12 @@ static char *fileconf = "/etc/dnsd.conf";
#define LOCK_FILE "/var/run/dnsd.lock" #define LOCK_FILE "/var/run/dnsd.lock"
#define LOG_FILE "/var/log/dnsd.log" #define LOG_FILE "/var/log/dnsd.log"
#define MAX_HOST_LEN 16 // longest host name allowed is 15 enum {
#define IP_STRING_LEN 18 // .xxx.xxx.xxx.xxx\0 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 //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 /* Cannot get bigger packets than 512 per RFC1035
In practice this can be set considerably smaller: 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) + ttl(4B) + rlen(2B) + r (MAX_NAME_LEN =21B) +
2*querystring (2 MAX_NAME_LEN= 42B), all together 90 Byte 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; REQ_A = 1,
static const int REQ_PTR = 12; REQ_PTR = 12
};
struct dns_repl { // resource record, add 0 or 1 to accepted dns_msg in resp struct dns_repl { // resource record, add 0 or 1 to accepted dns_msg in resp
uint16_t rlen; uint16_t rlen;

View File

@ -51,7 +51,7 @@
#define MAXIDLETIME 45 #define MAXIDLETIME 45
static const char ident_substr[] = " : USERID : UNIX : "; 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" #define PIDFILE "/var/run/identd.pid"
/* /*

View File

@ -33,13 +33,15 @@
#include "busybox.h" #include "busybox.h"
static const int DEFDATALEN = 56; enum {
static const int MAXIPLEN = 60; DEFDATALEN = 56,
static const int MAXICMPLEN = 76; MAXIPLEN = 60,
static const int MAXPACKET = 65468; MAXICMPLEN = 76,
#define MAX_DUP_CHK (8 * 128) MAXPACKET = 65468,
static const int MAXWAIT = 10; MAX_DUP_CHK = (8 * 128),
static const int PINGINTERVAL = 1; /* second */ MAXWAIT = 10,
PINGINTERVAL = 1 /* second */
};
#define O_QUIET (1 << 0) #define O_QUIET (1 << 0)

View File

@ -56,13 +56,15 @@
#include <stddef.h> /* offsetof */ #include <stddef.h> /* offsetof */
#include "busybox.h" #include "busybox.h"
static const int DEFDATALEN = 56; enum {
static const int MAXIPLEN = 60; DEFDATALEN = 56,
static const int MAXICMPLEN = 76; MAXIPLEN = 60,
static const int MAXPACKET = 65468; MAXICMPLEN = 76,
#define MAX_DUP_CHK (8 * 128) MAXPACKET = 65468,
static const int MAXWAIT = 10; MAX_DUP_CHK = (8 * 128),
static const int PINGINTERVAL = 1; /* second */ MAXWAIT = 10,
PINGINTERVAL = 1 /* second */
};
#define O_QUIET (1 << 0) #define O_QUIET (1 << 0)
#define O_VERBOSE (1 << 1) #define O_VERBOSE (1 << 1)

View File

@ -35,7 +35,7 @@
#include "busybox.h" #include "busybox.h"
#if 0 #if 0
static const int DOTRACE = 1; enum { DOTRACE = 1 };
#endif #endif
#ifdef DOTRACE #ifdef DOTRACE
@ -55,14 +55,14 @@ static const int DOTRACE = 1;
#define DATABUFSIZE 128 #define DATABUFSIZE 128
#define IACBUFSIZE 128 #define IACBUFSIZE 128
static const int CHM_TRY = 0;
static const int CHM_ON = 1;
static const int CHM_OFF = 2;
static const int UF_ECHO = 0x01;
static const int UF_SGA = 0x02;
enum { enum {
CHM_TRY = 0,
CHM_ON = 1,
CHM_OFF = 2,
UF_ECHO = 0x01,
UF_SGA = 0x02,
TS_0 = 1, TS_0 = 1,
TS_IAC = 2, TS_IAC = 2,
TS_OPT = 3, TS_OPT = 3,

View File

@ -62,20 +62,22 @@ struct arp_packet {
struct in_addr target_ip; struct in_addr target_ip;
} ATTRIBUTE_PACKED; } ATTRIBUTE_PACKED;
enum {
/* 169.254.0.0 */ /* 169.254.0.0 */
static const uint32_t LINKLOCAL_ADDR = 0xa9fe0000; LINKLOCAL_ADDR = 0xa9fe0000,
/* protocol timeout parameters, specified in seconds */ /* protocol timeout parameters, specified in seconds */
static const unsigned PROBE_WAIT = 1; PROBE_WAIT = 1,
static const unsigned PROBE_MIN = 1; PROBE_MIN = 1,
static const unsigned PROBE_MAX = 2; PROBE_MAX = 2,
static const unsigned PROBE_NUM = 3; PROBE_NUM = 3,
static const unsigned MAX_CONFLICTS = 10; MAX_CONFLICTS = 10,
static const unsigned RATE_LIMIT_INTERVAL = 60; RATE_LIMIT_INTERVAL = 60,
static const unsigned ANNOUNCE_WAIT = 2; ANNOUNCE_WAIT = 2,
static const unsigned ANNOUNCE_NUM = 2; ANNOUNCE_NUM = 2,
static const unsigned ANNOUNCE_INTERVAL = 2; ANNOUNCE_INTERVAL = 2,
static const time_t DEFEND_INTERVAL = 10; DEFEND_INTERVAL = 10
};
static const unsigned char ZCIP_VERSION[] = "0.75 (18 April 2005)"; static const unsigned char ZCIP_VERSION[] = "0.75 (18 April 2005)";
static char *prog; static char *prog;

View File

@ -57,11 +57,13 @@ enum redir_type { REDIRECT_INPUT, REDIRECT_OVERWRITE,
}; };
#endif #endif
static const unsigned int DEFAULT_CONTEXT=0x1; enum {
static const unsigned int IF_TRUE_CONTEXT=0x2; DEFAULT_CONTEXT = 0x1,
static const unsigned int IF_FALSE_CONTEXT=0x4; IF_TRUE_CONTEXT = 0x2,
static const unsigned int THEN_EXP_CONTEXT=0x8; IF_FALSE_CONTEXT = 0x4,
static const unsigned int ELSE_EXP_CONTEXT=0x10; THEN_EXP_CONTEXT = 0x8,
ELSE_EXP_CONTEXT = 0x10
};
#ifdef CONFIG_LASH_PIPE_N_REDIRECTS #ifdef CONFIG_LASH_PIPE_N_REDIRECTS
struct redir_struct { struct redir_struct {

View File

@ -38,11 +38,11 @@
#define DEFAULTFBDEV FB_0 #define DEFAULTFBDEV FB_0
#define DEFAULTFBMODE "/etc/fb.modes" #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 { enum {
OPT_CHANGE = (1 << 0),
OPT_INFO = (1 << 1),
OPT_READMODE = (1 << 2),
CMD_FB = 1, CMD_FB = 1,
CMD_DB = 2, CMD_DB = 2,
CMD_GEOMETRY = 3, CMD_GEOMETRY = 3,
@ -84,8 +84,10 @@ enum {
static unsigned int g_options = 0; static unsigned int g_options = 0;
/* Stuff stolen from the kernel's fb.h */ /* Stuff stolen from the kernel's fb.h */
static const int FBIOGET_VSCREENINFO = 0x4600; enum {
static const int FBIOPUT_VSCREENINFO = 0x4601; FBIOGET_VSCREENINFO = 0x4600,
FBIOPUT_VSCREENINFO = 0x4601
};
struct fb_bitfield { struct fb_bitfield {
uint32_t offset; /* beginning of bitfield */ uint32_t offset; /* beginning of bitfield */
uint32_t length; /* length of bitfield */ uint32_t length; /* length of bitfield */
@ -179,12 +181,14 @@ static const struct cmdoptions_t {
#ifdef CONFIG_FEATURE_FBSET_READMODE #ifdef CONFIG_FEATURE_FBSET_READMODE
/* taken from linux/fb.h */ /* taken from linux/fb.h */
static const int FB_VMODE_INTERLACED = 1; /* interlaced */ enum {
static const int FB_VMODE_DOUBLE = 2; /* double scan */ FB_VMODE_INTERLACED = 1, /* interlaced */
static const int FB_SYNC_HOR_HIGH_ACT = 1; /* horizontal sync high active */ FB_VMODE_DOUBLE = 2, /* double scan */
static const int FB_SYNC_VERT_HIGH_ACT = 2; /* vertical sync high active */ FB_SYNC_HOR_HIGH_ACT = 1, /* horizontal sync high active */
static const int FB_SYNC_EXT = 4; /* external sync */ FB_SYNC_VERT_HIGH_ACT = 2, /* vertical sync high active */
static const int FB_SYNC_COMP_HIGH_ACT = 8; /* composite sync high active */ FB_SYNC_EXT = 4, /* external sync */
FB_SYNC_COMP_HIGH_ACT = 8 /* composite sync high active */
};
#endif #endif
static int readmode(struct fb_var_screeninfo *base, const char *fn, static int readmode(struct fb_var_screeninfo *base, const char *fn,
const char *mode) const char *mode)

View File

@ -98,26 +98,8 @@
#include <sys/param.h> #include <sys/param.h>
#include "busybox.h" #include "busybox.h"
static const int MINIX_ROOT_INO = 1; #define BLOCK_SIZE_BITS 10
static const int MINIX_LINK_MAX = 250; #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
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
/* /*
* This is the original minix inode layout on disk. * This is the original minix inode layout on disk.
@ -151,6 +133,29 @@ struct minix2_inode {
uint32_t i_zone[10]; 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 * minix super-block data on disk
*/ */
@ -172,8 +177,6 @@ struct minix_dir_entry {
char name[0]; char name[0];
}; };
#define BLOCK_SIZE_BITS 10
#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
#define NAME_MAX 255 /* # chars in a file name */ #define NAME_MAX 255 /* # chars in a file name */
@ -187,7 +190,7 @@ struct minix_dir_entry {
#define volatile #define volatile
#endif #endif
static const int ROOT_INO = 1; enum { ROOT_INO = 1 };
#define UPPER(size,n) ((size+((n)-1))/(n)) #define UPPER(size,n) ((size+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct minix_inode)) #define INODE_SIZE (sizeof(struct minix_inode))
@ -219,7 +222,7 @@ static struct termios termios;
static int termios_set = 0; static int termios_set = 0;
/* File-name data */ /* File-name data */
static const int MAX_DEPTH = 32; enum { MAX_DEPTH = 32 };
static int name_depth = 0; static int name_depth = 0;
// static char name_list[MAX_DEPTH][BUFSIZ + 1]; // static char name_list[MAX_DEPTH][BUFSIZ + 1];
static char **name_list = NULL; static char **name_list = NULL;

View File

@ -53,9 +53,11 @@
/* NON_OPT is the code that is returned when a non-option is found in '+' /* NON_OPT is the code that is returned when a non-option is found in '+'
mode */ 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. */ /* 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. */ /* The shells recognized. */
typedef enum {BASH,TCSH} shell_t; 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 struct option *long_options;
static int long_options_length; /* Length of array */ static int long_options_length; /* Length of array */
static int long_options_nr; /* Nr of used elements in 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) #define init_longopt() add_longopt(NULL,0)
/* Register a long option. The contents of name is copied. */ /* Register a long option. The contents of name is copied. */

View File

@ -48,7 +48,7 @@
#ifndef _IO #ifndef _IO
/* pre-1.3.45 */ /* pre-1.3.45 */
static const int BLKGETSIZE = 0x1260; enum { BLKGETSIZE = 0x1260 };
#else #else
/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */ /* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
#define BLKGETSIZE _IO(0x12,96) #define BLKGETSIZE _IO(0x12,96)

View File

@ -105,13 +105,14 @@ enum nfs_stat {
#define NFS_PROGRAM 100003 #define NFS_PROGRAM 100003
enum {
#ifndef NFS_FHSIZE #ifndef NFS_FHSIZE
static const int NFS_FHSIZE = 32; NFS_FHSIZE = 32,
#endif #endif
#ifndef NFS_PORT #ifndef NFS_PORT
static const int NFS_PORT = 2049; NFS_PORT = 2049
#endif #endif
};
/* Disable the nls stuff */ /* Disable the nls stuff */
# undef bindtextdomain # undef bindtextdomain
@ -119,19 +120,21 @@ static const int NFS_PORT = 2049;
# undef textdomain # undef textdomain
# define textdomain(Domain) /* empty */ # define textdomain(Domain) /* empty */
static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */ enum {
static const int MS_RDONLY = 1; /* Mount read-only */ MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
static const int MS_NOSUID = 2; /* Ignore suid and sgid bits */ MS_RDONLY = 1, /* Mount read-only */
static const int MS_NODEV = 4; /* Disallow access to device special files */ MS_NOSUID = 2, /* Ignore suid and sgid bits */
static const int MS_NOEXEC = 8; /* Disallow program execution */ MS_NODEV = 4, /* Disallow access to device special files */
static const int MS_SYNCHRONOUS = 16; /* Writes are synced at once */ MS_NOEXEC = 8, /* Disallow program execution */
static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS */ MS_SYNCHRONOUS = 16, /* Writes are synced at once */
static const int MS_MANDLOCK = 64; /* Allow mandatory locks on an FS */ MS_REMOUNT = 32, /* Alter flags of a mounted FS */
static const int S_QUOTA = 128; /* Quota initialized for file/directory/symlink */ MS_MANDLOCK = 64, /* Allow mandatory locks on an FS */
static const int S_APPEND = 256; /* Append-only file */ S_QUOTA = 128, /* Quota initialized for file/directory/symlink */
static const int S_IMMUTABLE = 512; /* Immutable file */ S_APPEND = 256, /* Append-only file */
static const int MS_NOATIME = 1024; /* Do not update access times. */ S_IMMUTABLE = 512, /* Immutable file */
static const int MS_NODIRATIME = 2048; /* Do not update directory access times */ 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 */ /* bits in the flags field */
enum {
static const int NFS_MOUNT_SOFT = 0x0001; /* 1 */ NFS_MOUNT_SOFT = 0x0001, /* 1 */
static const int NFS_MOUNT_INTR = 0x0002; /* 1 */ NFS_MOUNT_INTR = 0x0002, /* 1 */
static const int NFS_MOUNT_SECURE = 0x0004; /* 1 */ NFS_MOUNT_SECURE = 0x0004, /* 1 */
static const int NFS_MOUNT_POSIX = 0x0008; /* 1 */ NFS_MOUNT_POSIX = 0x0008, /* 1 */
static const int NFS_MOUNT_NOCTO = 0x0010; /* 1 */ NFS_MOUNT_NOCTO = 0x0010, /* 1 */
static const int NFS_MOUNT_NOAC = 0x0020; /* 1 */ NFS_MOUNT_NOAC = 0x0020, /* 1 */
static const int NFS_MOUNT_TCP = 0x0040; /* 2 */ NFS_MOUNT_TCP = 0x0040, /* 2 */
static const int NFS_MOUNT_VER3 = 0x0080; /* 3 */ NFS_MOUNT_VER3 = 0x0080, /* 3 */
static const int NFS_MOUNT_KERBEROS = 0x0100; /* 3 */ NFS_MOUNT_KERBEROS = 0x0100, /* 3 */
static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */ NFS_MOUNT_NONLM = 0x0200 /* 3 */
};
#define UTIL_LINUX_VERSION "2.10m" #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 MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
static const int EX_FAIL = 32; /* mount failure */ enum {
static const int EX_BG = 256; /* retry in background (internal only) */ EX_FAIL = 32, /* mount failure */
EX_BG = 256 /* retry in background (internal only) */
};
/* /*