Commit Graph

1350 Commits

Author SHA1 Message Date
Denys Vlasenko
3c5d133c7d fstrim: fix help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-04 15:19:38 +01:00
René Rhéaume
e76957708b swaponoff: add support for -e
Signed-off-by: René Rhéaume <rene.rheaume@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 20:35:00 +01:00
Denys Vlasenko
26a8b9f196 mdev: treat zero-length /dev/mdev.seq the same as "\n" one. Closes 7334
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-08 18:19:15 +02:00
Denys Vlasenko
03e17bfa8d fatattr: use the standard type for 32-bit int
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-04 15:16:46 +02:00
Pascal Bellard
d3633b7e9c fatattr: new applet
function                                             old     new   delta
fatattr_main                                           -     281    +281
packed_usage                                       29821   29871     +50
bit_to_char                                            -      10     +10
applet_names                                        2472    2480      +8
applet_main                                         1436    1440      +4
applet_nameofs                                       718     720      +2
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 4/0 up/down: 355/0)             Total: 355 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-30 13:06:39 +02:00
Denys Vlasenko
a4476eb654 rtcwake: fix incorrect (reversed) rtc/sys adjuestment; code shrink
function                                             old     new   delta
rtcwake_main                                         482     462     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 12:46:15 +02:00
Tito Ragusa
c9a67133d6 swapon/swapoff: -a returns 0 on ignored errors
Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-01 09:51:27 +02:00
Tito Ragusa
a3f326cd66 swapon/swapoff: size reduction, cleanup, fixes, improvements
1) real swapon/swapoff handles also devices on the commandline with -a;
2) xstat(device)  in  swap_enable_disable aborts on error when cycling through
   fstab so some devices  are not handled;
3) duplicated code for ENABLE_FEATURE_SWAPON_DISCARD and
   ENABLE_FEATURE_SWAPON_PRI was moved to functions.
4) silence some error messages with -a;
5) minor cleanups and code refactoring reduced the size as per bloat-check:
6) I also added support for /proc/swaps handling to swapoff:
"When the -a flag is given, swapping is disabled on all known  swap  devices
 and  files  (as  found  in  /proc/swaps  or /etc/fstab)."
So now swapoff first cycles through  /proc/swaps and then through fstab
to swapoff all devices.

function                                             old     new   delta
set_discard_flag                                       -     106    +106
swap_enable_disable                                  147     238     +91
set_priority_flag                                      -      79     +79
retrieve_file_data                                   470     467      -3
swap_on_off_main                                     638     418    -220
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/2 up/down: 276/-223)           Total: 53 bytes

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-31 16:39:26 +02:00
Matt Whitlock
0a53b203f9 add discard option -d to swapon
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:23 +01:00
Matt Whitlock
b9bbd4ddf6 fix interaction of -a and -p options in swapon
Swap entries in /etc/fstab inherit the priority specified on the command line unless they have 'pri' in their mount options.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:22 +01:00
Matt Whitlock
c3a27b0bfd avoid calling bb_strtou twice in MIN macro expansion
Also, the maximum allowable value of swap priority is technically SWAP_FLAG_PRIO_MASK >> SWAP_FLAG_PRIO_SHIFT.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:22 +01:00
Denys Vlasenko
438b4ac286 script: make it work even if fd 0 is closed
Testcase:
script -q -c "echo hey" /dev/null 0>&-

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 12:34:53 +01:00
Denys Vlasenko
0ed5f7aacd use [s]rand(), not [s]random()
rand() is the most standard C library function,
and on uclibc they are the same. I guess
they are the same in most todays' libc...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-05 18:58:15 +01:00
Denys Vlasenko
589051b565 hwclock: fix setting of tz_minuteswest. Closes 5414
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-25 17:52:10 +01:00
Denys Vlasenko
327f550669 Use unsigned printf/scanf conversion where more appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:45:45 +01:00
Denys Vlasenko
9b2a9f0210 fix assorted unused code and wrong format specs found by cppchekc (bug 6716)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:43:33 +01:00
Denys Vlasenko
cd0936be36 fstrim: use new-style config/kbuild/applet snippets; trim help text
function                                             old     new   delta
packed_usage                                       29546   29520     -26

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-12 12:09:14 +01:00
Denys Vlasenko
087843a65b fix "warning: ISO C90 forbids mixed declarations and code"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-12 11:16:30 +01:00
Bernhard Reutner-Fischer
5e63776212 fstrim: Needs to fire at the mp, not bd
It's a filesystem thing from this perspective.
+1b

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-10 21:47:02 +01:00
Bernhard Reutner-Fischer
b1489f97e0 fstrim: Indicate failure on error
+14b

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-10 00:02:43 +01:00
Bernhard Reutner-Fischer
140f4e3511 fstrim: -17b
Also, use the name of the block device we found, not necessarily the one
we got from the user:
fstrim -v /
/dev/sdj: 4711 bytes were trimmed

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-09 23:41:34 +01:00
Malek Degachi
1d39e33d46 fstrim: New applet
fstrim applet is a port from util-linux.

