Even though --systz doesn't need to change the system clock when the
hardware clock is in UTC time (--systz --utc), it does need to set
the kernel timezone so that FAT timestamps, etc. will be correct.
Signed-off-by: Scott James Remnant <scott@ubuntu.com>
Karel Zak [Tue, 13 Oct 2009 13:37:49 +0000 (15:37 +0200)]
tests: swapon workaround for libtool wrapper
The swapon command behaviour depends on program name (argv[0] = swapon
| swapoff). It means we cannot use the libtool wrapper script in our
regression tests. It seems better to call the binaries directly with
proper LD_LIBRARY_PATH. This is probably less portable, but good
enough for our tests.
Karel Zak [Tue, 13 Oct 2009 12:22:33 +0000 (14:22 +0200)]
swapon: more robust progname probing
Currently, the 'swapoff' is the default behavior. It means that if you
have a libtool wrapper script in your build directory the executed binary
name is 'lt-swapon' and then "swapon -a" is interpreted as "swapoff -a".
Any random argv[0] should not be interpreted as "swapoff".
Mike Frysinger [Tue, 13 Oct 2009 10:05:19 +0000 (06:05 -0400)]
swapon: handle <=linux-2.6.19 bug in /proc/swaps
Linux <=2.6.19 contained a bug in the /proc/swaps code where the header
would not be displayed (the first line). Most people report the issue as
a sequence of swapon/swapoff calls to trigger, but for some lucky people,
it triggers all the time at initial boot. Since this throws up an error,
init systems don't actually activate any swap files.
First, swapon shouldn't whine about unexpected format if the file is empty
(the default at boot). This is easy to do by putting the warning behind a
check to ferror().
Second, we can detect that the first line isn't actually the header but
instead is a valid swap line and so need to be processed. This assumes
that the first line will always be the same format. Looking quickly at
older versions shows that this header has retained its exact format since
at least Linux 2.2.0 and considering the concern that goes along with proc
files and the ABI, it's highly unlikely it will ever change.
hwclock: do not access hardware clock when using --systz
When using --systz we do not read from the hardware clock, so there
is no need to search for a hardware clock. Indeed, we may be running
hwclock --systz before /dev is mounted.
Signed-off-by: Scott James Remnant <scott@ubuntu.com>
Karel Zak [Mon, 12 Oct 2009 12:14:56 +0000 (14:14 +0200)]
build-sys: clean up gtk-doc usage
Currently gtk-doc is optional. Unfortunately, the ./configure script
still depends on GTK_DOC_CHECK macro and shlibs/blkid/docs/Makefile.am
depends on gtk-doc.make.
It seems that the best solution is to add gtk-doc.[make,m4] files to
the repository.
Mike Frysinger [Sun, 11 Oct 2009 00:07:16 +0000 (20:07 -0400)]
build-sys: move fsck/mkfs for bfs/cramfs/minix to /usr
The bfs/cramfs/minix rarely (if ever?) are used for root filesystems, so
it doesn't make much sense to keep them in the root partition. Move them
to /usr by default.
Guillem Jover [Thu, 8 Oct 2009 11:40:11 +0000 (13:40 +0200)]
build-sys: check for union semun instead of using _SEM_SEMUN_UNDEFINED
Older versions of glibc used to declare ‘union semun’ in <sys/sem.h>,
but POSIX.1-2001 requires the caller to declare it instead. Later
versions of glibc started defining _SEM_SEMUN_UNDEFINED to note that
the union was not being declared, but conforming systems are not
required to define that macro (e.g. FreeBSD). As a side effect we get
rid of some obsolete __GNU_LIBRARY__ macro usage.
[kzak@redhat.com: - use #ifndef]
Signed-off-by: Guillem Jover <guillem@hadrons.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Guillem Jover [Thu, 8 Oct 2009 11:40:06 +0000 (13:40 +0200)]
build-sys: detect if const is available
Some systems define __STDC__ and do not have a working const, some do
not define the macro but do have a working const. Use AC_C_CONST to
check for its presence.
blkid is currently missing a probe for the bfs filesystem, leading
to a blkid-enable xfsprogs failing xfsqa testcase 032. This patch adds
a trivial probe for the magic.
Mikhail Gusarov [Sat, 3 Oct 2009 19:42:08 +0000 (02:42 +0700)]
unshare: new command
New utility allows to run process with separate mount, UTC, IPC or
network namespaces.
[kzak@redhat.com: - some cosmetic changes in usage() and err() usage
- move "if BUILD_UNSHARE" to separate place in Makefile.am
- add unshare to .gitignore]
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 6 Oct 2009 07:17:06 +0000 (09:17 +0200)]
libblkid: fix buffer usage in FAT prober
The blkid_probe_get_buffer() function returns buffer that could be
overwritten in the next blkid_probe_get_buffer() call. It means that
we have to save FAT super block to the temporary buffer if we want to
call blkid_probe_get_buffer() for directory entries or fsinfo.
Karel Zak [Thu, 1 Oct 2009 13:14:48 +0000 (15:14 +0200)]
libblkid: fix non-magic FAT detection
On Wed, Sep 30, 2009 at 03:15:41PM +0200, Lawrence Rust wrote:
> The problem is with shlibs/blkid/src/probers/vfat.c. At the end of
> this file the struct blkid_idinfo is declared with some magic
> search strings. In particular, 2 patterns are defined to match the
> single byte jmp/jxx opcodes at the start of a DOS boot sector.
> Because the partition was once formatted as a bootable DOS
> partition it matches these patterns and consequently the function
> probe_vfat is called. For these simple pattern matches the function
> probe_fat_nomagic is called to filter out false positives.
>
> In normal circumstances only MSDOS 2 and earlier floppies should be
> detected by this function. A very important feature of these disks
> is the boot signature - bytes 0x55, 0xaa at the end of the 1st
> sector which indicate to the BIOS that the disk is bootable. All
> MSDOS floppies have these bytes but the function probe_fat_nomagic
> doesn't check for them.
Note that the msdos/vfat superblock comments has been suggested by
Lawrence.
Reported-by: Lawrence Rust <lawrence@softsystem.co.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 29 Sep 2009 09:08:32 +0000 (11:08 +0200)]
libblkid: fix the default cache file path
The blkid_get_cache_filename() can returns BLKID_CONFIG_FILE instead
BLKID_CACHE_FILE. Yeah, pretty stupid typo.
Fortunately, this brown-paper-bag bug is invisible in almost all cases,
because the default path is returned by blkid_read_config(). The bug
can be visible only when blkid_read_config() returns NULL -- it means
on parses or malloc error.
Karel Zak [Fri, 25 Sep 2009 12:40:23 +0000 (14:40 +0200)]
libblkid: use fstatat(), improve readdir() usage
* fix possible memory leak in ubi_probe_all()
* use dirent->d_type if available (this is tricky, because d_type
is not supported on all systems and some filesystems returns
DT_UNKNOWN). The dirent->d_type allows to avoid unnecessary stat()
calls.
* use fstatat() if available -- allows to avoid malloc() and
sprintf("%s/%s", dirname, dirent->d_name)
Corentin Chary [Mon, 24 Aug 2009 11:11:54 +0000 (13:11 +0200)]
libblkid: add UBI volume support
Probe UBI volume under /dev (or /devfs, /devices).
ubi_ctrl skip is hardcoded, maybe we should find a
cleaner way to do that. Also change probe.c to handle
char devices.
[kzak@redhat.com: - rebase the patch to the current HEAD]
Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 18 Aug 2009 11:33:27 +0000 (13:33 +0200)]
fallocate: new command
The fallocate(1) utility is used to preallocate blocks to a file.
This can be useful for virtual images, database files, testing, etc.
Normally we'd hope that various tools will start using preallocation
internally, but until then such a utility may be useful, and could be
scripted as well.
The original Eric's version is available at:
http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/2490
This version:
- checks for fallocate glibc function and kernel syscall
- does not provide a fallback and does not call posix_fallocate()
- adds long options
- uses err.h for errro messages
- adds NLS support
- cleanups man page
Co-Author: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
mount: document changed semantics of tmpfs size option in mount.8
Linux kernel commit 818db35992c249dc32c1d86daf7d533fb0952f5d fixed a
problem where invoking mount -t tmpfs with a size argument smaler than the
size of one page caused the limits on the size of a tmpfs to not operate.
The commit also caused the number supplied by the size option to be
rounded up to the nearest page size instead of down. This alters the man
page to match the behavior of the kernel in this instance.
Signed-off-by: Kevin Granade <kevin.granade@gmail.com>
Eric Sandeen [Thu, 17 Sep 2009 21:56:00 +0000 (16:56 -0500)]
libblkid: fix topology information values
Looks like the topology values returned are being
inflated by x 512, but the kernel reports them in bytes;
no need for the multiplication, just return the value as-is.
Karel Zak [Wed, 16 Sep 2009 14:17:41 +0000 (16:17 +0200)]
lib: add a generic crc32()
This is public domain implementation, based on static crc32_table[].
This implementation is used on may places (libparted, FreeBSD kernel,
PostgreSQL, ...). The Linux kernel uses on-the-fly generated and
allocated tables. That's useless in shared libraries.