Zdenek Behan [Tue, 19 May 2009 14:19:32 +0000 (16:19 +0200)]
fdisk: add simple test for doslabel stuff
Initial tests/fdisk patch to test most of the doslabel-related stuff.
Coverage of dos-related functions is about 60%, does not test the
verify/fix-PT code.
[kzak@redhat.com: - fix test design to match to
output/expect/diff idea]
Signed-off-by: Zdenek Behan <rain@matfyz.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
Chris Webb [Wed, 13 May 2009 14:54:23 +0000 (15:54 +0100)]
fdisk: (and cfdisk) fix to be consistent about maximum heads
Fix fdisk and cfdisk to be consistent about maximum heads
Without this patch, fdisk allows up to 256 heads to be set via the menu, but
only up to 255 heads by command line -H. Similarly, cfdisk's -H option also
enforces heads <= 255 instead of heads <= 256.
The strange limit of 256 comes about because (heads - 1) should fit in a
single byte for legacy CHS. Geometries of 256 heads and 32 sectors are seen
in disks from other operating systems where cylinder-aligned partitions
which are also aligned to a 4MB boundary are wanted.
Karel Zak [Thu, 14 May 2009 16:29:03 +0000 (18:29 +0200)]
blkid: blkid_do_safeprobe() has to be tolerant to RAIDs
It's pretty generic that RAID signature is on the same device as FS
signature. We have to be tolerant and ignore filesystems signatures
on such devices. The RAID signature is always preferred.
Karel Zak [Thu, 14 May 2009 16:04:55 +0000 (18:04 +0200)]
blkid: fix "hangs forever with partition type mdraid"
> #:> blkid /dev/sda7
> /dev/sda7: UUID="c193d159-1fd4-1a4b-4037-f3433e016f3d" TYPE="mdraid"
>
> The blkid binary build from the util-linux-ng sources just hangs
> forever with 100% cpu load with the same command.
Reported-by: Juergen Daubert <jue@jue.li> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Sun, 10 May 2009 20:57:31 +0000 (16:57 -0400)]
losetup: handle symlinks in /dev/loop/
The loop_scandir() expects all the files in /dev/loop/ to be actual
devices and not symlinks to devices. However, udev by default sets up
symlinks in /dev/loop/ thereby breaking the fallback scan logic when
looking for devices more than the default number of 8.
Simple way to reproduce is:
- <detach all devices>
- cd /dev/loop
- rm -f [2-7]
- losetup 0 autogen.sh
- mv 1 8
- for n in {1..7} ; do ln -s 0 $n ; done
- losetup -f
<error but should have found /dev/loop/8>
[kay.sievers@vrfy.org:
just a note, udev does not do that by default. It is
devfs-nonsense, which the "default" never did.]
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reported-by: Mario Bachmann <grafgrimm77@gmx.de>
Mike Frysinger [Sun, 10 May 2009 20:37:18 +0000 (16:37 -0400)]
lscpu: fix cpuid code on x86/PIC
If we build lscpu as PIE, we currently get a build failure:
lscpu.c: In function 'main':
lscpu.c:333: error: can't find a register in class 'BREG' while reloading 'asm'
lscpu.c:333: error: 'asm' operand has impossible constraints
make[2]: *** [lscpu.o] Error 1
So we need a little bit of register shuffling to keep gcc happy.
chrt: don't assume SCHED_BATCH and SCHED_IDLE exist
SCHED_FIFO, SCHED_OTHER, SCHED_RR are part of POSIX 1003.1b Process
Scheduling, so it is correct to assume they always exists.
SCHED_BATCH and SCHED_IDLE are Linux specific, we should not assume
they exists.
Defining SCHED_BATCH and SCHED_IDLE to random values (ie the ones found
on Linux systems) is not an option as they may *collide* with the one of
other systems. For example on GNU/kFreeBSD we have:
#define SCHED_RR 3
and on Linux we have:
#define SCHED_BATCH 3
[kzak@redhat.com: - add "Linux specific" notes to chrt.1
- add a note about BATCH and PR conflict to
this commit message]
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 5 May 2009 19:40:19 +0000 (21:40 +0200)]
blkid: use /dev/mapper/<name> rather than /dev/dm-<N>
The libblkid (since v1.41.1) returns private device-mapper names (e.g.
/dev/dm-0). It's because the probe_one() function scans /dev before
/dev/mapper.
brw-rw---- 1 root disk 253, 0 2009-04-27 13:41 /dev/dm-0
brw-rw---- 1 root disk 253, 0 2009-04-27 13:41 /dev/mapper/TestVolGroup-TestLogVolume
Old version:
# blkid -t LABEL="TEST-LABEL" -o device
/dev/dm-0
Karel Zak [Tue, 28 Apr 2009 20:51:53 +0000 (22:51 +0200)]
blkid: split SONAME and LIBBLKID_VERSION
It seems better to split SONAME and the public library version. The
library version will be the same as util-linux-ng PACKAGE_VERSION.
PACKAGE_VERSION: <maj>.<min>[-<suffix>] e.g. 2.15-rc2
Symbols versioning: BLKID_<maj>.<min> e.g. BLKID_2.15
blkid_get_library_version(): <maj>.<min>.0 e.g. 2.15.0
SONAME: libblkid.so.1
Eric Sandeen [Fri, 24 Apr 2009 19:08:45 +0000 (21:08 +0200)]
blkid: remove whole-disk entries from cache when partitions are found
We can get into a situation in blkid where whole disks remain
in the cache, even though partitions are found. For labels
such as sun disklabels which may have the first partition
beginning at sector 0, this is even somewhat likely.
1) create a sun disklabel w/partitions
2) mkfs the first partition (at sector 0)
3) remove the partition table
4) run blkid - this finds the fs on the whole disk, places in cache
5) recreate the partition table
6) run blkid - this finds the partition, places in cache
And now we have both /dev/sda and /dev/sda1 in cache.
There are heuristics in probe_all to avoid putting the whole disk
in cache if it has partitions, but there is nothing to remove the
whole-disk entry in the above case. I think the below patch
suffices, although I haven't quite convinced myself that setting
the lens[which]=0; is the right logic for that bit of state...
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 10 Apr 2009 09:02:24 +0000 (11:02 +0200)]
login: use open(2) rather then access(2) for $HOME/.hushlogin
As an NFS client with home directories on mounted NFS share - If the
NFS server exports the share with default root squashed, login cannot
access the filesystem to check for the existence of .hushlogin file.
It seems better to use open(2) rather than access(2).
Matthew Garrett [Fri, 27 Mar 2009 00:47:22 +0000 (00:47 +0000)]
mount: Add strictatime support
2.6.30 adds (patch d0adde574b8487ef30f69e2d08bba769e4be513f) support for a
strictatime mount parameter, used to request strict atime update semantics. The
following patch adds support for it to mount.
Karel Zak [Tue, 17 Mar 2009 20:02:40 +0000 (21:02 +0100)]
tests: fix file name is too long (max 99) - gtar
gtar: util-linux-ng-2.15-rc1/tests/ts/lscpu/proc-dumps/i386-dellpe700/sys/devices/system/cpu/cpu1/topology/:
file name is too long (max 99); not dumped
Karel Zak [Thu, 12 Mar 2009 15:01:59 +0000 (16:01 +0100)]
mkswap: zap bootbits
/dev/sdb1 originally initialized by cryptsetup:
and OLD mkswap:
# vol_id /dev/sdb1 | grep TYPE
ID_FS_TYPE=swap
# blkid -s TYPE /dev/sdb1
/dev/sdb1: TYPE="crypt_LUKS"
So, we have two different *valid* signatures on the device now!
NEW mkswap:
# blkid -s TYPE /dev/sdb1
/dev/sdb1: TYPE="swap"
# /lib/udev/vol_id /dev/sdb1 | grep TYPE
ID_FS_TYPE=swap
the bootbits (first 1024 bytes) was erased.
We shouldn't zap disk labels (BSD, SUN, ...) and boot loaders (on whole
disk):
# mkswap /dev/sdb2
mkswap: /dev/sdb2: warning: don't erase bootbits sectors
(BSD partition table detected). Use -f to force.
Setting up swapspace version 1, size = 4348 KiB
no label, UUID=69d87cef-71ac-4fb0-a689-ce3e930dea17
# mkswap /dev/sdb
mkswap: /dev/sdb: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 8188 KiB
no label, UUID=97757ad7-8a84-43d9-bcb4-16fefd93a2ac
Karel Zak [Tue, 10 Mar 2009 12:36:56 +0000 (13:36 +0100)]
cal: remove gcc-ism from nl_langinfo() call
> On Tue, Mar 10, 2009 at 01:15:14PM +0100, Samuel Thibault wrote:
> That will only work with the gcc compiler, which allows to read a
> union field what you wrote in another. Shouldn't
> (int)(intptr_t)nl_langinfo() be just fine?
hwclock: add --systz option to set system clock from itself
Since the system clock time is already set from the hardware clock by the
kernel (when compiled with CONFIG_RTC_HCTOSYS), there's no particular need to
read the hardware clock again.
This option sets the system clock using itself as a reference if the
hardware clock was in local time. The resulting system clock time
is in UTC, with the kernel timezone set to the difference.
[kzak@redhat.com: - fix the condition that controls read_adjtime() call]
Signed-off-by: Scott James Remnant <scott@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Pádraig Brady [Wed, 4 Mar 2009 10:07:29 +0000 (10:07 +0000)]
cal: determine the first day of week from the locale
Previously it defaulted to Sunday rather than using
the value from the locale. Lauri Nurmi <lanurmi@iki.fi>
provided the detailed argument for this change while
Samuel Thibault <samuel.thibault@ens-lyon.org> provided
the information on how to read the first day of the week
from the locale correctly.
[kzak@redhat.com: - fix "cast from pointer to integer",
nl_langinfo(_NL_TIME_WEEK_1STDAY) call)]
Signed-off-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>