Commit Graph

142 Commits

Author SHA1 Message Date
Denis Vlasenko
6bef3d1d22 fbset: fix buglet where we were using wrong pointer
readahead: stop using stdio.h
*: style fixes
2007-11-06 03:05:54 +00:00
Denis Vlasenko
bfc3d82256 ifconfig: code shrink
adjtimex: code shrink
libbb: move nth_string function into libbb
hdparm: nth_string was here

   text    data     bss     dec     hex filename
 730013   10334   12032  752379   b7afb busybox_old
 730093   10134   12032  752259   b7a83 busybox_unstripped
2007-11-04 04:10:17 +00:00
Denis Vlasenko
9130340adf hdparm: code shrink
text    data     bss     dec     hex filename
 776494     974    9420  786888   c01c8 busybox_old
 776099     974    9420  786493   c003d busybox_unstripped
2007-10-30 19:36:54 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
feb7ae7f01 printf("%s\n") -> puts() 2007-10-01 12:05:12 +00:00
Denis Vlasenko
0afdfdf649 hdparm: paranoia-induced fix against theoretical div-by-0 case 2007-09-28 13:41:41 +00:00
Denis Vlasenko
920c52a5c8 hdparm: more robust (re overflows) code. +38 bytes. 2007-09-28 13:38:08 +00:00
Denis Vlasenko
a7bc9ac8f8 hdparm: reduce possibility of numeric overflow in -T.
do_time                                              386     410     +24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 24/0)               Total: 24 bytes
2007-09-28 11:21:47 +00:00
Denis Vlasenko
c3122bca53 hdparm: simplify timing measurement (it wa the last last user
of setitimer in the tree).

static.thousand                                       16       -     -16
read_big_block                                        81      46     -35
getitimer                                             41       -     -41
setitimer                                             47       -     -47
__GI_setitimer                                        47       -     -47
do_time                                              480     386     -94
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 0/2 up/down: 0/-280)           Total: -280 bytes

M    miscutils/hdparm.c
2007-09-28 10:28:03 +00:00
Denis Vlasenko
0d3c6afc93 hdparm: get rid of static variables
process_dev                                         5309    5311      +2
unregister_hwif                                        1       -      -1
...........
Xreadahead                                             4       -      -4
seek_to_zero                                          25      17      -8
hdparm_main                                         1242    1227     -15
do_time                                              547     480     -67
------------------------------------------------------------------------------
(add/remove: 0/83 grow/shrink: 1/3 up/down: 2/-248)          Total: -246 bytes
2007-09-28 10:25:32 +00:00
Denis Vlasenko
892536f019 hdparm: use fixed fd #3 for device being interrogated
(surprisingly, on i386 almost no code size change)
2007-09-27 10:23:34 +00:00
Denis Vlasenko
4daad9004d introduce bb_putchar(). saves ~1800 on uclibc (less on glibc). 2007-09-27 10:20:47 +00:00
Denis Vlasenko
a0319ba936 hdparm: shrink rodata by ~250 bytes 2007-08-16 10:37:49 +00:00
Denis Vlasenko
6a2f7f41cf whitespace fixes, no code changes 2007-08-16 10:35:17 +00:00
Denis Vlasenko
6ca409e0e4 trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
  of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts

