aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-03-10 19:22:06 +0000
committerRob Landley <rob@landley.net>2006-03-10 19:22:06 +0000
commitbc68cd14ccaebc17e7e03a08e51fddfb91007624 (patch)
treebeb32cedafc6232bf8a49fe90f0769d471ea6791 /util-linux
parentdae6aa28598cb2353291f18ca52e768c3259165a (diff)
downloadbusybox-w32-bc68cd14ccaebc17e7e03a08e51fddfb91007624.tar.gz
busybox-w32-bc68cd14ccaebc17e7e03a08e51fddfb91007624.tar.bz2
busybox-w32-bc68cd14ccaebc17e7e03a08e51fddfb91007624.zip
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.c28
-rw-r--r--util-linux/fsck_minix.c51
-rw-r--r--util-linux/getopt.c8
-rw-r--r--util-linux/mkswap.c2
-rw-r--r--util-linux/nfsmount.c64
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 @@
38#define DEFAULTFBDEV FB_0 38#define DEFAULTFBDEV FB_0
39#define DEFAULTFBMODE "/etc/fb.modes" 39#define DEFAULTFBMODE "/etc/fb.modes"
40 40
41static const int OPT_CHANGE = (1 << 0);
42static const int OPT_INFO = (1 << 1);
43static const int OPT_READMODE = (1 << 2);
44
45enum { 41enum {
42 OPT_CHANGE = (1 << 0),
43 OPT_INFO = (1 << 1),
44 OPT_READMODE = (1 << 2),
45
46 CMD_FB = 1, 46 CMD_FB = 1,
47 CMD_DB = 2, 47 CMD_DB = 2,
48 CMD_GEOMETRY = 3, 48 CMD_GEOMETRY = 3,
@@ -84,8 +84,10 @@ enum {
84static unsigned int g_options = 0; 84static unsigned int g_options = 0;
85 85
86/* Stuff stolen from the kernel's fb.h */ 86/* Stuff stolen from the kernel's fb.h */
87static const int FBIOGET_VSCREENINFO = 0x4600; 87enum {
88static const int FBIOPUT_VSCREENINFO = 0x4601; 88 FBIOGET_VSCREENINFO = 0x4600,
89 FBIOPUT_VSCREENINFO = 0x4601
90};
89struct fb_bitfield { 91struct fb_bitfield {
90 uint32_t offset; /* beginning of bitfield */ 92 uint32_t offset; /* beginning of bitfield */
91 uint32_t length; /* length of bitfield */ 93 uint32_t length; /* length of bitfield */
@@ -179,12 +181,14 @@ static const struct cmdoptions_t {
179 181
180#ifdef CONFIG_FEATURE_FBSET_READMODE 182#ifdef CONFIG_FEATURE_FBSET_READMODE
181/* taken from linux/fb.h */ 183/* taken from linux/fb.h */
182static const int FB_VMODE_INTERLACED = 1; /* interlaced */ 184enum {
183static const int FB_VMODE_DOUBLE = 2; /* double scan */ 185 FB_VMODE_INTERLACED = 1, /* interlaced */
184static const int FB_SYNC_HOR_HIGH_ACT = 1; /* horizontal sync high active */ 186 FB_VMODE_DOUBLE = 2, /* double scan */
185static const int FB_SYNC_VERT_HIGH_ACT = 2; /* vertical sync high active */ 187 FB_SYNC_HOR_HIGH_ACT = 1, /* horizontal sync high active */
186static const int FB_SYNC_EXT = 4; /* external sync */ 188 FB_SYNC_VERT_HIGH_ACT = 2, /* vertical sync high active */
187static const int FB_SYNC_COMP_HIGH_ACT = 8; /* composite sync high active */ 189 FB_SYNC_EXT = 4, /* external sync */
190 FB_SYNC_COMP_HIGH_ACT = 8 /* composite sync high active */
191};
188#endif 192#endif
189static int readmode(struct fb_var_screeninfo *base, const char *fn, 193static int readmode(struct fb_var_screeninfo *base, const char *fn,
190 const char *mode) 194 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 @@
98#include <sys/param.h> 98#include <sys/param.h>
99#include "busybox.h" 99#include "busybox.h"
100 100
101static const int MINIX_ROOT_INO = 1; 101#define BLOCK_SIZE_BITS 10
102static const int MINIX_LINK_MAX = 250; 102#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
103static const int MINIX2_LINK_MAX = 65530;
104
105static const int MINIX_I_MAP_SLOTS = 8;
106static const int MINIX_Z_MAP_SLOTS = 64;
107static const int MINIX_SUPER_MAGIC = 0x137F; /* original minix fs */
108static const int MINIX_SUPER_MAGIC2 = 0x138F; /* minix fs, 30 char names */
109static const int MINIX2_SUPER_MAGIC = 0x2468; /* minix V2 fs */
110static const int MINIX2_SUPER_MAGIC2 = 0x2478; /* minix V2 fs, 30 char names */
111static const int MINIX_VALID_FS = 0x0001; /* Clean fs. */
112static const int MINIX_ERROR_FS = 0x0002; /* fs has errors. */
113
114#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
115#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
116
117static const int MINIX_V1 = 0x0001; /* original minix fs */
118static const int MINIX_V2 = 0x0002; /* minix V2 fs */
119
120#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
121 103
122/* 104/*
123 * This is the original minix inode layout on disk. 105 * This is the original minix inode layout on disk.
@@ -151,6 +133,29 @@ struct minix2_inode {
151 uint32_t i_zone[10]; 133 uint32_t i_zone[10];
152}; 134};
153 135
136enum {
137 MINIX_ROOT_INO = 1,
138 MINIX_LINK_MAX = 250,
139 MINIX2_LINK_MAX = 65530,
140
141 MINIX_I_MAP_SLOTS = 8,
142 MINIX_Z_MAP_SLOTS = 64,
143 MINIX_SUPER_MAGIC = 0x137F, /* original minix fs */
144 MINIX_SUPER_MAGIC2 = 0x138F, /* minix fs, 30 char names */
145 MINIX2_SUPER_MAGIC = 0x2468, /* minix V2 fs */
146 MINIX2_SUPER_MAGIC2 = 0x2478, /* minix V2 fs, 30 char names */
147 MINIX_VALID_FS = 0x0001, /* Clean fs. */
148 MINIX_ERROR_FS = 0x0002, /* fs has errors. */
149
150 MINIX_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix_inode))),
151 MINIX2_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix2_inode))),
152
153 MINIX_V1 = 0x0001, /* original minix fs */
154 MINIX_V2 = 0x0002 /* minix V2 fs */
155};
156
157#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
158
154/* 159/*
155 * minix super-block data on disk 160 * minix super-block data on disk
156 */ 161 */
@@ -172,8 +177,6 @@ struct minix_dir_entry {
172 char name[0]; 177 char name[0];
173}; 178};
174 179
175#define BLOCK_SIZE_BITS 10
176#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
177 180
178#define NAME_MAX 255 /* # chars in a file name */ 181#define NAME_MAX 255 /* # chars in a file name */
179 182
@@ -187,7 +190,7 @@ struct minix_dir_entry {
187#define volatile 190#define volatile
188#endif 191#endif
189 192
190static const int ROOT_INO = 1; 193enum { ROOT_INO = 1 };
191 194
192#define UPPER(size,n) ((size+((n)-1))/(n)) 195#define UPPER(size,n) ((size+((n)-1))/(n))
193#define INODE_SIZE (sizeof(struct minix_inode)) 196#define INODE_SIZE (sizeof(struct minix_inode))
@@ -219,7 +222,7 @@ static struct termios termios;
219static int termios_set = 0; 222static int termios_set = 0;
220 223
221/* File-name data */ 224/* File-name data */
222static const int MAX_DEPTH = 32; 225enum { MAX_DEPTH = 32 };
223static int name_depth = 0; 226static int name_depth = 0;
224// static char name_list[MAX_DEPTH][BUFSIZ + 1]; 227// static char name_list[MAX_DEPTH][BUFSIZ + 1];
225static char **name_list = NULL; 228static 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 @@
53 53
54/* NON_OPT is the code that is returned when a non-option is found in '+' 54/* NON_OPT is the code that is returned when a non-option is found in '+'
55 mode */ 55 mode */
56static const int NON_OPT = 1; 56enum {
57 NON_OPT = 1,
57/* LONG_OPT is the code that is returned when a long option is found. */ 58/* LONG_OPT is the code that is returned when a long option is found. */
58static const int LONG_OPT = 2; 59 LONG_OPT = 2
60};
59 61
60/* The shells recognized. */ 62/* The shells recognized. */
61typedef enum {BASH,TCSH} shell_t; 63typedef enum {BASH,TCSH} shell_t;
@@ -195,7 +197,7 @@ int generate_output(char * argv[],int argc,const char *optstr,
195static struct option *long_options; 197static struct option *long_options;
196static int long_options_length; /* Length of array */ 198static int long_options_length; /* Length of array */
197static int long_options_nr; /* Nr of used elements in array */ 199static int long_options_nr; /* Nr of used elements in array */
198static const int LONG_OPTIONS_INCR = 10; 200enum { LONG_OPTIONS_INCR = 10 };
199#define init_longopt() add_longopt(NULL,0) 201#define init_longopt() add_longopt(NULL,0)
200 202
201/* Register a long option. The contents of name is copied. */ 203/* 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 @@
48 48
49#ifndef _IO 49#ifndef _IO
50/* pre-1.3.45 */ 50/* pre-1.3.45 */
51static const int BLKGETSIZE = 0x1260; 51enum { BLKGETSIZE = 0x1260 };
52#else 52#else
53/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */ 53/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
54#define BLKGETSIZE _IO(0x12,96) 54#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 {
105#define NFS_PROGRAM 100003 105#define NFS_PROGRAM 100003
106 106
107 107
108 108enum {
109#ifndef NFS_FHSIZE 109#ifndef NFS_FHSIZE
110static const int NFS_FHSIZE = 32; 110 NFS_FHSIZE = 32,
111#endif 111#endif
112#ifndef NFS_PORT 112#ifndef NFS_PORT
113static const int NFS_PORT = 2049; 113 NFS_PORT = 2049
114#endif 114#endif
115};
115 116
116/* Disable the nls stuff */ 117/* Disable the nls stuff */
117# undef bindtextdomain 118# undef bindtextdomain
@@ -119,19 +120,21 @@ static const int NFS_PORT = 2049;
119# undef textdomain 120# undef textdomain
120# define textdomain(Domain) /* empty */ 121# define textdomain(Domain) /* empty */
121 122
122static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */ 123enum {
123static const int MS_RDONLY = 1; /* Mount read-only */ 124 MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
124static const int MS_NOSUID = 2; /* Ignore suid and sgid bits */ 125 MS_RDONLY = 1, /* Mount read-only */
125static const int MS_NODEV = 4; /* Disallow access to device special files */ 126 MS_NOSUID = 2, /* Ignore suid and sgid bits */
126static const int MS_NOEXEC = 8; /* Disallow program execution */ 127 MS_NODEV = 4, /* Disallow access to device special files */
127static const int MS_SYNCHRONOUS = 16; /* Writes are synced at once */ 128 MS_NOEXEC = 8, /* Disallow program execution */
128static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS */ 129 MS_SYNCHRONOUS = 16, /* Writes are synced at once */
129static const int MS_MANDLOCK = 64; /* Allow mandatory locks on an FS */ 130 MS_REMOUNT = 32, /* Alter flags of a mounted FS */
130static const int S_QUOTA = 128; /* Quota initialized for file/directory/symlink */ 131 MS_MANDLOCK = 64, /* Allow mandatory locks on an FS */
131static const int S_APPEND = 256; /* Append-only file */ 132 S_QUOTA = 128, /* Quota initialized for file/directory/symlink */
132static const int S_IMMUTABLE = 512; /* Immutable file */ 133 S_APPEND = 256, /* Append-only file */
133static const int MS_NOATIME = 1024; /* Do not update access times. */ 134 S_IMMUTABLE = 512, /* Immutable file */
134static const int MS_NODIRATIME = 2048; /* Do not update directory access times */ 135 MS_NOATIME = 1024, /* Do not update access times. */
136 MS_NODIRATIME = 2048 /* Do not update directory access times */
137};
135 138
136 139
137/* 140/*
@@ -177,17 +180,18 @@ struct nfs_mount_data {
177}; 180};
178 181
179/* bits in the flags field */ 182/* bits in the flags field */
180 183enum {
181static const int NFS_MOUNT_SOFT = 0x0001; /* 1 */ 184 NFS_MOUNT_SOFT = 0x0001, /* 1 */
182static const int NFS_MOUNT_INTR = 0x0002; /* 1 */ 185 NFS_MOUNT_INTR = 0x0002, /* 1 */
183static const int NFS_MOUNT_SECURE = 0x0004; /* 1 */ 186 NFS_MOUNT_SECURE = 0x0004, /* 1 */
184static const int NFS_MOUNT_POSIX = 0x0008; /* 1 */ 187 NFS_MOUNT_POSIX = 0x0008, /* 1 */
185static const int NFS_MOUNT_NOCTO = 0x0010; /* 1 */ 188 NFS_MOUNT_NOCTO = 0x0010, /* 1 */
186static const int NFS_MOUNT_NOAC = 0x0020; /* 1 */ 189 NFS_MOUNT_NOAC = 0x0020, /* 1 */
187static const int NFS_MOUNT_TCP = 0x0040; /* 2 */ 190 NFS_MOUNT_TCP = 0x0040, /* 2 */
188static const int NFS_MOUNT_VER3 = 0x0080; /* 3 */ 191 NFS_MOUNT_VER3 = 0x0080, /* 3 */
189static const int NFS_MOUNT_KERBEROS = 0x0100; /* 3 */ 192 NFS_MOUNT_KERBEROS = 0x0100, /* 3 */
190static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */ 193 NFS_MOUNT_NONLM = 0x0200 /* 3 */
194};
191 195
192 196
193#define UTIL_LINUX_VERSION "2.10m" 197#define UTIL_LINUX_VERSION "2.10m"
@@ -213,8 +217,10 @@ static char *nfs_strerror(int status);
213#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) 217#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
214#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) 218#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
215 219
216static const int EX_FAIL = 32; /* mount failure */ 220enum {
217static const int EX_BG = 256; /* retry in background (internal only) */ 221 EX_FAIL = 32, /* mount failure */
222 EX_BG = 256 /* retry in background (internal only) */
223};
218 224
219 225
220/* 226/*