Commit Graph

835 Commits

Author SHA1 Message Date
Karel Zak dcbf520914 include: bitops - explicitly include endian.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-17 14:27:38 +01:00
Karel Zak 015ea51c10 libs: pttype - fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12 14:34:47 +01:00
Karel Zak dfbc185e53 lib: wholedisk - extend API, add test program
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12 14:31:50 +01:00
Karel Zak 17c0248447 lib: pttype - extend the API to work with file descriptors
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12 14:17:59 +01:00
Karel Zak 2fb83c6752 include: add missing files to Makefile.am
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12 10:22:30 +01:00
Karel Zak e85a2a9392 lib: add pttype.c for PT types detection
This is a small fragment from libdisk (from xfsprogs). The final
solution will be to move the library to util-linux-ng.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12 10:15:50 +01:00
Karel Zak 929f243f79 lib: add is_whole_disk() from fdisk code
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-11 14:00:21 +01:00
Karel Zak 7926576ec2 lib: fix fsprobe wrapper (const char * is nonsense)
The fsprobe_ functions return newly allocated strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-03 16:25:23 +01:00
Karel Zak f314a6becc fdisk: (and partx) remove BLKGETLASTSECT
This odd ioctl is unsupported in the current 2.4 and 2.6 mainline.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-26 23:03:46 +01:00
Karel Zak 77be714e05 build-sys: add missing files to include/Makefile.am
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-20 13:21:40 +01:00
Karel Zak 607c2a7295 fsck: move fsck from e2fsprogs to util-linux-ng
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 15:09:34 +01:00
Karel Zak 17f29d7bac mount: generic blkid/volume_id wrapper, use blkid_evaluate_*
* moves the generic libblkid/libvolume_id wrapper (fsprobe.c) from
   mount/ to lib/. We'll use the wrapper in cfdisk and fsck.

   The wrapper supports:

    - obsolete volume_id (udev)
    - obsolete libblkid (e2fsprogs)
    - libblkid (util-linux-ng)

 * mount, umount and swapon when linked against the new libblkid use

    - low-level probing code to read LABEL, UUID or FSTYPE from a device
    - high-level blkid_evaluate_spec() to convert LABEL/UUID to devname

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-17 01:18:22 +01:00
Karel Zak 74a9c6f7b7 mount: move realpath.c code to lib/
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-11 23:55:51 +01:00
Karel Zak 525dd31635 fdisk: cleanup _PATH_DEV_* macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-06 22:23:13 +01:00
Karel Zak 8bce47d976 include: use __BYTE_ORDER rather than AC specific WORDS_BIGENDIAN
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-12-08 11:16:37 +01:00
Karel Zak dee98cdedc include: swapheader.h is missing in Makefile.am
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-12-05 15:53:40 +01:00
Matthias Koenig d60819b36d include: move swapheader.h to include
[kzak@redhat.com: add ifndef _SWAPHEADER_H]

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-12-05 11:51:40 +01:00
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
Matthias Koenig d50c5917f0 mount: retry on ENOMEDIUM
Due to a change in kernel behaviour when opening CDROM devices,
we need to retry the open/mount call when ENOMEDIUM is returned.

Explanation from Tejun Heo:
Okay, the difference is from the addition of cdrom_get_media_event()
call to both sr_drive_status() and ide_cdrom_drive_status().
Previously, the cdrom driver can't differentiate between tray closed
w/ no media and tray open and always returned tray open, which
triggers close and retry in the open logic which probably have delayed
things enough to get the media recognized.

Now the cdrom driver can discern between tray closed w/o media and
device not ready for other reasons and returns -ENOMEDIUM on the
former.  This is all good and dandy but the problem seems that some
drives report no media right after the tray is closed but it hasn't
properly detected the media yet.

It seems the only way to work around the problem is via sensible
retries (e.g.  try three times 5 secs apart) and I don't think we can
add that type of retry logic into cdrom open path.  Please note that
the previous logic wasn't water proof.  Some drives can take longer to
recognize the media is there and could have failed the in-kernel retry
too.  Also, reading the media can take quite some time and during that
period the drive reports media present but device not ready.  The
driver will retry the command (e.g. READ TOC for open) five times but
all of them can fail w/ EMEDIUMTYPE.

