Karel Zak [Fri, 16 Oct 2009 00:34:28 +0000 (02:34 +0200)]
libblkid: add missing packed attributes
This patch add __attribute__((packed)) to almost all superblock and
disk label definitions. Well, in many cases this is not necessary, but
it's a cheap way how to keep the code robust...
Karel Zak [Thu, 15 Oct 2009 21:37:34 +0000 (23:37 +0200)]
tests: update fsck.ismounted test
The latest version of the lib/test_ismounted binary returns absolute
mountpoint path too. This patch removes the path from test output (the
path is variable).
Karel Zak [Wed, 14 Oct 2009 23:22:42 +0000 (01:22 +0200)]
blockdev: add topology ioctls support
new options:
--getpbsz get physical block (sector) size
--getiomin get minimum I/O size
--getioopt get optimal I/O size
--getalignoff get alignment offset
--getmaxsect get max sectors per request
Karel Zak [Wed, 14 Oct 2009 00:17:27 +0000 (02:17 +0200)]
blkid: add pretty output, document -L incompatibility with e2fsprogs
... sad story, I have temporary disabled pretty-output code
in very early version of blkid.c in u-l-ng. (It was also in
time when pretty-output was very new feature in e2fsprogs.)
Unfortunately, the -L option (shortcut to "-o list") in u-l-ng version
was reused for for any other functionality few months later.... this
stupid thing was released in u-l-ng 2.15 and 2.16 without any negative
feedback from users.
It means the blkid from u-l-ng is not backwardly compatible with
the original version from e2fsprogs. The -L option has a different
meaning there.
I'm sorry about this bug...
This patch:
* enable pretty-output (-o line)
* add a note about incompatibility between u-l-ng and e2fsprogs
to blkid.8 man page
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.