Commit Graph

25 Commits

Author SHA1 Message Date
Denys Vlasenko
d8e4ce0503 fdisk: avoid overflow in "mega/gigabytes" calculation, code shrink
function                                             old     new   delta
list_disk_geometry                                   175     145     -30

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-04 16:45:04 +02:00
Denys Vlasenko
c104549b48 fdisk: sync up with some util-linux 2.31 behavior
= display default is no longer in cylinders
= +sizeC is no longer supported
= add +sizeT suffix - terabytes are here
= K,M,G,T and k,m,g,t suffixes all are binary, not decimal
= +sizeM results in last sector +(size * 1Mbyte - 1), not +(size * 1Mbyte)
= fix comparison to "YES" answer for sgi/sun

function                                             old     new   delta
read_int                                             492     519     +27
fdisk_main                                          2644    2640      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 27/-4)              Total: 23 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-25 13:52:30 +02:00
Denys Vlasenko
8ef9effaa5 fdisk: placate warning of strncpy not copying NUL byte
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-26 15:44:58 +02:00
Denys Vlasenko
015db5800c randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-19 18:15:33 +02:00
Denys Vlasenko
8dff01d06a libbb: introduce and use is_prefixed_with()
function                                             old     new   delta
is_prefixed_with                                       -      18     +18
complete_username                                     78      77      -1
man_main                                             737     735      -2
fsck_device                                          429     427      -2
unpack_ar_archive                                     80      76      -4
strip_unsafe_prefix                                  105     101      -4
singlemount                                         1054    1050      -4
rtc_adjtime_is_utc                                    90      86      -4
resolve_mount_spec                                    88      84      -4
parse_one_line                                      1029    1025      -4
parse_conf                                          1460    1456      -4
may_wakeup                                            83      79      -4
loadkmap_main                                        219     215      -4
get_irqs_from_stat                                   103      99      -4
get_header_cpio                                      913     909      -4
findfs_main                                           79      75      -4
fbsplash_main                                       1230    1226      -4
load_crontab                                         776     771      -5
expand_vars_to_list                                 1151    1146      -5
date_main                                            881     876      -5
skip_dev_pfx                                          30      24      -6
make_device                                         2199    2193      -6
complete_cmd_dir_file                                773     767      -6
run_applet_and_exit                                  715     708      -7
uudecode_main                                        321     313      -8
pwdx_main                                            197     189      -8
execute                                              568     560      -8
i2cdetect_main                                      1186    1176     -10
procps_scan                                         1242    1230     -12
procps_read_smaps                                   1017    1005     -12
process_module                                       746     734     -12
patch_main                                          1903    1891     -12
nfsmount                                            3572    3560     -12
stack_machine                                        126     112     -14
process_timer_stats                                  449     435     -14
match_fstype                                         111      97     -14
do_ipaddr                                           1344    1330     -14
open_list_and_close                                  359     343     -16
get_header_tar                                      1795    1779     -16
prepend_new_eth_table                                340     323     -17
fsck_main                                           1811    1794     -17
find_iface_state                                      56      38     -18
dnsd_main                                           1321    1303     -18
base_device                                          179     158     -21
find_keyword                                         104      82     -22
handle_incoming_and_exit                            2785    2762     -23
parse_and_put_prompt                                 774     746     -28
modinfo                                              347     317     -30
find_action                                          204     171     -33
update_passwd                                       1470    1436     -34
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540)         Total: -522 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12 17:48:34 +01:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
ddf7850f2b fdisk: add a warning and truncate disks with >= 2^32 sectors
As a result, for sectors we can use uint32_t instead of long long,
and on 32 bits it has drastic effects:

function                                             old     new   delta
get_geometry                                         619     646     +27
set_sun_partition                                    148     150      +2
get_partition                                        134     135      +1
xbsd_write_bootstrap                                 382     381      -1
xbsd_readlabel                                       247     246      -1
bsd_select                                          1674    1672      -2
sun_other_endian                                       4       1      -3
scsi_disk                                              4       1      -3
floppy                                                 4       1      -3
fdisk_main                                          3735    3732      -3
read_maybe_empty                                      43      37      -6
create_doslabel                                      111     104      -7
read_line                                             97      88      -9
add_logical                                          117     107     -10
write_table                                          599     588     -11
new_partition                                       1684    1670     -14
list_disk_geometry                                   229     215     -14
wrong_p_order                                        130     110     -20
xselect                                             3142    3114     -28
seek_sector                                           71      40     -31
get_boot                                            1576    1533     -43
fill_bounds                                          174     128     -46
delete_partition                                     603     551     -52
list_table                                          1401    1232    -169
set_partition                                        459     286    -173
verify                                              1840    1495    -345
add_partition                                       2486    1270   -1216
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/24 up/down: 30/-2210)       Total: -2180 bytes
   text    data     bss     dec     hex filename
 848812     460    7116  856388   d1144 busybox_old
 846620     460    7108  854188   d08ac busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-16 03:03:13 +02:00
