diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-12-02 08:35:37 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-12-02 08:35:37 +0000 |
commit | ab801874f852312787c049272c20b14e06ed8195 (patch) | |
tree | 1cfd38cfe48ed6a6625ce559ab7f3e5778a980be | |
parent | 8003e266edbc0ec62a586dd70dcc80dc13e2dbf0 (diff) | |
download | busybox-w32-ab801874f852312787c049272c20b14e06ed8195.tar.gz busybox-w32-ab801874f852312787c049272c20b14e06ed8195.tar.bz2 busybox-w32-ab801874f852312787c049272c20b14e06ed8195.zip |
attack the biggest stack users:
-mkfs_minix_main [busybox_unstripped]: 4288
-mkfs_minix_main [busybox_unstripped]: 4276
-grave [busybox_unstripped]: 4260
(bzip2 users too - not listed)
price we pay in code size increase:
mainSort 2458 2515 +57
grave 1005 1058 +53
sendMTFValues 2177 2195 +18
BZ2_blockSort 122 125 +3
mkfs_minix_main 3070 3022 -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 131/-48) Total: 83 bytes
-rw-r--r-- | Makefile.custom | 2 | ||||
-rw-r--r-- | archival/bz/blocksort.c | 21 | ||||
-rw-r--r-- | archival/bz/bzlib_private.h | 19 | ||||
-rw-r--r-- | archival/bz/compress.c | 10 | ||||
-rw-r--r-- | archival/bz/huffman.c | 11 | ||||
-rwxr-xr-x | scripts/checkstack.pl | 3 | ||||
-rw-r--r-- | shell/msh.c | 15 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 24 |
8 files changed, 85 insertions, 20 deletions
diff --git a/Makefile.custom b/Makefile.custom index 5562ba396..a4db14172 100644 --- a/Makefile.custom +++ b/Makefile.custom | |||
@@ -90,7 +90,7 @@ objsizes: busybox_unstripped | |||
90 | 90 | ||
91 | .PHONY: stksizes | 91 | .PHONY: stksizes |
92 | stksizes: busybox_unstripped | 92 | stksizes: busybox_unstripped |
93 | $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | 93 | $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq |
94 | 94 | ||
95 | .PHONY: bigdata | 95 | .PHONY: bigdata |
96 | bigdata: busybox_unstripped | 96 | bigdata: busybox_unstripped |
diff --git a/archival/bz/blocksort.c b/archival/bz/blocksort.c index cddbfcbea..0e73ffeba 100644 --- a/archival/bz/blocksort.c +++ b/archival/bz/blocksort.c | |||
@@ -721,7 +721,8 @@ void mainQSort3(uint32_t* ptr, | |||
721 | #define CLEARMASK (~(SETMASK)) | 721 | #define CLEARMASK (~(SETMASK)) |
722 | 722 | ||
723 | static NOINLINE | 723 | static NOINLINE |
724 | void mainSort(uint32_t* ptr, | 724 | void mainSort(EState* state, |
725 | uint32_t* ptr, | ||
725 | uint8_t* block, | 726 | uint8_t* block, |
726 | uint16_t* quadrant, | 727 | uint16_t* quadrant, |
727 | uint32_t* ftab, | 728 | uint32_t* ftab, |
@@ -729,13 +730,18 @@ void mainSort(uint32_t* ptr, | |||
729 | int32_t* budget) | 730 | int32_t* budget) |
730 | { | 731 | { |
731 | int32_t i, j, k, ss, sb; | 732 | int32_t i, j, k, ss, sb; |
732 | int32_t runningOrder[256]; | ||
733 | Bool bigDone[256]; | ||
734 | int32_t copyStart[256]; | ||
735 | int32_t copyEnd [256]; | ||
736 | uint8_t c1; | 733 | uint8_t c1; |
737 | int32_t numQSorted; | 734 | int32_t numQSorted; |
738 | uint16_t s; | 735 | uint16_t s; |
736 | Bool bigDone[256]; | ||
737 | /* bbox: moved to EState to save stack | ||
738 | int32_t runningOrder[256]; | ||
739 | int32_t copyStart[256]; | ||
740 | int32_t copyEnd [256]; | ||
741 | */ | ||
742 | #define runningOrder (state->mainSort__runningOrder) | ||
743 | #define copyStart (state->mainSort__copyStart) | ||
744 | #define copyEnd (state->mainSort__copyEnd) | ||
739 | 745 | ||
740 | /*-- set up the 2-byte frequency table --*/ | 746 | /*-- set up the 2-byte frequency table --*/ |
741 | /* was: for (i = 65536; i >= 0; i--) ftab[i] = 0; */ | 747 | /* was: for (i = 65536; i >= 0; i--) ftab[i] = 0; */ |
@@ -985,6 +991,9 @@ void mainSort(uint32_t* ptr, | |||
985 | AssertH(((bbSize-1) >> shifts) <= 65535, 1002); | 991 | AssertH(((bbSize-1) >> shifts) <= 65535, 1002); |
986 | } | 992 | } |
987 | } | 993 | } |
994 | #undef runningOrder | ||
995 | #undef copyStart | ||
996 | #undef copyEnd | ||
988 | } | 997 | } |
989 | 998 | ||
990 | #undef BIGFREQ | 999 | #undef BIGFREQ |
@@ -1041,7 +1050,7 @@ void BZ2_blockSort(EState* s) | |||
1041 | */ | 1050 | */ |
1042 | budget = nblock * ((wfact-1) / 3); | 1051 | budget = nblock * ((wfact-1) / 3); |
1043 | 1052 | ||
1044 | mainSort(ptr, block, quadrant, ftab, nblock, &budget); | 1053 | mainSort(s, ptr, block, quadrant, ftab, nblock, &budget); |
1045 | if (budget < 0) { | 1054 | if (budget < 0) { |
1046 | fallbackSort(s->arr1, s->arr2, ftab, nblock); | 1055 | fallbackSort(s->arr1, s->arr2, ftab, nblock); |
1047 | } | 1056 | } |
diff --git a/archival/bz/bzlib_private.h b/archival/bz/bzlib_private.h index 02f177eb2..48676a391 100644 --- a/archival/bz/bzlib_private.h +++ b/archival/bz/bzlib_private.h | |||
@@ -178,13 +178,22 @@ typedef struct EState { | |||
178 | uint8_t selector [BZ_MAX_SELECTORS]; | 178 | uint8_t selector [BZ_MAX_SELECTORS]; |
179 | uint8_t selectorMtf[BZ_MAX_SELECTORS]; | 179 | uint8_t selectorMtf[BZ_MAX_SELECTORS]; |
180 | 180 | ||
181 | uint8_t len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; | 181 | uint8_t len[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; |
182 | int32_t code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; | 182 | |
183 | int32_t rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; | 183 | /* stack-saving measures: these can be local, but they are too big */ |
184 | int32_t sendMTFValues__code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; | ||
185 | int32_t sendMTFValues__rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; | ||
184 | #if CONFIG_BZIP2_FEATURE_SPEED >= 5 | 186 | #if CONFIG_BZIP2_FEATURE_SPEED >= 5 |
185 | /* second dimension: only 3 needed; 4 makes index calculations faster */ | 187 | /* second dimension: only 3 needed; 4 makes index calculations faster */ |
186 | uint32_t len_pack[BZ_MAX_ALPHA_SIZE][4]; | 188 | uint32_t sendMTFValues__len_pack[BZ_MAX_ALPHA_SIZE][4]; |
187 | #endif | 189 | #endif |
190 | int32_t BZ2_hbMakeCodeLengths__heap [BZ_MAX_ALPHA_SIZE + 2]; | ||
191 | int32_t BZ2_hbMakeCodeLengths__weight[BZ_MAX_ALPHA_SIZE * 2]; | ||
192 | int32_t BZ2_hbMakeCodeLengths__parent[BZ_MAX_ALPHA_SIZE * 2]; | ||
193 | |||
194 | int32_t mainSort__runningOrder[256]; | ||
195 | int32_t mainSort__copyStart[256]; | ||
196 | int32_t mainSort__copyEnd[256]; | ||
188 | } EState; | 197 | } EState; |
189 | 198 | ||
190 | 199 | ||
@@ -203,7 +212,7 @@ static void | |||
203 | BZ2_hbAssignCodes(int32_t*, uint8_t*, int32_t, int32_t, int32_t); | 212 | BZ2_hbAssignCodes(int32_t*, uint8_t*, int32_t, int32_t, int32_t); |
204 | 213 | ||
205 | static void | 214 | static void |
206 | BZ2_hbMakeCodeLengths(uint8_t*, int32_t*, int32_t, int32_t); | 215 | BZ2_hbMakeCodeLengths(EState*, uint8_t*, int32_t*, int32_t, int32_t); |
207 | 216 | ||
208 | /*-------------------------------------------------------------*/ | 217 | /*-------------------------------------------------------------*/ |
209 | /*--- end bzlib_private.h ---*/ | 218 | /*--- end bzlib_private.h ---*/ |
diff --git a/archival/bz/compress.c b/archival/bz/compress.c index b72edbbd4..640b8872b 100644 --- a/archival/bz/compress.c +++ b/archival/bz/compress.c | |||
@@ -264,13 +264,16 @@ void sendMTFValues(EState* s) | |||
264 | * are also globals only used in this proc. | 264 | * are also globals only used in this proc. |
265 | * Made global to keep stack frame size small. | 265 | * Made global to keep stack frame size small. |
266 | */ | 266 | */ |
267 | #define code sendMTFValues__code | ||
268 | #define rfreq sendMTFValues__rfreq | ||
269 | #define len_pack sendMTFValues__len_pack | ||
267 | 270 | ||
268 | uint16_t cost[BZ_N_GROUPS]; | 271 | uint16_t cost[BZ_N_GROUPS]; |
269 | int32_t fave[BZ_N_GROUPS]; | 272 | int32_t fave[BZ_N_GROUPS]; |
270 | 273 | ||
271 | uint16_t* mtfv = s->mtfv; | 274 | uint16_t* mtfv = s->mtfv; |
272 | 275 | ||
273 | alphaSize = s->nInUse+2; | 276 | alphaSize = s->nInUse + 2; |
274 | for (t = 0; t < BZ_N_GROUPS; t++) | 277 | for (t = 0; t < BZ_N_GROUPS; t++) |
275 | for (v = 0; v < alphaSize; v++) | 278 | for (v = 0; v < alphaSize; v++) |
276 | s->len[t][v] = BZ_GREATER_ICOST; | 279 | s->len[t][v] = BZ_GREATER_ICOST; |
@@ -453,7 +456,7 @@ void sendMTFValues(EState* s) | |||
453 | /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See | 456 | /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See |
454 | * comment in huffman.c for details. */ | 457 | * comment in huffman.c for details. */ |
455 | for (t = 0; t < nGroups; t++) | 458 | for (t = 0; t < nGroups; t++) |
456 | BZ2_hbMakeCodeLengths(&(s->len[t][0]), &(s->rfreq[t][0]), alphaSize, 17 /*20*/); | 459 | BZ2_hbMakeCodeLengths(s, &(s->len[t][0]), &(s->rfreq[t][0]), alphaSize, 17 /*20*/); |
457 | } | 460 | } |
458 | 461 | ||
459 | AssertH(nGroups < 8, 3002); | 462 | AssertH(nGroups < 8, 3002); |
@@ -602,6 +605,9 @@ void sendMTFValues(EState* s) | |||
602 | selCtr++; | 605 | selCtr++; |
603 | } | 606 | } |
604 | AssertH(selCtr == nSelectors, 3007); | 607 | AssertH(selCtr == nSelectors, 3007); |
608 | #undef code | ||
609 | #undef rfreq | ||
610 | #undef len_pack | ||
605 | } | 611 | } |
606 | 612 | ||
607 | 613 | ||
diff --git a/archival/bz/huffman.c b/archival/bz/huffman.c index 02838c496..676b1af66 100644 --- a/archival/bz/huffman.c +++ b/archival/bz/huffman.c | |||
@@ -98,7 +98,8 @@ void DOWNHEAP1(int32_t *heap, int32_t *weight, int32_t nHeap) | |||
98 | 98 | ||
99 | /*---------------------------------------------------*/ | 99 | /*---------------------------------------------------*/ |
100 | static | 100 | static |
101 | void BZ2_hbMakeCodeLengths(uint8_t *len, | 101 | void BZ2_hbMakeCodeLengths(EState *s, |
102 | uint8_t *len, | ||
102 | int32_t *freq, | 103 | int32_t *freq, |
103 | int32_t alphaSize, | 104 | int32_t alphaSize, |
104 | int32_t maxLen) | 105 | int32_t maxLen) |
@@ -110,9 +111,14 @@ void BZ2_hbMakeCodeLengths(uint8_t *len, | |||
110 | int32_t nNodes, nHeap, n1, n2, i, j, k; | 111 | int32_t nNodes, nHeap, n1, n2, i, j, k; |
111 | Bool tooLong; | 112 | Bool tooLong; |
112 | 113 | ||
114 | /* bbox: moved to EState to save stack | ||
113 | int32_t heap [BZ_MAX_ALPHA_SIZE + 2]; | 115 | int32_t heap [BZ_MAX_ALPHA_SIZE + 2]; |
114 | int32_t weight[BZ_MAX_ALPHA_SIZE * 2]; | 116 | int32_t weight[BZ_MAX_ALPHA_SIZE * 2]; |
115 | int32_t parent[BZ_MAX_ALPHA_SIZE * 2]; | 117 | int32_t parent[BZ_MAX_ALPHA_SIZE * 2]; |
118 | */ | ||
119 | #define heap (s->BZ2_hbMakeCodeLengths__heap) | ||
120 | #define weight (s->BZ2_hbMakeCodeLengths__weight) | ||
121 | #define parent (s->BZ2_hbMakeCodeLengths__parent) | ||
116 | 122 | ||
117 | for (i = 0; i < alphaSize; i++) | 123 | for (i = 0; i < alphaSize; i++) |
118 | weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; | 124 | weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; |
@@ -189,6 +195,9 @@ void BZ2_hbMakeCodeLengths(uint8_t *len, | |||
189 | weight[i] = j << 8; | 195 | weight[i] = j << 8; |
190 | } | 196 | } |
191 | } | 197 | } |
198 | #undef heap | ||
199 | #undef weight | ||
200 | #undef parent | ||
192 | } | 201 | } |
193 | 202 | ||
194 | 203 | ||
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index 6f455241a..55cdd78c1 100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl | |||
@@ -126,7 +126,8 @@ while (my $line = <STDIN>) { | |||
126 | $addr =~ s/ /0/g; | 126 | $addr =~ s/ /0/g; |
127 | $addr = "0x$addr"; | 127 | $addr = "0x$addr"; |
128 | 128 | ||
129 | my $intro = "$addr $func [$file]:"; | 129 | # bbox: was: my $intro = "$addr $func [$file]:"; |
130 | my $intro = "$func [$file]:"; | ||
130 | my $padlen = 56 - length($intro); | 131 | my $padlen = 56 - length($intro); |
131 | while ($padlen > 0) { | 132 | while ($padlen > 0) { |
132 | $intro .= ' '; | 133 | $intro .= ' '; |
diff --git a/shell/msh.c b/shell/msh.c index 32953f4ed..9f95fe28a 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -735,6 +735,9 @@ struct globals { | |||
735 | char filechar_cmdbuf[BUFSIZ]; | 735 | char filechar_cmdbuf[BUFSIZ]; |
736 | char line[LINELIM]; | 736 | char line[LINELIM]; |
737 | char child_cmd[LINELIM]; | 737 | char child_cmd[LINELIM]; |
738 | |||
739 | char grave__var_name[LINELIM]; | ||
740 | char grave__alt_value[LINELIM]; | ||
738 | }; | 741 | }; |
739 | 742 | ||
740 | #define G (*ptr_to_globals) | 743 | #define G (*ptr_to_globals) |
@@ -746,6 +749,9 @@ struct globals { | |||
746 | #define filechar_cmdbuf (G.filechar_cmdbuf) | 749 | #define filechar_cmdbuf (G.filechar_cmdbuf) |
747 | #define line (G.line ) | 750 | #define line (G.line ) |
748 | #define child_cmd (G.child_cmd ) | 751 | #define child_cmd (G.child_cmd ) |
752 | #define INIT_G() do { \ | ||
753 | PTR_TO_GLOBALS = xzalloc(sizeof(G)); \ | ||
754 | } while (0) | ||
749 | 755 | ||
750 | 756 | ||
751 | #ifdef MSHDEBUG | 757 | #ifdef MSHDEBUG |
@@ -4042,8 +4048,12 @@ static int grave(int quoted) | |||
4042 | ignore_once = 1; | 4048 | ignore_once = 1; |
4043 | if (*src == '$' && !ignore && !ignore_once) { | 4049 | if (*src == '$' && !ignore && !ignore_once) { |
4044 | struct var *vp; | 4050 | struct var *vp; |
4051 | /* moved to G to reduce stack usage | ||
4045 | char var_name[LINELIM]; | 4052 | char var_name[LINELIM]; |
4046 | char alt_value[LINELIM]; | 4053 | char alt_value[LINELIM]; |
4054 | */ | ||
4055 | #define var_name (G.grave__var_name) | ||
4056 | #define alt_value (G.grave__alt_value) | ||
4047 | int var_index = 0; | 4057 | int var_index = 0; |
4048 | int alt_index = 0; | 4058 | int alt_index = 0; |
4049 | char operator = 0; | 4059 | char operator = 0; |
@@ -4131,6 +4141,8 @@ static int grave(int quoted) | |||
4131 | count++; | 4141 | count++; |
4132 | } | 4142 | } |
4133 | } | 4143 | } |
4144 | #undef var_name | ||
4145 | #undef alt_value | ||
4134 | } else { | 4146 | } else { |
4135 | *dest++ = *src++; | 4147 | *dest++ = *src++; |
4136 | count++; | 4148 | count++; |
@@ -5173,7 +5185,8 @@ int msh_main(int argc, char **argv) | |||
5173 | char *name, **ap; | 5185 | char *name, **ap; |
5174 | int (*iof) (struct ioarg *); | 5186 | int (*iof) (struct ioarg *); |
5175 | 5187 | ||
5176 | PTR_TO_GLOBALS = xzalloc(sizeof(G)); | 5188 | INIT_G(); |
5189 | |||
5177 | sharedbuf.id = AFID_NOBUF; | 5190 | sharedbuf.id = AFID_NOBUF; |
5178 | mainbuf.id = AFID_NOBUF; | 5191 | mainbuf.id = AFID_NOBUF; |
5179 | e.linep = line; | 5192 | e.linep = line; |
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index de9dde32b..35c0ccf5c 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
@@ -109,16 +109,22 @@ struct globals { | |||
109 | unsigned long req_nr_inodes; | 109 | unsigned long req_nr_inodes; |
110 | unsigned currently_testing; | 110 | unsigned currently_testing; |
111 | 111 | ||
112 | |||
113 | char root_block[BLOCK_SIZE]; | 112 | char root_block[BLOCK_SIZE]; |
114 | char super_block_buffer[BLOCK_SIZE]; | 113 | char super_block_buffer[BLOCK_SIZE]; |
115 | char boot_block_buffer[512]; | 114 | char boot_block_buffer[512]; |
116 | unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; | 115 | unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; |
117 | /* check_blocks(): buffer[] was the biggest static in entire bbox */ | 116 | /* check_blocks(): buffer[] was the biggest static in entire bbox */ |
118 | char check_blocks_buffer[BLOCK_SIZE * TEST_BUFFER_BLOCKS]; | 117 | char check_blocks_buffer[BLOCK_SIZE * TEST_BUFFER_BLOCKS]; |
119 | }; | ||
120 | 118 | ||
119 | unsigned short ind_block1[BLOCK_SIZE >> 1]; | ||
120 | unsigned short dind_block1[BLOCK_SIZE >> 1]; | ||
121 | unsigned long ind_block2[BLOCK_SIZE >> 2]; | ||
122 | unsigned long dind_block2[BLOCK_SIZE >> 2]; | ||
123 | }; | ||
121 | #define G (*ptr_to_globals) | 124 | #define G (*ptr_to_globals) |
125 | #define INIT_G() do { \ | ||
126 | PTR_TO_GLOBALS = xzalloc(sizeof(G)); \ | ||
127 | } while (0) | ||
122 | 128 | ||
123 | static ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n) | 129 | static ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n) |
124 | { | 130 | { |
@@ -306,8 +312,12 @@ static void make_bad_inode(void) | |||
306 | struct minix1_inode *inode = &INODE_BUF1[MINIX_BAD_INO]; | 312 | struct minix1_inode *inode = &INODE_BUF1[MINIX_BAD_INO]; |
307 | int i, j, zone; | 313 | int i, j, zone; |
308 | int ind = 0, dind = 0; | 314 | int ind = 0, dind = 0; |
315 | /* moved to globals to reduce stack usage | ||
309 | unsigned short ind_block[BLOCK_SIZE >> 1]; | 316 | unsigned short ind_block[BLOCK_SIZE >> 1]; |
310 | unsigned short dind_block[BLOCK_SIZE >> 1]; | 317 | unsigned short dind_block[BLOCK_SIZE >> 1]; |
318 | */ | ||
319 | #define ind_block (G.ind_block1) | ||
320 | #define dind_block (G.dind_block1) | ||
311 | 321 | ||
312 | #define NEXT_BAD (zone = next(zone)) | 322 | #define NEXT_BAD (zone = next(zone)) |
313 | 323 | ||
@@ -351,6 +361,8 @@ static void make_bad_inode(void) | |||
351 | write_block(ind, (char *) ind_block); | 361 | write_block(ind, (char *) ind_block); |
352 | if (dind) | 362 | if (dind) |
353 | write_block(dind, (char *) dind_block); | 363 | write_block(dind, (char *) dind_block); |
364 | #undef ind_block | ||
365 | #undef dind_block | ||
354 | } | 366 | } |
355 | 367 | ||
356 | #if ENABLE_FEATURE_MINIX2 | 368 | #if ENABLE_FEATURE_MINIX2 |
@@ -359,8 +371,12 @@ static void make_bad_inode2(void) | |||
359 | struct minix2_inode *inode = &INODE_BUF2[MINIX_BAD_INO]; | 371 | struct minix2_inode *inode = &INODE_BUF2[MINIX_BAD_INO]; |
360 | int i, j, zone; | 372 | int i, j, zone; |
361 | int ind = 0, dind = 0; | 373 | int ind = 0, dind = 0; |
374 | /* moved to globals to reduce stack usage | ||
362 | unsigned long ind_block[BLOCK_SIZE >> 2]; | 375 | unsigned long ind_block[BLOCK_SIZE >> 2]; |
363 | unsigned long dind_block[BLOCK_SIZE >> 2]; | 376 | unsigned long dind_block[BLOCK_SIZE >> 2]; |
377 | */ | ||
378 | #define ind_block (G.ind_block2) | ||
379 | #define dind_block (G.dind_block2) | ||
364 | 380 | ||
365 | if (!G.badblocks) | 381 | if (!G.badblocks) |
366 | return; | 382 | return; |
@@ -401,6 +417,8 @@ static void make_bad_inode2(void) | |||
401 | write_block(ind, (char *) ind_block); | 417 | write_block(ind, (char *) ind_block); |
402 | if (dind) | 418 | if (dind) |
403 | write_block(dind, (char *) dind_block); | 419 | write_block(dind, (char *) dind_block); |
420 | #undef ind_block | ||
421 | #undef dind_block | ||
404 | } | 422 | } |
405 | #else | 423 | #else |
406 | void make_bad_inode2(void); | 424 | void make_bad_inode2(void); |
@@ -613,7 +631,7 @@ int mkfs_minix_main(int argc, char **argv) | |||
613 | char *str_i, *str_n; | 631 | char *str_i, *str_n; |
614 | char *listfile = NULL; | 632 | char *listfile = NULL; |
615 | 633 | ||
616 | PTR_TO_GLOBALS = xzalloc(sizeof(G)); | 634 | INIT_G(); |
617 | /* default (changed to 30, per Linus's suggestion, Sun Nov 21 08:05:07 1993) */ | 635 | /* default (changed to 30, per Linus's suggestion, Sun Nov 21 08:05:07 1993) */ |
618 | G.namelen = 30; | 636 | G.namelen = 30; |
619 | G.dirsize = 32; | 637 | G.dirsize = 32; |