[kzak@redhat.com: - add CRDOM_NOMEDIUM_RETRIES to blkdev.h
                  - add verbose message to mount.c]

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-07-30 13:21:14 +02:00
Samuel Thibault 268cefe6cb lib: blkdev.c clean up, non-linux support
[kzak@redhat.com: split the original patch to small patches]

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-07-24 00:52:52 +02:00
Samuel Thibault 580cb0d069 include: <stdint.h> provides everything
Do not include <linux/posix_types.h> as <stdint.h> provides everything.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2007-12-18 01:10:48 +01:00
Karel Zak a34fc3d4ad include: add bitops.h with swab{16,32,64} macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-12-17 13:41:13 +01:00
Karel Zak 1ed3367f61 include: add bitops.h with swab{16,32,64} macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-12-17 13:18:12 +01:00
Karel Zak 4d43977ffc include: add mount paths to pathnames.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-28 14:08:33 +01:00
Karel Zak 2f4564eac4 include: cleanup pathnames.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-28 13:17:16 +01:00
Karel Zak 8505ff35cf elvtune: use get_linux_version()
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-07 21:25:48 +01:00
Stefan Krah 3738a48e08 lib: add blkdev.{c,h}
Now we duplicate BLK* ioctls on many places... This patch also
fix BLKGETSIZE64 usage in dependence on kernel version.

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Stefan Krah <stefan@bytereef.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-07 12:37:30 +01:00
Stefan Krah 5d2c98e1df lib: add linux_version.{c,h}
Signed-off-by: Stefan Krah <stefan@bytereef.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-06 02:40:13 +01:00
Karel Zak c5f671113b build-sys: remove errs.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-18 15:00:17 +02:00
Mike Frysinger 8b7f16fc37 build-sys: nls/locale handling in util-linux-ng general
On Monday 03 September 2007, Karel Zak wrote:
> http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/590/focus=592
>
>  I agree that we need a better support for compilation without
>  locales, but from my point of view NLS != all locales stuff. The NLS
>  support is subset only.

thinking about the input from everyone, i'd propose the attached ...

Only pull in locale.h as needed and move it to the common nls.h.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2007-09-19 23:15:21 +02:00
Gabriel Barazer 392f76cf9a build-sys: missing header when NLS is disabled
Compiling utils fail when disable NLS with the --disable-nls switch.
"mkfs.c:46: error: 'LC_ALL' undeclared (first use in this function)"
It is due to a missing locale.h header : When enabling NLS, nls.h
includes libintl.h, which in turn includes locale.h. When disabling NLS,
libintl.h isn't anymore included nor locale.h, which is needed for the
setlocale() calls.

Signed-off-by: Gabriel Barazer <gabriel@oxeva.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-23 14:03:13 +02:00
Stepan Kasal 7f97ecc938 build-sys: use dist_noinst_HEADERS in include/Makefile.am
It is slightly more appropriate.

Signed-off-by: Stepan Kasal <skasal@redhat.com>
2007-05-16 11:43:31 +02:00
Karel Zak 66a9411eb0 newgrp: add support for /etc/gshadow
The original newgrp command doesn't expect group pasword in /etc/gshadow
although almost all distributions use this file (and the gpasswd command).

The newgrp from util-linux is deprecated and better is use shadow-utils only.
Unfortunately, shadow-utils are broken too (see RH version where is bugfix).
In this case it's better fix util-linux version at least...

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-21 23:07:25 +01:00
Karel Zak 06b04b23cd build-sys: fix ifdef ENABLE_WIDECHAR usage
There has been unexpected mix of HAVE_WIDECHAR and ENABLE_WIDECHAR macros. The
ENABLE_WIDECHAR is old version and has to be replaced everywhere otherwise we
will see bugs with multibyte stuff.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-01-30 13:49:50 +01:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00