"Trimming" your NAND/eMMC storage will restore the write performance
back to normal after having slow down issues on sequential write and
random write due to usage over time.

Good reading on subject:
http://forum.xda-developers.com/showthread.php?t=1971852

(with long options and CLEAN_UP turned on)
function                                             old     new   delta
.rodata                                           148494  148791    +297
fstrim_main                                            -     283    +283
fstrim_sfx                                             -     128    +128
packed_usage                                       28826   28903     +77
applet_main                                         2760    2768      +8
applet_names                                        2343    2350      +7
applet_nameofs                                       690     692      +2
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 5/0 up/down: 802/0)             Total: 802 bytes

Signed-off-by: Malek Degachi <malek-degachi@laposte.net>
Cc: Eugene San (eugenesan) <eugenesan@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-09 22:14:33 +01:00
Bernhard Reutner-Fischer
b541d1fcbd swaponoff: shrink
function                                             old     new   delta
.rodata                                           148469  148468      -1
swap_on_off_main                                     381     379      -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-3)               Total: -3 bytes
   text	   data	    bss	    dec	    hex	filename
 803030	   4090	   9504	 816624	  c75f0	busybox_old
 803027	   4090	   9504	 816621	  c75ed	busybox_unstripped
2013-11-08 09:05:25 +01:00
Denys Vlasenko
a407cf74cc Make smart_ulltoa return pointer to end (allows for code shink in callers)
function                                             old     new   delta
smart_ulltoa5                                        405     408      +3
smart_ulltoa4                                        273     276      +3
list_table                                          1113    1114      +1
scale                                                 36      34      -2
put_lu                                                55      53      -2
ulltoa6_and_space                                     19      14      -5
powertop_main                                       1470    1461      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-06 12:53:14 +02:00
Jody Bruchon
deebdf59b5 fdisk: fix GPT size math errors
Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 17:42:06 +02:00
Tito Ragusa
8c7fcbd752 swapon: support "pri=NNN" in fstab
function                                             old     new   delta
swap_on_off_main                                     244     365    +121

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 10:21:27 +02:00
Sven-Göran Bergh
9369634167 volume_id: add f2fs detection
function                                             old     new   delta
volume_id_probe_f2fs                                   -      98     +98

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-01 11:05:08 +02:00
Sven-Göran Bergh
e418b2e7bb volume_id: nilfs config description.
Config description for nilfs added.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-31 18:30:34 +02:00
Sven-Göran Bergh
15d0a860e9 volume_id: Adopt to new config style.
Config instructions for util-linux/volume_id are moved into the
source files according to the new config feature.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-31 15:57:59 +02:00
Sven-Göran Bergh
3b45801dc6 volume_id: Adopt to new kbuild style.
Kbuild instructions for util-linux/volume_id are moved into the
source files according to the new build feature.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-31 15:45:20 +02:00
Denys Vlasenko
c72b43c2f0 Commonalize typical [b,]k,m suffix struct
function                                             old     new   delta
bkm_suffixes                                           -      32     +32
static.km_suffixes                                    24       -     -24
suffixes                                              32       -     -32
static.bkm                                            32       -     -32
head_tail_suffixes                                    32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/6 grow/shrink: 0/0 up/down: 72/-160)           Total: -88 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-13 23:49:45 +02:00
Denys Vlasenko
4928e9f7d0 losetup: assorted fixes. Closes 6314
"losetup -d" was not complaining that LOOPDEV is missing.
"losetup -a" was listing only up to /dev/loop9.
"losetup -f" looped forever if llop0 was taken, and never tried
anything after /dev/loop9.
"-o" with other options (say, -r) had no effect.

function                                             old     new   delta
losetup_main                                         376     419     +43

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-27 03:45:16 +02:00
Denys Vlasenko
aa94130f74 volume_id_internal.h: drop unoptimized byteswap routines
function                                             old     new   delta
volume_id_probe_hfs_hfsplus                          802     627    -175

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-15 09:36:40 +02:00
Nikolaus Voss
c3cf1e30a3 mdev: use $DEVNAME in uevent sysfs file for device node name
516530c932 uses $DEVNAME variable
for device node name. This is fine, but only works for hotplugging,
"mdev -s" will behave differently when DEVNAME and basename(path)
differ.

This patch extracts the DEVNAME from the uevent sysfs file in
make_device(), thus works for hot- and coldplugging; so using
the environment DEVNAME on hotplug events is no longer necessary.

Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-13 03:55:11 +02:00
Oliver Metz
041baf2720 volume_id: fix ntfs attribute search
len is declared as uint32_t but le16_to_cpu macro is used