size saving: 0.5k
2007-08-12 20:58:27 +00:00
Denis Vlasenko
49a128a156 remove accumulated stray trailing whitespace 2007-07-17 21:42:59 +00:00
Denis Vlasenko
fb79a2e2cf xioctl and friends by Tito <farmatito@tiscali.it>
function                                             old     new   delta
do_iptunnel                                          203     977    +774
process_dev                                         5328    5494    +166
ioctl_or_perror                                        -      54     +54
ioctl_or_perror_and_die                                -      51     +51
ioctl_alt_func                                         -      49     +49
bb_ioctl_or_warn                                       -      47     +47
do_add_ioctl                                         102     145     +43
bb_xioctl                                              -      39     +39
print_value_on_off                                     -      31     +31
get_lcm                                              105     123     +18
arp_main                                            2155    2167     +12
..................
zcip_main                                           1576    1566     -10
setlogcons_main                                       92      82     -10
dumpkmap_main                                        263     253     -10
do_get_ioctl                                          85      75     -10
setkeycodes_main                                     165     154     -11
write_table                                          244     232     -12
vconfig_main                                         318     306     -12
do_del_ioctl                                          93      81     -12
set_address                                           75      62     -13
maybe_set_utc                                         30      16     -14
loadfont_main                                        495     479     -16
slattach_main                                        712     695     -17
do_loadfont                                          191     174     -17
do_iplink                                           1155    1136     -19
getty_main                                          2583    2562     -21
fbset_main                                          2058    2035     -23
do_time                                              588     565     -23
xioctl                                                25       -     -25
read_rtc                                             186     160     -26
parse_conf                                          1299    1270     -29
udhcp_read_interface                                 269     239     -30
bb_ioctl                                              45       -     -45
bb_ioctl_alt                                          70       -     -70
bb_ioctl_on_off                                       78       -     -78
.rodata                                           129370  129018    -352
do_show                                              799       -    -799
------------------------------------------------------------------------------
(add/remove: 6/5 grow/shrink: 13/49 up/down: 1316/-1864)     Total: -548 bytes
   text	   data	    bss	    dec	    hex	filename
 675352	   2740	  13968	 692060	  a8f5c	busybox_old
 674804	   2740	  13968	 691512	  a8d38	busybox_unstripped
