diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-06-09 23:20:49 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-06-09 23:20:49 +0200 |
| commit | 3b69ba799fd302a781f2ec760909f340e3b90236 (patch) | |
| tree | 37f2545a39600dcbc45a65903ef8b0ca7679a5d6 /util-linux | |
| parent | 7b6d4f50c97b4f375687e8216313b10598b44b49 (diff) | |
| download | busybox-w32-3b69ba799fd302a781f2ec760909f340e3b90236.tar.gz busybox-w32-3b69ba799fd302a781f2ec760909f340e3b90236.tar.bz2 busybox-w32-3b69ba799fd302a781f2ec760909f340e3b90236.zip | |
mount,losetup: use /dev/loop-control is it exists
function old new delta
get_free_loop - 58 +58
set_loop 597 649 +52
losetup_main 482 476 -6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 110/-6) Total: 104 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/losetup.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/util-linux/losetup.c b/util-linux/losetup.c index b52d693ec..5dc757074 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c | |||
| @@ -114,8 +114,14 @@ int losetup_main(int argc UNUSED_PARAM, char **argv) | |||
| 114 | /* contains -f */ | 114 | /* contains -f */ |
| 115 | if (opt & OPT_f) { | 115 | if (opt & OPT_f) { |
| 116 | char *s; | 116 | char *s; |
| 117 | int n = 0; | 117 | int n; |
| 118 | 118 | ||
| 119 | n = get_free_loop(); | ||
| 120 | if (n == -1) | ||
| 121 | bb_error_msg_and_die("no free loop devices"); | ||
| 122 | if (n < 0) /* n == -2: no /dev/loop-control, use legacy method */ | ||
| 123 | n = 0; | ||
| 124 | /* or: n >= 0: the number of next free loopdev, just verify it */ | ||
| 119 | do { | 125 | do { |
| 120 | if (n > MAX_LOOP_NUM) | 126 | if (n > MAX_LOOP_NUM) |
| 121 | bb_error_msg_and_die("no free loop devices"); | 127 | bb_error_msg_and_die("no free loop devices"); |