Signed-off-by: Oliver Metz <oliver.metz@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-09 07:45:51 +02:00
Denys Vlasenko
d35cbad0ef mdev: call index_in_strings on $ACTION only after we checked it for NULL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-02 14:37:06 +02:00
Denys Vlasenko
2c24806bf4 hexdump: need to use xstrtoull for off_t
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-27 15:18:32 +01:00
Denys Vlasenko
ef6747e290 hexdump: don't unconditionally limit the usable address range
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-27 15:15:33 +01:00
Denys Vlasenko
7c6f2d4207 mkfs_minix: use get_volume_size_in_bytes instead of local version
Hopefully this also closes 4730

function                                             old     new   delta
valid_offset                                          55       -     -55
mkfs_minix_main                                     2925    2674    -251
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-306)           Total: -306 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-18 02:26:58 +01:00
Denys Vlasenko
4424dfd69b mdev: fix build failure
The error was "error: 'struct globals' has no member named 'parser'"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-17 23:01:17 +01:00
Mandeep Singh Baines
7991d45446 losetup: fix util-linux compatibility
Added -a support. Also made sure -f works as follows:

losetup [-r] [-o offset] {-f|loopdev} file

Removed support for 'losetup -r' with no arguments.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-03-12 16:31:25 -04:00
Denys Vlasenko
5bce135e36 mdev: improve $SEQ handling; improve debug logging
Sequential run of concurrent mdev's was too simplistic:
they waited for /dev/mdev.seq to match. This could sometimes
cause cumulative loss of time on the order of a second.

Added SIGCHLD signaling from exiting mdev to all other mdev's.
Added debugging required to see that code actually works as intended.

Example of /dev/mdev.log (with "woken up" elevated from dbg lvl 3 to 2):

mdev[1023]: first seq written
     ^^^^ seq, not pid
mdev[1023]: 35.022395 ACTION:add SUBSYSTEM:module DEVNAME:(null) DEVPATH:/module/lib80211
mdev[1023]: rule matched, line -1
                          ^^^^^^^ means "default rule"
mdev[1023]: 35.022676 exiting
            ^^^^^^^^^ second,usec timestamp
mdev[1024]: 35.069691 ACTION:add SUBSYSTEM:vc DEVNAME:vcs9 DEVPATH:/devices/virtual/vc/vcs9
mdev[1024]: dev 7,9
mdev[1025]: 35.069889 waiting for '1024'
mdev[1026]: 35.069946 waiting for '1024'
mdev[1027]: 35.070151 waiting for '1024'
mdev[1024]: rule matched, line -1
mdev[1024]: mknod vcs9 (7,9) 20660 0:0
mdev[1024]: 35.070346 exiting
mdev[1025]: woken up
mdev[1026]: woken up
mdev[1025]: 35.071213 ACTION:add SUBSYSTEM:vc DEVNAME:vcsa9 DEVPATH:/devices/virtual/vc/vcsa9
            ^^^^^^^^^ took only a millisecond to start running after prev mdev exited
mdev[1025]: dev 7,137
mdev[1027]: woken up
mdev[1025]: rule matched, line -1
mdev[1025]: mknod vcsa9 (7,137) 20660 0:0
mdev[1025]: 35.072109 exiting

function                                             old     new   delta
mdev_main                                            849    1372    +523
curtime                                                -      59     +59
dirAction                                             87     134     +47
static.ts                                              -       8      +8
keywords                                              19      12      -7
make_device                                         2189    2119     -70

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-27 10:51:41 +01:00
Denys Vlasenko
40b97fb31e mdev: add environment variable match
function                                             old     new   delta
make_device                                         1998    2189    +191
clean_up_cur_rule                                     61      96     +35
dirAction                                             75      87     +12
mdev_main                                            838     849     +11
packed_usage                                       29272   29273      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 250/0)             Total: 250 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 00:40:46 +01:00
Aaro Koskinen
cf5731bcbd fdisk_sun: fix partition alignment
When the display unit is sectors, the partition alignment will convert
the partition start to a wrong unit (it should always be in sectors). Fix
this.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-11 00:22:59 +01:00
Aaro Koskinen
1bd5ca2f53 fdisk_sun: fix corrupted partition data with blank disk
After creating Sun disk label for the first time for a blank disk,
the partition table appears corrupted because current_label_type will
never get set to a proper type. Fix this by calling check_sun_label()
after BusyBox has created the label.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-11 00:22:48 +01:00
Denys Vlasenko
ba76b7a40b mdev: chdir back to /dev after trying to read firmware
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-04 23:35:27 +01:00
Denys Vlasenko
6e29d07417 mdev: extend debug logging output
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-30 16:51:22 +01:00
Denys Vlasenko
ee3bc70cea getopt: improve help text; code shrink
function                                             old     new   delta
generate_output                                      356     351      -5
packed_usage                                       29271   29257     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-24 11:36:00 +01:00
Denys Vlasenko
9b7ebfe644 mount: whitespace fix. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-22 11:00:45 +01:00
Denys Vlasenko
4609f477c7 mdev: fix mode of dir1 in =dir1/dir2/file rule
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-21 01:22:12 +01:00