wok-4.x rev 3214

busybox: add replay, speedup unlzma
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 28 13:57:09 2009 +0200 (2009-05-28)
parents db989f95819d
children 2ebadeb1077e
files busybox/receipt busybox/stuff/busybox-1.12.0-replay.u busybox/stuff/busybox-1.12.0-unlzma.u busybox/stuff/busybox-1.12.0.config
line diff
     1.1 --- a/busybox/receipt	Thu May 28 11:47:11 2009 +0200
     1.2 +++ b/busybox/receipt	Thu May 28 13:57:09 2009 +0200
     1.3 @@ -34,6 +34,8 @@
     1.4  mkswap.u
     1.5  install.u
     1.6  basename.u
     1.7 +unlzma.u
     1.8 +replay.u
     1.9  EOT
    1.10      cp ../stuff/$PACKAGE-$VERSION.config .config
    1.11      make oldconfig
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/busybox/stuff/busybox-1.12.0-replay.u	Thu May 28 13:57:09 2009 +0200
     2.3 @@ -0,0 +1,222 @@
     2.4 +--- busybox-1.12.0/util-linux/script.c
     2.5 ++++ busybox-1.12.0/util-linux/script.c
     2.6 +@@ -36,6 +36,15 @@
     2.7 + 	const char *shell;
     2.8 + 	char shell_opt[] = "-i";
     2.9 + 	char *shell_arg = NULL;
    2.10 ++	enum {
    2.11 ++		OPT_a = (1 << 0),
    2.12 ++		OPT_c = (1 << 1),
    2.13 ++		OPT_f = (1 << 2),
    2.14 ++		OPT_q = (1 << 3),
    2.15 ++#if ENABLE_REPLAY
    2.16 ++		OPT_t = (1 << 4),
    2.17 ++#endif
    2.18 ++	};
    2.19 + 
    2.20 + #if ENABLE_GETOPT_LONG
    2.21 + 	static const char getopt_longopts[] ALIGN1 =
    2.22 +@@ -43,25 +52,28 @@
    2.23 + 		"command\0" Required_argument "c"
    2.24 + 		"flush\0"   No_argument       "f"
    2.25 + 		"quiet\0"   No_argument       "q"
    2.26 ++# if ENABLE_REPLAY
    2.27 ++		"timing\0"  No_argument       "t"
    2.28 ++# endif
    2.29 + 		;
    2.30 + 
    2.31 + 	applet_long_options = getopt_longopts;
    2.32 + #endif
    2.33 + 	opt_complementary = "?1"; /* max one arg */
    2.34 +-	opt = getopt32(argv, "ac:fq", &shell_arg);
    2.35 ++	opt = getopt32(argv, "ac:fq" USE_REPLAY("t") , &shell_arg);
    2.36 + 	//argc -= optind;
    2.37 + 	argv += optind;
    2.38 + 	if (argv[0]) {
    2.39 + 		fname = argv[0];
    2.40 + 	}
    2.41 + 	mode = O_CREAT|O_TRUNC|O_WRONLY;
    2.42 +-	if (opt & 1) {
    2.43 ++	if (opt & OPT_a) {
    2.44 + 		mode = O_CREAT|O_APPEND|O_WRONLY;
    2.45 + 	}
    2.46 +-	if (opt & 2) {
    2.47 ++	if (opt & OPT_c) {
    2.48 + 		shell_opt[1] = 'c';
    2.49 + 	}
    2.50 +-	if (!(opt & 8)) { /* not -q */
    2.51 ++	if (!(opt & OPT_q)) {
    2.52 + 		printf("Script started, file is %s\n", fname);
    2.53 + 	}
    2.54 + 	shell = getenv("SHELL");
    2.55 +@@ -97,6 +109,10 @@
    2.56 + #define buf bb_common_bufsiz1
    2.57 + 		struct pollfd pfd[2];
    2.58 + 		int outfd, count, loop;
    2.59 ++#if ENABLE_REPLAY
    2.60 ++		struct timeval tv;
    2.61 ++		double oldtime=time(NULL), newtime;
    2.62 ++#endif
    2.63 + 
    2.64 + 		outfd = xopen(fname, mode);
    2.65 + 		pfd[0].fd = pty;
    2.66 +@@ -118,15 +134,27 @@
    2.67 + 			}
    2.68 + 			if (pfd[0].revents) {
    2.69 + 				errno = 0;
    2.70 ++#if ENABLE_REPLAY
    2.71 ++				if (opt & OPT_t) {
    2.72 ++					gettimeofday(&tv, NULL);
    2.73 ++				}
    2.74 ++#endif
    2.75 + 				count = safe_read(pty, buf, sizeof(buf));
    2.76 + 				if (count <= 0 && errno != EAGAIN) {
    2.77 + 					/* err/eof from pty: exit */
    2.78 + 					goto restore;
    2.79 + 				}
    2.80 + 				if (count > 0) {
    2.81 ++#if ENABLE_REPLAY
    2.82 ++					if (opt & OPT_t) {
    2.83 ++						newtime = tv.tv_sec + (double) tv.tv_usec / 1000000;
    2.84 ++						fprintf(stderr, "%f %i\n", newtime - oldtime, count);
    2.85 ++						oldtime = newtime;
    2.86 ++					}
    2.87 ++#endif
    2.88 + 					full_write(STDOUT_FILENO, buf, count);
    2.89 + 					full_write(outfd, buf, count);
    2.90 +-					if (opt & 4) { /* -f */
    2.91 ++					if (opt & OPT_f) {
    2.92 + 						fsync(outfd);
    2.93 + 					}
    2.94 + 				}
    2.95 +@@ -158,7 +186,7 @@
    2.96 +  restore:
    2.97 + 		if (attr_ok == 0)
    2.98 + 			tcsetattr(0, TCSAFLUSH, &tt);
    2.99 +-		if (!(opt & 8)) /* not -q */
   2.100 ++		if (!(opt & OPT_q))
   2.101 + 			printf("Script done, file is %s\n", fname);
   2.102 + 		return EXIT_SUCCESS;
   2.103 + 	}
   2.104 +
   2.105 +--- busybox-1.12.0/util-linux/Config.in
   2.106 ++++ busybox-1.12.0/util-linux/Config.in
   2.107 +@@ -719,6 +719,13 @@
   2.108 + 	help
   2.109 + 	  This allows you to parse /proc/profile for basic profiling.
   2.110 + 
   2.111 ++config REPLAY
   2.112 ++	bool "replay"
   2.113 ++	default n
   2.114 ++	help
   2.115 ++	  This program replays a typescript, using timing information
   2.116 ++	  given by script -t.
   2.117 ++
   2.118 + config RTCWAKE
   2.119 + 	bool "rtcwake"
   2.120 + 	default n
   2.121 +
   2.122 +--- busybox-1.12.0/util-linux/Kbuild
   2.123 ++++ busybox-1.12.0/util-linux/Kbuild
   2.124 +@@ -28,6 +28,7 @@
   2.125 + lib-$(CONFIG_RDATE)             += rdate.o
   2.126 + lib-$(CONFIG_RDEV)              += rdev.o
   2.127 + lib-$(CONFIG_READPROFILE)       += readprofile.o
   2.128 ++lib-$(CONFIG_REPLAY)            += replay.o
   2.129 + lib-$(CONFIG_RTCWAKE)           += rtcwake.o
   2.130 + lib-$(CONFIG_SCRIPT)            += script.o
   2.131 + lib-$(CONFIG_SETARCH)           += setarch.o
   2.132 +
   2.133 +--- busybox-1.12.0/include/applets.h
   2.134 +USE_RM(APPLET_NOFORK(rm, rm, _BB_DIR_BIN, _BB_SUID_NEVER, rm))
   2.135 ++++ busybox-1.12.0/include/applets.h
   2.136 +@@ -294,6 +294,7 @@
   2.137 + USE_REALPATH(APPLET(realpath, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
   2.138 + USE_HALT(APPLET_ODDNAME(reboot, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, reboot))
   2.139 + USE_RENICE(APPLET(renice, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
   2.140 ++USE_REPLAY(APPLET(replay, _BB_DIR_BIN, _BB_SUID_NEVER))
   2.141 + USE_RESET(APPLET(reset, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
   2.142 + USE_RESIZE(APPLET(resize, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
   2.143 + USE_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, _BB_DIR_SBIN, _BB_SUID_NEVER, restorecon))
   2.144 +
   2.145 +--- busybox-1.12.0/include/usage.h
   2.146 ++++ busybox-1.12.0/include/usage.h
   2.147 +@@ -3244,6 +3244,11 @@
   2.148 +      "\n	-g	Process group id(s)" \
   2.149 +      "\n	-u	Process user name(s) and/or id(s)" \
   2.150 + 
   2.151 ++#define replay_trivial_usage \
   2.152 ++       "timingfile [typescript [divisor]]"
   2.153 ++#define replay_full_usage "\n\n" \
   2.154 ++       "Play back typescripts, using timing information"
   2.155 ++
   2.156 + #define reset_trivial_usage \
   2.157 +        ""
   2.158 + #define reset_full_usage "\n\n" \
   2.159 +@@ -3426,13 +3431,20 @@
   2.160 + 
   2.161 + #define script_trivial_usage \
   2.162 +        "[-afq] [-c COMMAND] [OUTFILE]"
   2.163 +-#define script_full_usage "\n\n" \
   2.164 ++#define script_full_usage_base "\n\n" \
   2.165 +        "Options:" \
   2.166 +      "\n	-a	Append output" \
   2.167 +      "\n	-c	Run COMMAND, not shell" \
   2.168 +      "\n	-f	Flush output after each write" \
   2.169 +      "\n	-q	Quiet" \
   2.170 + 
   2.171 ++#ifdef USE_REPLAY
   2.172 ++#define script_full_usage script_full_usage_base \
   2.173 ++     "\n	-t	Send timing to stderr"
   2.174 ++#else
   2.175 ++#define script_full_usage script_full_usage_base
   2.176 ++#endif
   2.177 ++
   2.178 + #define sed_trivial_usage \
   2.179 +        "[-efinr] pattern [files...]"
   2.180 + #define sed_full_usage "\n\n" \
   2.181 +
   2.182 +--- busybox-1.12.0/util-linux/replay.c
   2.183 ++++ busybox-1.12.0/util-linux/replay.c
   2.184 +@@ -0,0 +1,41 @@
   2.185 ++/* vi: set sw=4 ts=4: */
   2.186 ++/*
   2.187 ++ * replay - play back typescripts, using timing information
   2.188 ++ *
   2.189 ++ * pascal.bellard@ads-lu.com
   2.190 ++ *
   2.191 ++ * Licensed under GPLv2 or later, see file License in this tarball for details.
   2.192 ++ *
   2.193 ++ */
   2.194 ++
   2.195 ++#include "libbb.h"
   2.196 ++
   2.197 ++int replay_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
   2.198 ++int replay_main(int argc, char **argv)
   2.199 ++{
   2.200 ++	const char *script = "typescript";
   2.201 ++	double delay, factor = 1000000.0;
   2.202 ++	int fd;
   2.203 ++	long count;
   2.204 ++	FILE *tfp;
   2.205 ++
   2.206 ++	switch (argc) {
   2.207 ++	case 4: factor /= atof(argv[3]);
   2.208 ++	case 3: script = argv[2];
   2.209 ++	case 2:	break;
   2.210 ++	default:
   2.211 ++		bb_show_usage();
   2.212 ++	}
   2.213 ++
   2.214 ++	tfp = xfopen_for_read(argv[1]);
   2.215 ++	fd = open(script, O_RDONLY);
   2.216 ++	while (fscanf(tfp, "%lf %ld\n", &delay, &count) == 2) {
   2.217 ++		usleep(delay * factor);
   2.218 ++		bb_copyfd_exact_size(fd, STDOUT_FILENO, count);
   2.219 ++	}
   2.220 ++#if ENABLE_FEATURE_CLEAN_UP
   2.221 ++	close(fd);
   2.222 ++	fclose(tfp);
   2.223 ++#endif
   2.224 ++	return EXIT_SUCCESS;
   2.225 ++}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/busybox/stuff/busybox-1.12.0-unlzma.u	Thu May 28 13:57:09 2009 +0200
     3.3 @@ -0,0 +1,302 @@
     3.4 +--- busybox-1.12.0/archival/libunarchive/decompress_unlzma.c
     3.5 ++++ busybox-1.12.0/archival/libunarchive/decompress_unlzma.c
     3.6 +@@ -14,8 +14,10 @@
     3.7 + 
     3.8 + #if ENABLE_FEATURE_LZMA_FAST
     3.9 + #  define speed_inline ALWAYS_INLINE
    3.10 ++#  define size_inline
    3.11 + #else
    3.12 + #  define speed_inline
    3.13 ++#  define size_inline ALWAYS_INLINE
    3.14 + #endif
    3.15 + 
    3.16 + 
    3.17 +@@ -44,8 +46,8 @@
    3.18 + #define RC_MODEL_TOTAL_BITS 11
    3.19 + 
    3.20 + 
    3.21 +-/* Called twice: once at startup and once in rc_normalize() */
    3.22 +-static void rc_read(rc_t *rc)
    3.23 ++/* Called twice: once at startup (LZMA_FAST only) and once in rc_normalize() */
    3.24 ++static size_inline void rc_read(rc_t *rc)
    3.25 + {
    3.26 + 	int buffer_size = safe_read(rc->fd, RC_BUFFER, RC_BUFFER_SIZE);
    3.27 + 	if (buffer_size <= 0)
    3.28 +@@ -54,8 +56,17 @@
    3.29 + 	rc->buffer_end = RC_BUFFER + buffer_size;
    3.30 + }
    3.31 + 
    3.32 ++/* Called twice, but one callsite is in speed_inline'd rc_is_bit_1() */
    3.33 ++static void rc_do_normalize(rc_t *rc)
    3.34 ++{
    3.35 ++	if (rc->ptr >= rc->buffer_end)
    3.36 ++		rc_read(rc);
    3.37 ++	rc->range <<= 8;
    3.38 ++	rc->code = (rc->code << 8) | *rc->ptr++;
    3.39 ++}
    3.40 ++
    3.41 + /* Called once */
    3.42 +-static rc_t* rc_init(int fd) /*, int buffer_size) */
    3.43 ++static ALWAYS_INLINE rc_t* rc_init(int fd) /*, int buffer_size) */
    3.44 + {
    3.45 + 	int i;
    3.46 + 	rc_t *rc;
    3.47 +@@ -63,17 +74,18 @@
    3.48 + 	rc = xmalloc(sizeof(*rc) + RC_BUFFER_SIZE);
    3.49 + 
    3.50 + 	rc->fd = fd;
    3.51 +-	/* rc->buffer_size = buffer_size; */
    3.52 +-	rc->buffer_end = RC_BUFFER + RC_BUFFER_SIZE;
    3.53 + 	rc->ptr = rc->buffer_end;
    3.54 + 
    3.55 +-	rc->code = 0;
    3.56 +-	rc->range = 0xFFFFFFFF;
    3.57 + 	for (i = 0; i < 5; i++) {
    3.58 ++#if ENABLE_FEATURE_LZMA_FAST
    3.59 + 		if (rc->ptr >= rc->buffer_end)
    3.60 + 			rc_read(rc);
    3.61 + 		rc->code = (rc->code << 8) | *rc->ptr++;
    3.62 ++#else
    3.63 ++		rc_do_normalize(rc);
    3.64 ++#endif
    3.65 + 	}
    3.66 ++	rc->range = 0xFFFFFFFF;
    3.67 + 	return rc;
    3.68 + }
    3.69 + 
    3.70 +@@ -83,14 +95,6 @@
    3.71 + 	free(rc);
    3.72 + }
    3.73 + 
    3.74 +-/* Called twice, but one callsite is in speed_inline'd rc_is_bit_0_helper() */
    3.75 +-static void rc_do_normalize(rc_t *rc)
    3.76 +-{
    3.77 +-	if (rc->ptr >= rc->buffer_end)
    3.78 +-		rc_read(rc);
    3.79 +-	rc->range <<= 8;
    3.80 +-	rc->code = (rc->code << 8) | *rc->ptr++;
    3.81 +-}
    3.82 + static ALWAYS_INLINE void rc_normalize(rc_t *rc)
    3.83 + {
    3.84 + 	if (rc->range < (1 << RC_TOP_BITS)) {
    3.85 +@@ -98,49 +102,30 @@
    3.86 + 	}
    3.87 + }
    3.88 + 
    3.89 +-/* rc_is_bit_0 is called 9 times */
    3.90 +-/* Why rc_is_bit_0_helper exists?
    3.91 +- * Because we want to always expose (rc->code < rc->bound) to optimizer.
    3.92 +- * Thus rc_is_bit_0 is always inlined, and rc_is_bit_0_helper is inlined
    3.93 +- * only if we compile for speed.
    3.94 +- */
    3.95 +-static speed_inline uint32_t rc_is_bit_0_helper(rc_t *rc, uint16_t *p)
    3.96 ++/* rc_is_bit_1 is called 9 times */
    3.97 ++static speed_inline int rc_is_bit_1(rc_t *rc, uint16_t *p)
    3.98 + {
    3.99 + 	rc_normalize(rc);
   3.100 + 	rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
   3.101 +-	return rc->bound;
   3.102 ++	if (rc->code < rc->bound) {
   3.103 ++		rc->range = rc->bound;
   3.104 ++		*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
   3.105 ++		return 0;
   3.106 ++	}
   3.107 ++	else {
   3.108 ++		rc->range -= rc->bound;
   3.109 ++		rc->code -= rc->bound;
   3.110 ++		*p -= *p >> RC_MOVE_BITS;
   3.111 ++		return 1;
   3.112 ++	}
   3.113 + }
   3.114 +-static ALWAYS_INLINE int rc_is_bit_0(rc_t *rc, uint16_t *p)
   3.115 +-{
   3.116 +-	uint32_t t = rc_is_bit_0_helper(rc, p);
   3.117 +-	return rc->code < t;
   3.118 +-}
   3.119 + 
   3.120 +-/* Called ~10 times, but very small, thus inlined */
   3.121 +-static speed_inline void rc_update_bit_0(rc_t *rc, uint16_t *p)
   3.122 +-{
   3.123 +-	rc->range = rc->bound;
   3.124 +-	*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
   3.125 +-}
   3.126 +-static speed_inline void rc_update_bit_1(rc_t *rc, uint16_t *p)
   3.127 +-{
   3.128 +-	rc->range -= rc->bound;
   3.129 +-	rc->code -= rc->bound;
   3.130 +-	*p -= *p >> RC_MOVE_BITS;
   3.131 +-}
   3.132 +-
   3.133 + /* Called 4 times in unlzma loop */
   3.134 +-static int rc_get_bit(rc_t *rc, uint16_t *p, int *symbol)
   3.135 ++static speed_inline int rc_get_bit(rc_t *rc, uint16_t *p, int *symbol)
   3.136 + {
   3.137 +-	if (rc_is_bit_0(rc, p)) {
   3.138 +-		rc_update_bit_0(rc, p);
   3.139 +-		*symbol *= 2;
   3.140 +-		return 0;
   3.141 +-	} else {
   3.142 +-		rc_update_bit_1(rc, p);
   3.143 +-		*symbol = *symbol * 2 + 1;
   3.144 +-		return 1;
   3.145 +-	}
   3.146 ++	int ret = rc_is_bit_1(rc, p);
   3.147 ++	*symbol = *symbol * 2 + ret;
   3.148 ++	return ret;
   3.149 + }
   3.150 + 
   3.151 + /* Called once */
   3.152 +@@ -266,13 +251,13 @@
   3.153 + 	header.dst_size = SWAP_LE64(header.dst_size);
   3.154 + 
   3.155 + 	if (header.dict_size == 0)
   3.156 +-		header.dict_size = 1;
   3.157 ++		header.dict_size++;
   3.158 + 
   3.159 + 	buffer = xmalloc(MIN(header.dst_size, header.dict_size));
   3.160 + 
   3.161 + 	num_probs = LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp));
   3.162 + 	p = xmalloc(num_probs * sizeof(*p));
   3.163 +-	num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp));
   3.164 ++	num_probs += LZMA_LITERAL - LZMA_BASE_SIZE;
   3.165 + 	for (i = 0; i < num_probs; i++)
   3.166 + 		p[i] = (1 << RC_MODEL_TOTAL_BITS) >> 1;
   3.167 + 
   3.168 +@@ -282,9 +267,8 @@
   3.169 + 		int pos_state = (buffer_pos + global_pos) & pos_state_mask;
   3.170 + 
   3.171 + 		prob = p + LZMA_IS_MATCH + (state << LZMA_NUM_POS_BITS_MAX) + pos_state;
   3.172 +-		if (rc_is_bit_0(rc, prob)) {
   3.173 ++		if (!rc_is_bit_1(rc, prob)) {
   3.174 + 			mi = 1;
   3.175 +-			rc_update_bit_0(rc, prob);
   3.176 + 			prob = (p + LZMA_LITERAL
   3.177 + 			        + (LZMA_LIT_SIZE * ((((buffer_pos + global_pos) & literal_pos_mask) << lc)
   3.178 + 			                            + (previous_byte >> (8 - lc))
   3.179 +@@ -340,26 +324,21 @@
   3.180 + 			int offset;
   3.181 + 			uint16_t *prob_len;
   3.182 + 
   3.183 +-			rc_update_bit_1(rc, prob);
   3.184 + 			prob = p + LZMA_IS_REP + state;
   3.185 +-			if (rc_is_bit_0(rc, prob)) {
   3.186 +-				rc_update_bit_0(rc, prob);
   3.187 ++			if (!rc_is_bit_1(rc, prob)) {
   3.188 + 				rep3 = rep2;
   3.189 + 				rep2 = rep1;
   3.190 + 				rep1 = rep0;
   3.191 + 				state = state < LZMA_NUM_LIT_STATES ? 0 : 3;
   3.192 + 				prob = p + LZMA_LEN_CODER;
   3.193 + 			} else {
   3.194 +-				rc_update_bit_1(rc, prob);
   3.195 +-				prob = p + LZMA_IS_REP_G0 + state;
   3.196 +-				if (rc_is_bit_0(rc, prob)) {
   3.197 +-					rc_update_bit_0(rc, prob);
   3.198 ++				prob += LZMA_IS_REP_G0 - LZMA_IS_REP;
   3.199 ++				if (!rc_is_bit_1(rc, prob)) {
   3.200 + 					prob = (p + LZMA_IS_REP_0_LONG
   3.201 + 					        + (state << LZMA_NUM_POS_BITS_MAX)
   3.202 + 					        + pos_state
   3.203 + 					);
   3.204 +-					if (rc_is_bit_0(rc, prob)) {
   3.205 +-						rc_update_bit_0(rc, prob);
   3.206 ++					if (!rc_is_bit_1(rc, prob)) {
   3.207 + 
   3.208 + 						state = state < LZMA_NUM_LIT_STATES ? 9 : 11;
   3.209 + #if ENABLE_FEATURE_LZMA_FAST
   3.210 +@@ -372,25 +351,16 @@
   3.211 + 						len = 1;
   3.212 + 						goto string;
   3.213 + #endif
   3.214 +-					} else {
   3.215 +-						rc_update_bit_1(rc, prob);
   3.216 + 					}
   3.217 + 				} else {
   3.218 + 					uint32_t distance;
   3.219 + 
   3.220 +-					rc_update_bit_1(rc, prob);
   3.221 +-					prob = p + LZMA_IS_REP_G1 + state;
   3.222 +-					if (rc_is_bit_0(rc, prob)) {
   3.223 +-						rc_update_bit_0(rc, prob);
   3.224 +-						distance = rep1;
   3.225 +-					} else {
   3.226 +-						rc_update_bit_1(rc, prob);
   3.227 +-						prob = p + LZMA_IS_REP_G2 + state;
   3.228 +-						if (rc_is_bit_0(rc, prob)) {
   3.229 +-							rc_update_bit_0(rc, prob);
   3.230 +-							distance = rep2;
   3.231 +-						} else {
   3.232 +-							rc_update_bit_1(rc, prob);
   3.233 ++					prob += LZMA_IS_REP_G1 - LZMA_IS_REP_G0;
   3.234 ++					distance = rep1;
   3.235 ++					if (rc_is_bit_1(rc, prob)) {
   3.236 ++						prob += LZMA_IS_REP_G2 - LZMA_IS_REP_G1;
   3.237 ++						distance = rep2;
   3.238 ++						if (rc_is_bit_1(rc, prob)) {
   3.239 + 							distance = rep3;
   3.240 + 							rep3 = rep2;
   3.241 + 						}
   3.242 +@@ -404,24 +374,20 @@
   3.243 + 			}
   3.244 + 
   3.245 + 			prob_len = prob + LZMA_LEN_CHOICE;
   3.246 +-			if (rc_is_bit_0(rc, prob_len)) {
   3.247 +-				rc_update_bit_0(rc, prob_len);
   3.248 +-				prob_len = (prob + LZMA_LEN_LOW
   3.249 +-				            + (pos_state << LZMA_LEN_NUM_LOW_BITS));
   3.250 ++			if (!rc_is_bit_1(rc, prob_len)) {
   3.251 ++				prob_len += LZMA_LEN_LOW - LZMA_LEN_CHOICE
   3.252 ++				            + (pos_state << LZMA_LEN_NUM_LOW_BITS);
   3.253 + 				offset = 0;
   3.254 + 				num_bits = LZMA_LEN_NUM_LOW_BITS;
   3.255 + 			} else {
   3.256 +-				rc_update_bit_1(rc, prob_len);
   3.257 +-				prob_len = prob + LZMA_LEN_CHOICE_2;
   3.258 +-				if (rc_is_bit_0(rc, prob_len)) {
   3.259 +-					rc_update_bit_0(rc, prob_len);
   3.260 +-					prob_len = (prob + LZMA_LEN_MID
   3.261 +-					            + (pos_state << LZMA_LEN_NUM_MID_BITS));
   3.262 ++				prob_len += LZMA_LEN_CHOICE_2 - LZMA_LEN_CHOICE;
   3.263 ++				if (!rc_is_bit_1(rc, prob_len)) {
   3.264 ++					prob_len += LZMA_LEN_MID - LZMA_LEN_CHOICE_2
   3.265 ++					            + (pos_state << LZMA_LEN_NUM_MID_BITS);
   3.266 + 					offset = 1 << LZMA_LEN_NUM_LOW_BITS;
   3.267 + 					num_bits = LZMA_LEN_NUM_MID_BITS;
   3.268 + 				} else {
   3.269 +-					rc_update_bit_1(rc, prob_len);
   3.270 +-					prob_len = prob + LZMA_LEN_HIGH;
   3.271 ++					prob_len += LZMA_LEN_HIGH - LZMA_LEN_CHOICE_2;
   3.272 + 					offset = ((1 << LZMA_LEN_NUM_LOW_BITS)
   3.273 + 					          + (1 << LZMA_LEN_NUM_MID_BITS));
   3.274 + 					num_bits = LZMA_LEN_NUM_HIGH_BITS;
   3.275 +@@ -440,17 +406,18 @@
   3.276 + 				         << LZMA_NUM_POS_SLOT_BITS);
   3.277 + 				rc_bit_tree_decode(rc, prob, LZMA_NUM_POS_SLOT_BITS,
   3.278 + 								   &pos_slot);
   3.279 ++				rep0 = pos_slot;
   3.280 + 				if (pos_slot >= LZMA_START_POS_MODEL_INDEX) {
   3.281 + 					num_bits = (pos_slot >> 1) - 1;
   3.282 + 					rep0 = 2 | (pos_slot & 1);
   3.283 ++					prob = p + LZMA_ALIGN;
   3.284 + 					if (pos_slot < LZMA_END_POS_MODEL_INDEX) {
   3.285 + 						rep0 <<= num_bits;
   3.286 +-						prob = p + LZMA_SPEC_POS + rep0 - pos_slot - 1;
   3.287 ++						prob += LZMA_SPEC_POS - LZMA_ALIGN - 1 + rep0 - pos_slot ;
   3.288 + 					} else {
   3.289 + 						num_bits -= LZMA_NUM_ALIGN_BITS;
   3.290 + 						while (num_bits--)
   3.291 + 							rep0 = (rep0 << 1) | rc_direct_bit(rc);
   3.292 +-						prob = p + LZMA_ALIGN;
   3.293 + 						rep0 <<= LZMA_NUM_ALIGN_BITS;
   3.294 + 						num_bits = LZMA_NUM_ALIGN_BITS;
   3.295 + 					}
   3.296 +@@ -461,8 +428,7 @@
   3.297 + 							rep0 |= i;
   3.298 + 						i <<= 1;
   3.299 + 					}
   3.300 +-				} else
   3.301 +-					rep0 = pos_slot;
   3.302 ++				}
   3.303 + 				if (++rep0 == 0)
   3.304 + 					break;
   3.305 + 			}
     4.1 --- a/busybox/stuff/busybox-1.12.0.config	Thu May 28 11:47:11 2009 +0200
     4.2 +++ b/busybox/stuff/busybox-1.12.0.config	Thu May 28 13:57:09 2009 +0200
     4.3 @@ -1,7 +1,7 @@
     4.4  #
     4.5  # Automatically generated make config: don't edit
     4.6  # Busybox version: 1.12.0
     4.7 -# Wed May 27 18:07:33 2009
     4.8 +# Thu May 28 13:47:09 2009
     4.9  #
    4.10  CONFIG_HAVE_DOT_CONFIG=y
    4.11  
    4.12 @@ -500,7 +500,7 @@
    4.13  CONFIG_FEATURE_VOLUMEID_EXT=y
    4.14  CONFIG_FEATURE_VOLUMEID_REISERFS=y
    4.15  CONFIG_FEATURE_VOLUMEID_FAT=y
    4.16 -# CONFIG_FEATURE_VOLUMEID_HFS is not set
    4.17 +CONFIG_FEATURE_VOLUMEID_HFS=y
    4.18  # CONFIG_FEATURE_VOLUMEID_JFS is not set
    4.19  CONFIG_FEATURE_VOLUMEID_XFS=y
    4.20  CONFIG_FEATURE_VOLUMEID_NTFS=y
    4.21 @@ -526,6 +526,7 @@
    4.22  CONFIG_RDATE=y
    4.23  # CONFIG_RDEV is not set
    4.24  CONFIG_READPROFILE=y
    4.25 +CONFIG_REPLAY=y
    4.26  # CONFIG_RTCWAKE is not set
    4.27  CONFIG_SCRIPT=y
    4.28  CONFIG_SETARCH=y