Make it possible to unmount a filesystem on a loop device if it is
specified by associated backing file. It does not attempt to unmount
anything if there are more than one loop device associated with the
given file.
Umount looks for associated loopdevice(s) only if umount is called
with the regular file as an argument.
Before:
mount -o loop -t ext2 img mnt
umount -v img
> Could not find /home/puzel/upstream/util-linux/img in mtab
> umount: img: not mounted
After:
mount -o loop -t ext2 img mnt
umount -v img
> img is associated with /dev/loop0, trying to unmount it
> /dev/loop0 has been unmounted
[kzak@redhat.com: - fix memory leak in lomount.c]
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=666161
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
New usage help screen and print version switch. Also fixes to
exit codes, util linux xmalloc replaced emalloc and every error
print is using libc error function.
[kzak@redhat.com: - minor changes in formatting and coding style]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
When you have more than one resource with the same id (but differing
types) combining -a and -i does not show all resources. This patch
corrects that.
Signed-off-by: Jens Kristian Søgaard <jens@mermaidconsulting.dk>
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.
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.
The free() before exit() is not so important, but let's keep the
example code nice and consistent.
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
In lib/wholedisk.c, i is set to 0. If fd was a -1, then at
line 18 geometry.start is used without it being initialized.
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
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>
[kzak@redhat.com: - use <disk> rather than <device> in
error/verbose messages]
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
[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>
All compler errors reported by -Wall -Wextra -pedantic are fixed.
The patch also makes fsck to use xalloc instead of it's own malloc.
That will make fsck to exit, which could be good thing, at sections
where it previously did not.
Almost all print outs where touched, where various printfs where
converted to warn or err messages.
Finally theres a fix to counter wrap bug that could (very unlikely)
manifest itself if an user specifies same flag exactly UINT_MAX times.
[kzak@redhat.com: - coding style
- define XALLOC_EXIT_CODE
- use verbose++ in main()]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
This is visible on a 2TB disk via lsblk, where a large partition
incorrectly displays as 1.171798692T instead of 1.8T. This is
corrected by using a uint64_t type instead of a simple int --
consistant with the type used in lsblk.c to represent the raw size in
bytes.
[kzak@redhat.com: - add EiB support
- add size_to_human_string() to regression tests]
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Usage output screen got to be completely rewrote. Aim is to
assist user to determe which switches to use without reading
manual page. The change also introduced new option to see command
version.
Determination if the executable name is `page' is now easy to see
in source, and effect of using the name is mentioned in manual
page.
Rest of the change is trivial; exit values to compiler warning
removals, magic constants to preprocessor definitions, symbolic
exit values, comment pretty printing and #endif markups.
[kzak@redhat.com: - coding style
- add __unused__ attribute to signal handlers]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
It adds the ability to logger to log a message to a udp socket. The -n option
followed by the hostname of the remote host is mandatory to do this. The
optional -P option can be used to change the UDP destination port (default
514). The function udpopenlog is used to open the udp socket. After that
everything works in almost the same way like it does when logging to a UNIX
socket.
Signed-off-by: Josef Wuebbels <josef.wuebbels@mtu.de>
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>
To avoid a conflict with the warn function from err.h, renamed warn to
my_warn, as the functionality of both is not the same.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
This patch provides some minor code fixes: add/remove some macros and close the device after usage.
Also modifies usage() and changes main()'s indentation to 8-characters.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>