diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2009-02-18 13:42:51 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2009-02-18 13:42:51 +0000 |
commit | 8af23f8fc36ae815a711944dbc8b55a3026e771c (patch) | |
tree | d283a9812218c6a505ba9276440323e4b6e6b1ca /miscutils/flash_eraseall.c | |
parent | 7d9d25154359d6ce16edc59ed202cfa2e998fdcb (diff) | |
download | busybox-w32-8af23f8fc36ae815a711944dbc8b55a3026e771c.tar.gz busybox-w32-8af23f8fc36ae815a711944dbc8b55a3026e771c.tar.bz2 busybox-w32-8af23f8fc36ae815a711944dbc8b55a3026e771c.zip |
- eliminate globals
Diffstat (limited to 'miscutils/flash_eraseall.c')
-rw-r--r-- | miscutils/flash_eraseall.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c index e0e07ae69..ece2500b2 100644 --- a/miscutils/flash_eraseall.c +++ b/miscutils/flash_eraseall.c | |||
@@ -20,11 +20,15 @@ | |||
20 | #define isNAND (1 << _bitNAND) | 20 | #define isNAND (1 << _bitNAND) |
21 | #define bbtest (1 << 3) | 21 | #define bbtest (1 << 3) |
22 | 22 | ||
23 | /* This is used in the cpu_to_je/je_to_cpu macros in jffs2_user.h */ | 23 | struct globals { |
24 | /* FIXME: target_endian should be const! | 24 | /* This is used in the cpu_to_je/je_to_cpu macros in jffs2_user.h */ |
25 | * FIXME: Also it sounds more sensible to use our own existing SWAP_ macros. | 25 | int tgt_endian; |
26 | */ | 26 | }; |
27 | /* const */ int target_endian = __BYTE_ORDER; | 27 | #define G (*(struct globals*)&bb_common_bufsiz1) |
28 | #define target_endian (G.tgt_endian) | ||
29 | #define INIT_G() do { \ | ||
30 | target_endian = __BYTE_ORDER; \ | ||
31 | } while (0) | ||
28 | 32 | ||
29 | static uint32_t crc32(uint32_t val, const void *ss, int len, | 33 | static uint32_t crc32(uint32_t val, const void *ss, int len, |
30 | uint32_t *crc32_table) | 34 | uint32_t *crc32_table) |
@@ -54,6 +58,7 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv) | |||
54 | unsigned int flags; | 58 | unsigned int flags; |
55 | char *mtd_name; | 59 | char *mtd_name; |
56 | 60 | ||
61 | INIT_G(); | ||
57 | opt_complementary = "=1"; | 62 | opt_complementary = "=1"; |
58 | flags = getopt32(argv, "jq"); | 63 | flags = getopt32(argv, "jq"); |
59 | 64 | ||