Patch / RFC: add "flashcp" applet
Stefan Seyfried
stefan.seyfried at googlemail.com
Sat Nov 14 22:25:27 UTC 2009
On Sat, 14 Nov 2009 23:03:02 +0100
Bernhard Reutner-Fischer <rep.dot.nop at gmail.com> wrote:
> On Sat, Nov 14, 2009 at 08:00:44PM +0100, Stefan Seyfried wrote:
> >Hi,
> >
> >the attached patch implements a "flashcp" similar the one form
> >mtd-utils.
> >
> >I have read the style-guide and I think that I did everything right.
> >If so, please "git am", if not, please comment ;)
>
> CC miscutils/flashcp.o
> miscutils/flashcp.c: In function ‘flashcp_main’:
> miscutils/flashcp.c:121: warning: format ‘%.8x’ expects type ‘unsigned
> int’, but argument 2 has type ‘size_t’
> miscutils/flashcp.c:121: warning: format ‘%.8x’ expects type ‘unsigned
> int’, but argument 3 has type ‘size_t’
> miscutils/flashcp.c:121: warning: format ‘%d’ expects type ‘int’, but
> argument 5 has type ‘long unsigned int’
> miscutils/flashcp.c:128: warning: format ‘%.8x’ expects type ‘unsigned
> int’, but argument 2 has type ‘size_t’
> miscutils/flashcp.c:128: warning: format ‘%.8x’ expects type ‘unsigned
> int’, but argument 3 has type ‘size_t’
hm, did not happen to me on x86 and ppc405, but maybe I have the wrong
warning options set.
> $ ./scripts/bloat-o-meter _bb_un.orig busybox_unstripped
> function old new delta
> flashcp_main - 835 +835
> packed_usage 26028 26128 +100
> progress - 67 +67
> applet_names 2102 2110 +8
> applet_main 2496 2504 +8
> applet_nameofs 624 626 +2
> applet_install_loc 156 157 +1
> ------------------------------------------------------------------------------
> (add/remove: 2/0 grow/shrink: 5/0 up/down: 1021/0) Total: 1021
> bytes
>
> $ size miscutils/flashcp.o
> text data bss dec hex filename
> 1344 0 0 1344 540 miscutils/flashcp.o
>
> 1.3k
> don't get me wrong, but this applet seems to:
> -) loop through mtd, eraseing 1k
> -) loop through file, bb_copyfd_exact_size()
but bb_copyfd_exact_size does not do progress indication. And I know
nobody who uses flashcp without "-v" parameter ;) (usually, it is a
quite time consuming operation, in the order of tens of seconds to a
few minutes, so progress indication is really useful)
> and verify bytes re-read do memcmp==0 bytes written
>
> Sounds more like 600b-800b than more than 1k, no?
To be honest, I have no real feeling for how big an applet should be,
but I trust you on your numbers, and thus I will try to squeeze a few
more bytes out of it ;)
> I encourage you to license your new applet under GPLv2 *or later* so we
> don't have to rewrite it later on (eventually).
That's no problem. Even though I am pretty reluctant to trust the FSF
on future decisions, this piece of Code is so trivial that it might as
well be licensed under the WTFPL v2 ;-)
> Anyway. Attached patch would kill off 100b, but i think rewriting it
> from scratch would be easier.
Just one note:
+ filename = *argv++;
+ devicename = *argv;
I had something like that before (instead of argv[0]), but it resulted
in significantly bigger code.
I did not understand why, but it was definitely true.
--
Stefan Seyfried
"Any ideas, John?"
"Well, surrounding them's out."
More information about the busybox
mailing list