util-linux/include
Karel Zak edb68d0ca3 losetup: looplist_* refactoring, remove scandir()
This patch replaces scandir-based implementation with readdir(). The
readdir(3) is less expensive and more portable (to non-glibc environment).

The patch also replaces sysfs-based solution with simpler /proc/partitions
parsing. The /proc/partitions includes all used loop devices on all systems
(include 2.4). This solution seems faster than scandir(/sys/block/) too.

Summary, the losetup (with this patch) uses three methods to found a
loop device:

  a) parse /proc/partitions to found already used loop devices (for
     loserup -a)

  b) stat(2) for all loop[0-7] devices (default number of loop devices).
     This is classic method from util-linux <= 2.13. This method is good
     enough for standard Linux machines with default number of loop
     devices.

  c) scan all /dev or /dev/loop/ for loop devices. This is useful for
     crazy people who need more than 8 loop devices.

Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-04 13:54:27 +02:00
..
Makefile.am include: add bitops.h with swab{16,32,64} macros 2007-12-17 13:18:12 +01:00
bitops.h include: <stdint.h> provides everything 2007-12-18 01:10:48 +01:00
blkdev.h mount: retry on ENOMEDIUM 2008-07-30 13:21:14 +02:00
carefulputc.h Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
env.h Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
linux_reboot.h Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
linux_version.h lib: add linux_version.{c,h} 2007-11-06 02:40:13 +01:00
md5.h Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
nls.h build-sys: nls/locale handling in util-linux-ng general 2007-09-19 23:15:21 +02:00
pathnames.h losetup: looplist_* refactoring, remove scandir() 2008-08-04 13:54:27 +02:00
setproctitle.h Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
widechar.h build-sys: fix ifdef ENABLE_WIDECHAR usage 2007-01-30 13:49:50 +01:00
xstrncpy.h Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00