Karel Zak [Thu, 19 Nov 2009 14:56:12 +0000 (15:56 +0100)]
mount: check for unsuccessful read-only bind mounts
Linux kernel allows to use MS_RDONLY together with MS_BIND,
unfortunately the MS_RDONLY is silently ignored and the target
mountpoint is still read-write. Then we have 'ro' in mtab and 'rw' in
/proc/mounts.
This patch checks for this situation by access(2) or futimens(2)
(change atime) and mtab is properly updated and user informed.
Reported-by: Terry Burton <tez@terryburton.co.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 4 Nov 2009 14:14:04 +0000 (15:14 +0100)]
fdisk: offer aligned first sector
Typical "new partition" dialog looks like:
Partition number (1-4): 1
First sector (4-818687, default 4):
^^^^^^^^^
The range (e.g. 4-818687) depends on fdisk mode (DOS/non-DOS), but the
default value should be always aligned.
For example RAID5 device in the DOS mode:
Disk /dev/md0: 419 MB, 419168256 bytes
2 heads, 4 sectors/track, 102336 cylinders, total 818688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
Disk identifier: 0x081479c3
....
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (4-818687, default 128): <---- !!!
Using default value 128
Last sector, +sectors or +size{K,M,G} (128-818687, default 818687): +10M
Command (m for help): p
....
Device Boot Start End Blocks Id System
/dev/md0p1 128 20607 10240 83 Linux
Karel Zak [Tue, 3 Nov 2009 11:00:23 +0000 (12:00 +0100)]
fdisk: print info and recommendations about alignment
* inform user that phy.sector > log.sector
* warn user when alignment_offset is not provided does, DOS-compatible
mode is enabled and the default geo.sectors are not aligned
* suggest to change display units to sectors (oh yes, fdisk
default are cylinders...)
Karel Zak [Thu, 29 Oct 2009 10:25:59 +0000 (11:25 +0100)]
fdisk: read topology info from libblkid
and print ('p' command) info about logical and physical sectors and
alignment_offset.
minimum_io_size
we don't use physical sector size directly, because on RAIDs is
better to use minimum_io_size (aka stripe chunk size). For disk drives
is minimum_io_size the same value as physical sector size.
alignment_offset
For compatibility with legacy operating systems some vendors provide
disks where logical and physical sectors are aligned at sector 63
(= geometry.sectors). In other words the physical 4KB sectors
start at LBA -1. Then the physical boundary is at:
Karel Zak [Tue, 10 Nov 2009 11:48:34 +0000 (12:48 +0100)]
Revert "libblkid: fix buffer usage in FAT prober"
This patch is unnecessary, the library uses two buffers and the VFAT
superblock is always stored in the probe->sbbuf buffer which is never
overwritten. It seems that FAT fsinfo is also in the superblock
buffer. I was too paranoid :-) Sorry.
Karel Zak [Fri, 6 Nov 2009 22:43:46 +0000 (23:43 +0100)]
build-sys: clean up gtk-doc stuff
* gtk-doc.make does not care about difference between $srcdir and $builddir
and many things are generated into $srcdir. It's pretty difficult to support
out-of-source build...
* gtk-doc expects that many generated files are stored in repository
(we don't use XML templates, all documentation in source code only).
* we don't want to distribute generated html files, the docs is
attractive for very small group of people...
Frankly, it would be nice to found something more robust and better
than gtk-doc.
Karel Zak [Fri, 30 Oct 2009 11:20:51 +0000 (12:20 +0100)]
libblkid: does not return useless binary data
Currently, the binary blkid_probe_get_{topology,partitions}() API
returns empty structs when information has not been gathered. This is
confusing for applications. It's seems better to return NULL.
Reported-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 27 Oct 2009 10:30:37 +0000 (11:30 +0100)]
libblkid: add BLKID_{VERSION,DATE} to blkid.h
The original e2fsprogs has BLKID_{VERSION,DATE} macros in blkid.h.
Although the macros are not updated for many years in e2fsprogs. So I
guess nobody uses it.
Crypto devices may sometimes have multiple additional prober matches,
however just like RAID, there's no danger of activating the wrong one
since special help is needed to activate the block device before it
can be used.
Thus modify blkid_do_safeprobe() to break out of the loop when a
crypto device is detected, as it does already for RAID.
Signed-off-by: Scott James Remnant <scott@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* on systems where DM is fully integrated with udev the /dev/mapper/<name>
files are symlinks to /dev/dm-N. It means we need a special care to hide
private device-mapper names.
Karel Zak [Thu, 22 Oct 2009 12:52:39 +0000 (14:52 +0200)]
libblkid: use BLKSSZGET for GPT sectors
The current implementation uses fixed sector size (512 bytes), that's
wrong. UEFI standard requires real logical sector size -- it means
BLKSSZGET for Linux.
The size of GPT header is not static, but whole sector is allocated
for the header. In theory the HeaderSize field could be greater than
sizeof(struct gpt_header). It means we have to read whole sector with
the header, because the header crc32 checksum is counted according to
HeaderSize.
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.