2007-07-14 22:07:14 +00:00
Denis Vlasenko
4b924f3a5c whitespace fixes 2007-05-30 00:29:55 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
6963eb53a1 hdparm: make -T -t code smaller (-194 bytes), and output prettier 2007-05-22 21:46:11 +00:00
Denis Vlasenko
ac678ec2f1 style fixes, no code changes 2007-04-16 22:32:04 +00:00
Denis Vlasenko
ae47cd1da7 hdparm: fix multisector mode setting
(from Toni Mirabete <amirabete@catix.cat>)
2007-03-31 10:30:02 +00:00
Denis Vlasenko
0eec4abb13 hdparm: flag variables can easily be smaller than long
function                                             old     new   delta
process_dev                                         5247    5325     +78
bb_ioctl_on_off                                       72      78      +6
unregister_hwif                                        4       1      -3
...
perform_reset                                          4       1      -3
parse_xfermode                                       111     108      -3
noisy_piomode                                          4       1      -3
...
do_flush                                               4       1      -3
do_ctimings                                            4       1      -3
static.parm                                            4       -      -4
static.multcount                                       4       -      -4
parse_opts                                            54      48      -6
hdparm_main                                         1435    1383     -52
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/61 up/down: 84/-243)         Total: -159 bytes
2007-03-28 01:00:45 +00:00
Denis Vlasenko
7c282a2078 hdparm: remove stray static (-200 bytes bss) 2007-03-28 00:14:54 +00:00
Denis Vlasenko
f1ba749509 hdparm: whitespace style fixes 2007-03-28 00:14:01 +00:00
Denis Vlasenko
3bf0020a5f hdparm: style fixes, no code changes 2007-02-18 13:36:04 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
b6aae0f381 preparatory patch for -Wwrite-strings #2 2007-01-29 22:51:25 +00:00
Denis Vlasenko
3a34d0c08a random small size optimizations 2007-01-12 22:10:34 +00:00
Denis Vlasenko
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
c6f188def8 silly size savings and capitalization fixes 2006-10-26 00:37:00 +00:00
Denis Vlasenko
e1a0d486e4 message string changes, mostly for consistency, also -32 bytes in .rodata 2006-10-20 13:28:22 +00:00
Denis Vlasenko
1385899416 attempt to regularize atoi mess. 2006-10-08 12:49:22 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Denis Vlasenko
6429aabbf1 bb_askpass: shorten static password buffer. 256 is way too large.
simplify code a bit.
2006-09-23 12:22:11 +00:00
Denis Vlasenko
9213a9e0f2 whitespace cleanup 2006-09-17 16:28:10 +00:00
Rob Landley
403777ffae Patch from tito to improve options parsing. 2006-08-03 20:22:37 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
Rob Landley
22d26fc6ae Patch from Yann Morin to put BLKGETSIZE64 in platform.h had rather a lot of
fallout due to the #include <sys/mount.h>.  Removed that #include from various
applets and fixed up those that were unhappy when that #include was made
because they'd block copied stuff out of it.  (Sigh.)
2006-06-15 15:49:36 +00:00
Rob Landley
9c6f9552ec Some day, maybe gcc will be able to optimize out static functions that are
never used so we don't have to #ifdef them.  Wouldn't that be nice?
2006-06-08 14:11:36 +00:00
Rob Landley
6d8ce170b0 Fix from Tito to read from stdin only when it's not a tty. 2006-06-07 21:22:42 +00:00
Mike Frysinger
ea93f8a397 Tito writes: this patch fixes two potential bugs with the -i -I flags that could be reset during option parsing 2006-06-07 14:25:22 +00:00
Rob Landley
0753f4a15e Callers to identify() converted the endianness of the buffer. So did
identify().  This meant big endian systems had a NUXI problem.  Removed
the redundant conversion from the callers, and made some in-passing cleanups
while I was there.
2006-06-07 00:27:25 +00:00
Bernhard Reutner-Fischer
c89982dcd7 - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
2006-06-03 19:49:21 +00:00
Rob Landley
0620841758 Patch from Tito to remove long options from hdparm. 2006-05-31 22:52:57 +00:00
Rob Landley
bba7f08d27 Add SWAP_LE?? and SWAP_BE?? macros, and make things use them. Converts values
to/from little endian or big endian, which is a NOP if that's what the current
platform already is.
2006-05-29 05:51:12 +00:00
Rob Landley
81dab2cf83 Fix hdparm to use PRIu64 instead of typecasting to long long (which is 128 bits
on 64 bit platforms), and move #include <inttypes.h> to libbb.h.
2006-05-28 01:56:08 +00:00
Rob Landley
299a6b4d7b Consolidate #include <sys/time.h> so libbb.h does it. 2006-05-27 21:42:58 +00:00
Mike Frysinger
314c739b07 Yann E. MORIN. writes:
hdparm has a uint64_t passed to printf with a %llu format (which is ok, because
it's the same size), but without first being casted(?) to unsigned long long int.
Which is kinda funny because it's done OK on a few lines above...
2006-05-26 02:05:19 +00:00
Rob Landley
ade7f95bd1 Patch from Tito:
Remove -v verbose -V version -q quiet flags
Remove parse_opt_v2();
Rename parse_opt_v3() to parse_xfermode()
Remove if_strcat()
Rearrange code in  dump_identity() to reduce size
Modify some strings so that they could be optimized by the compiler
Minor code clean up
Remove unneeded #define <shm.h>

#if BB_BIG_ENDIAN && !defined(__USE_XOPEN)
# define __USE_XOPEN
#endif    
Must be before #include <unistd.h> and #include "busybox.h"
(noticed by Bernhard Fischer <rep.nop@aon.at>)

Remove duplicate code in do_time()
2006-05-25 18:53:06 +00:00
Rob Landley
4ae2f511cf Patch from tito to replace shared memory usage with mlock(), slightly tweaked
by me.
2006-05-19 17:24:26 +00:00
Rob Landley
adde79883f Largeish cleanup patch from Tito, mostly if statement therapy. 2006-05-16 15:32:30 +00:00
Mike Frysinger
e92923862e typecast bbig to kill format warnings 2006-05-11 02:31:45 +00:00
Rob Landley
19802563ed The if() is cheaper than the extra function parameter. According to make
bloatcheck, this saves 112 bytes on x86...
2006-05-08 15:35:46 +00:00
Rob Landley
20deab0537 Cleanup patch from tito. 2006-05-07 23:34:15 +00:00
Rob Landley
39cf645ce0 Patch from Dennis Vlasenko resetting values that get reused. 2006-05-05 16:52:28 +00:00
Rob Landley
2584e9b39f Remove HDIO_GETGEO_BIG which is dead (removed from 2.6) and was pointless back
in 2.4 (it fetched the same hd_geometry struct only with uint cylinders instead
of ushort cylinders: nothing that big has ever accurately reported gemoetry,
it's all LBA.

Also stop declaring the hd_geometry struct static: it's two chars, a short, and
a long for a grand total of 8 bytes.  That can go on the stack.
2006-05-03 20:00:00 +00:00
Rob Landley
0f0b645f73 Use ATTRIBUTE_NORETURN as suggested by tito, plus a few in-passing cleanups. 2006-05-03 18:28:06 +00:00
Rob Landley
6389ff1115 Patch from tito removing obsolete code. 2006-05-01 19:28:53 +00:00
Rob Landley
5bc3f05a23 Remove some unused code pointed out by Tito, plus a slightly more graceful
way of handling endianness.
2006-04-29 19:11:24 +00:00
Rob Landley
a3e4f38f7b Style fixes from Denis Vlasenko. 2006-04-29 16:06:31 +00:00
Rob Landley
5f8b5ecda2 Another patch from Denis Vlasenko:
Make hdparm smaller:
* Make bb_ioctl return the status
* Replace ioctl with bb_ioctl in a few places
* Add bb_ioctl_alt, use where appropriate (four places)
* unsigned char args1[4+512] = {WIN_IDENTIFY,0,0,1,};
  ate 0.5k of rodata, fix that
2006-04-29 16:03:40 +00:00
Rob Landley
e5b281f89e From Dennis Vlasenko, Make hdparm smaller:
* Use combined no_scsi_no_xt()
 * Have common unsigned char args[4] = {WIN_SETFEATURES,0,0,0};
2006-04-29 15:49:18 +00:00
Rob Landley
2e2d752d49 Cleanup to hdparm by tito. 2006-04-29 15:23:33 +00:00
Rob Landley
0e6a3e14e4 Patch from tito to update output of hdparm. 2006-04-28 01:33:30 +00:00
Rob Landley
026147a48f Patch from Tito to fix printing null and make output look like hdparm 6.3. 2006-04-17 22:29:13 +00:00
Mike Frysinger
f284c767e5 use more boiler plate GPL notices 2006-04-16 20:38:26 +00:00
Bernhard Reutner-Fischer
9460f66e4e - tweak visibility of label expected_hwif_error as it's only needed for
CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF or CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
2006-04-11 08:01:29 +00:00
Bernhard Reutner-Fischer
061fd0a353 - make sure that the label expected_hwif_error is visible even when
CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF isn't set.
2006-04-05 16:37:25 +00:00
Rob Landley
c5b1d4d6b1 Patch from Denis Vlasenko to add xstat() and use it. 2006-03-13 15:45:16 +00:00
Rob Landley
688ed0d760 Patch from Robert P. Day, moving byte order checks to use platform.h macros. 2006-03-04 22:40:25 +00:00
Rob Landley
0a7c8ef6e2 Patch from Denis Vlasenko to constify things and fix a few typos. 2006-02-22 17:01:00 +00:00
Eric Andersen
a68ea1cb93 fix up yet more annoying signed/unsigned and mixed type errors 2006-01-30 22:48:39 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
"Vladimir N. Oleynik"
b4b6d26287 data --> code 2005-10-15 14:10:36 +00:00
Eric Andersen
14f5c8d764 Patch from Bernhard Fischer to make a bunch of symbols static
which were otherwise cluttering the global namespace.
2005-04-16 19:39:00 +00:00
Eric Andersen
f828da0020 Avoid a naming conflict with include/bits/fcntl.h 2004-07-20 22:53:59 +00:00
Eric Andersen
aff114c33d Larry Doolittle writes:
This is a bulk spelling fix patch against busybox-1.00-pre10.
If anyone gets a corrupted copy (and cares), let me know and
I will make alternate arrangements.

Erik - please apply.

Authors - please check that I didn't corrupt any meaning.

Package importers - see if any of these changes should be
passed to the upstream authors.

I glossed over lots of sloppy capitalizations, missing apostrophes,
mixed American/British spellings, and German-style compound words.

What is "pretect redefined for test" in cmdedit.c?

Good luck on the 1.00 release!

      - Larry
2004-04-14 17:51:38 +00:00
Eric Andersen
b2aa776f89 Tito, farmatito at tiscali dot it writes:
Hi to all,
I discovered a little bug in hdparm.c
(really two little bugs...I've made...sigh! Mea culpa).
Some vars were  modified only locally and this could lead to wrong
results to be displayed with the -I switch and maybe with others.
Attached is a patch that fix it ( +88b).

Also attached is second patch that reduces the size a little bit:
   text    data     bss     dec     hex filename
    27984     624     900   29508    7344 hdparm.o (without bug-fix)
    28072     624     900   29596    739c hdparm.o (with bug-fix)
    28141     624     900   29665    73e1 hdparm.o (original)
but maybe this one can wait as we are in a feature freeze.

Ciao,
Tito
2004-04-05 13:08:08 +00:00
Eric Andersen
bfb51574ae Tito noticed a printf that should have been a bb_error_msg. 2004-03-20 00:56:46 +00:00
Eric Andersen
06d4ec2a4b Fix broken arg parsing (was not passing pointer to items so p, argc, and argv
were only modified locally).  Fix error reporting to properly describe why
ioctls fail.
2004-03-19 10:53:52 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Eric Andersen
7e8f41cb5b Avoid naming conflict with symbol in newer glibc headers 2004-02-14 21:33:39 +00:00
Eric Andersen
416c24224d Fix compile when CONFIG_FEATURE_HDPARM_GET_IDENTITY is disabled 2003-12-12 00:08:57 +00:00
Glenn L McGrath
5be6a200f0 Correct Matteo's email address 2003-11-28 22:55:03 +00:00
Glenn L McGrath
a55d72bbb4 Patch from Steven Scholz, fix some warnings 2003-10-09 11:38:45 +00:00
Glenn L McGrath
07085855ad Patch from Tito, size optimisation and fix error in exit code of -V
option
2003-10-09 07:28:22 +00:00
Glenn L McGrath
c43f9edf88 Update Matteo Croce's email address 2003-09-15 03:37:32 +00:00
Eric Andersen
f1c56a9306 quiet some noise 2003-08-08 22:13:41 +00:00
Eric Andersen
0a57a79e38 Patch from Steven Scholz:
should we rename the define into CONFIG_FEATURE_HDPARM_HDIO_DMA and
use it for "set" and "get" ???

Since although CONFIG_FEATURE_HDPARM_HDIO_GET_DMA is _not_ set I still
can use "hdparm -d 1 /dev/hda" to switch the DMA on.
Is this desireable or meant to be like that?

So how about the applied patch?
2003-08-06 08:57:35 +00:00
Eric Andersen
50af12dbd6 Sync hdparm -t and -T options with hdparm-5.3, which seems
to produce sensible results,
2003-08-06 08:47:59 +00:00
Eric Andersen
3443bd7286 Matteo Croce submitted a hdparm applet. 2003-07-22 07:30:36 +00:00