Commit Graph

512 Commits

Author SHA1 Message Date
Petr Uzel 6ad929bbac libmount: fix some typos and copy&paste mistakes in comments
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-03-31 00:01:33 +02:00
Karel Zak 2b6bd96f2b libmount: fix memory leak in cache
Reported-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-30 23:52:56 +02:00
Karel Zak 4b658e0997 libmount: add phelper= support
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-30 15:40:56 +02:00
Karel Zak 6f5788c592 libmount: small lock code cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-30 13:58:04 +02:00
Karel Zak 66bb826710 libmount: use chdir() and NOFOLLOW umount flag for umount operation
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-30 13:00:03 +02:00
Karel Zak a2c90d998e libmount: fix test
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-30 12:39:24 +02:00
Karel Zak 701b48cf01 libmount: cleanup umount code
This patch removes obsolete stuff. The minimal requirement for
libmount umount code is Linux >= 2.4.11.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-30 11:30:23 +02:00
Karel Zak 5976114f62 libmount: block signals when writing to mtab
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-30 09:30:05 +02:00
Karel Zak 7cf389f735 libmount: fix leak in sample program
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-28 23:28:45 +02:00
Karel Zak c570f567eb libmount: create a default lock for mtab update
Now it's necessary to explicitly create a lock for mnt_update_table().
It seems better to create the lock in mnt_update_table() by default to
skip this extra step.

Reported-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-28 12:40:24 +02:00
Karel Zak 5af1532e05 libmount: rename mount option "quiet" to "silent"
See commit 2ac1890aa0.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-18 09:21:32 +01:00
Karel Zak 5298f72839 libblkid: add blkid_evaluate_spec()
The function blkid_evaluate_tag() is useful for tags only (e.g.
LABEL=foo). But we also need to address devices by tags OR paths in
many utils.