Denis Vlasenko
db12d1d733 Fix forgotten license comments 2008-12-07 00:52:58 +00:00
Denis Vlasenko
6eaf0a9883 fdisk: move more data to struct globals; shrink code
function                                             old     new   delta
nowarn                                                 1       -      -1
listing                                                1       -      -1
dos_compatible_flag                                    1       -      -1
warn_cylinders                                        44      42      -2
open_list_and_close                                  364     362      -2
fdisk_fatal                                           41      38      -3
verify                                              1053    1049      -4
user_sectors                                           4       -      -4
user_heads                                             4       -      -4
user_cylinders                                         4       -      -4
pt_sectors                                             4       -      -4
pt_heads                                               4       -      -4
kern_sectors                                           4       -      -4
kern_heads                                             4       -      -4
ext_index                                              4       -      -4
total_number_of_sectors                                8       -      -8
extended_offset                                        8       -      -8
create_doslabel                                      129     120      -9
write_table                                          225     211     -14
delete_partition                                     445     431     -14
set_partition                                        476     459     -17
list_disk_geometry                                   247     229     -18
unable_to_write                                       19       -     -19
add_partition                                       2515    2486     -29
get_boot                                            1709    1636     -73
fdisk_main                                          2812    2679    -133
------------------------------------------------------------------------------
(add/remove: 0/14 grow/shrink: 0/12 up/down: 0/-388)         Total: -388 bytes
   text    data     bss     dec     hex filename
 804634     611    6852  812097   c6441 busybox_old
 804298     610    6804  811712   c62c0 busybox_unstripped
2008-06-29 05:10:47 +00:00
Denis Vlasenko
4437d19fb4 fdisk: do not open device twice. Complain on fdisk -l /dev/bogus.
Made enums UPPERCASE. Removed one global variable.
  Added some FIXMEs.

   text    data     bss     dec     hex filename
 804708     645    7112  812465   c65b1 busybox_old
 804685     641    7112  812438   c6596 busybox_unstripped
2008-04-17 00:12:10 +00:00
Denis Vlasenko
de7684a309 support for mount by label (not yet tested)
Also adds findfs applet. Closes bug 1143.
2008-02-18 21:08:49 +00:00
Denis Vlasenko
284d0faed6 random s/short/int/
add_cmd                                             1189    1190      +1
xconnect_ftpdata                                     118     117      -1
data_align                                            86      84      -2
process_files                                       2101    2096      -5
forkexec                                            1345    1334     -11
2008-02-16 13:18:17 +00:00
Denis Vlasenko
f77f369ce8 fdisk: reduce global data/bss usage. 8k data+bss build is achievable soon ;)
(add/remove: 0/13 grow/shrink: 6/19 up/down: 74/-492)        Total: -418 bytes
   text    data     bss     dec     hex filename
 778330     860    7408  786598   c00a6 busybox_old
 777970     840    7376  786186   bff0a busybox_unstripped
2007-12-16 17:22:33 +00:00
Denis Vlasenko
b71c668c57 style fix (stray space before ';') 2007-07-21 15:08:09 +00:00
Denis Vlasenko
219d14d514 random style fixes (extra spaces deleted) 2007-03-24 15:40:16 +00:00
Denis Vlasenko
bd852076b9 fdisk: get rid of _() macro.
Shorten some messages. Stop using stderr - anyone who tries
to use fdisk no-interactively is "strange" anyway.
Improve storage handling in bsd module.
   text    data     bss     dec     hex filename
 728112    1488   33788  763388   ba5fc busybox.t0/busybox
 727248    1488   33372  762108   ba0fc busybox.t1/busybox
2007-03-19 14:43:38 +00:00
Denis Vlasenko
8e858e2700 clean up accumulated whitespace damage 2007-03-07 09:35:43 +00:00
Denis Vlasenko
d54708399d fdisk: remove 8k buffer from bss - OSF labels
are not THAT common anyway
2007-01-03 02:58:54 +00:00
Denis Vlasenko
9b1381fd2f convert calloc to xzalloc
fix sleep-on-die option
2007-01-03 02:56:00 +00:00
Denis Vlasenko
6a5dc5d75a next bunch of fixes for bugs found by randconfig 2006-12-30 18:42:29 +00:00
Denis Vlasenko
28703015ab u_short, ulong exterminated
fdiskXXX: add a bit of sanity (not enough by far)
2006-12-19 20:32:02 +00:00
Denis Vlasenko
10d0d4eec7 byteswap ops had extra mask ops - removed 2006-11-27 16:48:17 +00:00
Denis Vlasenko
89f0b3486d rodata cleanup. "unable to" == "cannot". -300 bytes 2006-11-18 22:04:09 +00:00
Denis Vlasenko
efeed5ed28 fdisk: compilation fix 2006-10-14 16:16:03 +00:00
Denis Vlasenko
98ae2160b6 fdisk: separate sun/aix/etc code into #included files 2006-10-12 19:30:44 +00:00