The function blkid_evaluate_spec() support this functionality without
extra care about the way how device is addressed. The tags as well as
paths are converted to the standardized device path.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-17 12:51:06 +01:00
Karel Zak 7ee96990c0 build-sys: include <uuid.h> rather than <uuid/uuid.h>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-16 17:04:21 +01:00
Karel Zak 403e2d0c02 build-sys: don't support external (e2fsprogs) libuuid
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-16 17:03:48 +01:00
Karel Zak 7e256156f4 libblkid: use blkid_probe_get_buffer() more carefully
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-16 14:06:23 +01:00
Karel Zak 5982583a4e libmount: cleanup *_do_[u]mount() return codes and docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-14 14:33:53 +01:00
Karel Zak 1734f82c24 libmount: keep code more readable for analyzers [coverity scan]
This is not a bug ('ent' is always non-NULL is 'm' is non-NULL), but
let's keep static analyzes and humans who read the code happy.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11 13:57:14 +01:00
Karel Zak c9a21ec00c libblkid: fix typo in *_to_cpu() usage in raid detection [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11 13:40:33 +01:00
Karel Zak 385c3535ee libblkid: add PART_ENTRY_* to docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11 13:31:07 +01:00
Karel Zak 6c7d5ae9a2 move struct option to .rodata
It does not make sense to have writable large arrays of "struct
option" on the stack.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-03 15:00:30 +01:00
Karel Zak 3d604b4367 libblkid: fix gcc warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-01 15:31:49 +01:00
Karel Zak c2ec2ff9a2 libblkid: fix EFI GPT uuid byte order
Intel uses little-endians for UUID, the rest of the sane world uses 16
byte big-endian array...

Reported-by: Andrew Lutomirski <luto@mit.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-01 10:01:21 +01:00
Karel Zak 8b7eae458c libblkid: try to detect if PT is newer than LVM
LVM (pvcreate) wipes the begin of the device. If there is a PT in the
wiped area then LVM signature is obsolete.

 # pvcreate /dev/sdb
 # fdisk /dev/sdb

old version:
 # blkid -p -o udev /dev/sdb
 ID_FS_TYPE=LVM2_member

new version:
 # blkid -p -o udev /dev/sdb
 ID_PART_TABLE_TYPE=dos

Reported-by: Matej Cepl <mcepl@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=679799
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-24 14:21:11 +01:00
Karel Zak ddfc6f28a7 libmount: better "user" evaluation
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-23 00:21:54 +01:00
Karel Zak f2b3a3a328 libmount: don't export functions for vfs/fs/userspace mount options
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-22 18:41:20 +01:00
Karel Zak cc6b1d11ea lsblk: fix readlink() usage
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-18 14:36:04 +01:00
Karel Zak 5b7cb8687f Revert "libmount: do not check for EAGAIN after flock()"
Linux is not 100% POSIX compatible in this area...
 strace: "flock(3, LOCK_EX|LOCK_NB)   = -1 EAGAIN (Resource temporarily unavailable)"

This reverts commit 78d8c28f74.
2011-02-18 10:53:50 +01:00
Karel Zak 48399694a9 Revert "libuuid: do not check for EAGAIN after flock()"
Linux is not 100% POSIX compatible in this area...
 strace: "flock(3, LOCK_EX|LOCK_NB)   = -1 EAGAIN (Resource temporarily unavailable)"

This reverts commit d6c8d399b9.
2011-02-18 10:52:22 +01:00
Karel Zak 7be3d92f88 build-sys: add uuid_generate_time_safe.3 .gitignore
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 16:32:36 +01:00
Karel Zak e47bce7822 libuuid: move __uuid function to UUIDD_PRIVATE in uuid.sym
The private functions for uuidd should not be included in the normal
versioned part or the library.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-16 16:36:18 +01:00
Petr Uzel e3d4e31c94 libuuid: update manpage, mention uuid_generate_time_safe
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:16 +01:00
Petr Uzel 5ce8da3c33 libuuid: introduce uuid_generate_time_safe()
The problem with libuuid interface is that it is impossible to
inform the caller of uuid_generate_time() if the UUID was generated
in a safe manner (either via uuidd, or using the global clock state
counter).

This patch introduces new function,

int uuid_generate_time_safe(uuid_t out)

which can report whether the generated UUID is safe.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:16 +01:00
Petr Uzel 46bae9f340 libuuid: __uuid_generate_time(): report if clock_seq is safe
Propagate return value from get_clock() through __uuid_generate_time().

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 70b989c280 libuuid: rename uuid__generate_* to __uuid_generate_*
Having uuid_generate_time and uuid__generate_time at
the same time is confusing. These functions are exported,
but not part of the official API (used by uuidd only).

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 34b2e3f133 libuuid: get_clock(): report if the clock_seq is safe
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 20c04820d1 libuuid: do not use invalid file descriptor
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 62b47b3acb libuuid: manpage spelling fixes
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 7491ee6a5a libuuid: fix test in get_clock()
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Benno Schulenberg e8ab5ce3d0 textual: improve the wording of some error and usage messages
[kzak@redhat.com: - cleanup lscpu(1) usage text
                  - use <disk> rather than <device> in partx(8)
                    usage text]

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-16 15:46:38 +01:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
Solaris lacks err, errx, warn and warnx.  This also means the err.h header
doesn't exist.  Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:45:24 +01:00
Karel Zak db9bd703a9 libmount: add fallbacks for old systems without umount2() syscall
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 10:45:09 +01:00
Karel Zak 4b6cf4859a libmount: replace mkostmps() with more portable mkstemp()
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 10:18:00 +01:00
Karel Zak cddd0999a2 tests: fix libmount test
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-09 15:02:41 +01:00
Petr Uzel d6c8d399b9 libuuid: do not check for EAGAIN after flock()
As per flock() manpage, flock() does not set errno=EAGAIN.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-09 14:23:49 +01:00
Petr Uzel 78d8c28f74 libmount: do not check for EAGAIN after flock()
As per flock() manpage, flock() does not set errno=EAGAIN.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-09 14:23:49 +01:00
Karel Zak 4b67533baa libmount: more robust flock() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-08 16:32:53 +01:00
Petr Uzel c190c6c2e9 libuuid: fix locking of clock state counter file
fcntl(2) does not work for synchronization of threads belonging
to the same process. Use flock(2) instead.

http://marc.info/?l=util-linux-ng&m=129708412829971&w=2

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 16:27:17 +01:00
Karel Zak 309139c7dc libmount: add and copy FS internal flags
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-07 15:17:07 +01:00
Karel Zak 92b7c04d01 libmount: don't prepare update if syscall failed
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-07 15:15:30 +01:00
Karel Zak b70785bca6 libmount: cleanup helper initialization API
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-02 22:32:52 +01:00