Karel Zak [Wed, 11 Jul 2007 10:37:40 +0000 (12:37 +0200)]
sys-utils: add arch(1) back to the official tree
This patch add arch(1) back to util-linux source code tree, but the
command is not installed by defautl.
For more details see "./configure --help".
The arch command is deprecated in favor of "uname -m" (coreutils). The
latest (6.9+) version of coreutils also supports arch(1) as an alias
to "uname -a". Please, if you need arch(1) use the coreutils
implementation.
Masatake YAMATO [Tue, 8 May 2007 11:52:18 +0000 (11:52 +0000)]
lomount.c: don't use mlockall if CRYPT_NONE
loop back mounting emits two system calls: mount and mlockall.
mount is obviously needed. mlockall is needed for encryption.
As the result both CAP_SYS_ADMIN and CAP_IPC_LOCK are needed
to do loopback mounting.
The problem is that CAP_IPC_LOCK is always needed through my
command doesn't need encryption.
With the following patch, mount calls mlockall only when
encryption is needed.
H. Peter Anvin [Sat, 7 Jul 2007 01:32:31 +0000 (18:32 -0700)]
fdisk: when generating a DOS disk label, give it an ID
Newer Micro$oft operating systems (NT 3 and later) put a 4-byte
signature in the MBR at offset 440 decimal. Generate a random such
signature when creating a new disk label, and allow it to be changed.
Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: fix linking when ncurses is built with --with-termlib=tinfo
When system ncurses is built with --with-termlib=tinfo option
then there are two libraries - libtinfo (which contains terminal
related functions) and libncurses (rest).
David Miller [Fri, 29 Jun 2007 22:50:21 +0000 (15:50 -0700)]
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk
label. Several fields were incorrectly mentioned and others
wrongly sized.
2) Properly set the version, sane, and num_partitions fields.
Because we weren't doing this, programs such as Solaris's format
and the Solaris kernel itself refused to recognize our disk labels
as valid.
3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason
for them to be exposed to the rest of fdisk.
4) Kill the sun_predefined_drives array hack and assosciated code.
Instead size the disk and figure out the geometry properly just
like the SGI and MSDOS partition handling do, by means of the
HD_GETGEO ioctl() and disksize().
5) If the disk label read is found to not have the proper values
set in version, sane, or num_partitions, fix them, recompute the
label checksum, dirty the disk label, and let the user know what
we did and that the fixed values will be written out if they 'w'.
This gives users an easy way to fix up disk labels created by
disk labelling programs which had this bug.
6) Create a sun_sys_getid() function so that fdisk.c does not need
to reference the sun disk label details directly, just like the
SGI code does.
Signed-off-by: David S. Miller <davem@davemloft.net>
Karel Zak [Fri, 29 Jun 2007 09:38:54 +0000 (11:38 +0200)]
blockdev: add BLKFRAGET/BLKFRASET ioctls
In Linux 2.6 the BLKRASET ioctl has the desired effect for mounted
file-systems. In Linux 2.4 it appears to set the number of blocks to
read-ahead on the *device* as opposed to within a *file*, and the
maximum value of this number is 255. As a result the invocation of
blockdev will fail on Linux 2.4 for any usefully large value of
READAHEAD, and will not in any case have the desired affect for
fragmented files.
(Based on the blockdev-getfra-setfra.patch Debian patch.)
Luciano Chavez [Fri, 9 Mar 2007 03:07:52 +0000 (21:07 -0600)]
sfdisk: setting default geometry values
The cfdisk and fdisk set defaults for heads and sectors in order to handle a
situation when the get_geometry() ends up with zeroes for the disk geometry for
device-mapper devices. This patch add same functionally to sfdisk.
You know that a dmsetup setgeometry of the the dm device can be used to
circumvent the issue but users may not immediately realize they need to do
that.
Kay Sievers [Thu, 21 Jun 2007 11:31:52 +0000 (13:31 +0200)]
mount: use encoded labels for volume_id
The current version of libvolume_id exports the encoding function for the
symlinks names, so slashes in labels and other chars, that don't really fit
into symlink names, will work as expected with LABEL=.
Cliff Wickman [Mon, 11 Jun 2007 20:24:45 +0000 (15:24 -0500)]
taskset: independent of hardcoded NR_CPUS max.
This patch makes the taskset command independent of the system's maximum
number of cpus (CONFIG_NR_CPUS). The maximum for CONFIG_NR_CPUS is a
moving target.
With this patch the size of the systems's cpumask_t is gotten from
sched_getaffinity(2).
This patch uses variable length bitmasks borrowed from Paul Jackson's
variable size bitmask routines (hence I kept his copyright notice).
This replaces the use of the glibc CPU_SETSIZE, CPU_SET, CPU_ZERO and
CPU_ISSET macros which depend on a hardcoded size for cpu_set_t.
(also fixes one little nit: the -V option is "-v" in the built-in help, so
changed the built-in help)
Signed-off-by: Cliff Wickman <cpw@sgi.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 18 Jun 2007 13:44:02 +0000 (15:44 +0200)]
losetup: add a new option -s
The losetup provides an -f option to discover an unused loop device. As
implemented, it is racy. The problem is that -f prints the loop device
to stdout only when used standalone. This means a script has to do:
lodev=$(losetup -f)
losetup $lodev $filename
which is racy if another script may be running.
This patch add a new option '-s'. The '-s' option prints device name
if the -f option and a file argument are present. For example:
Mike Frysinger [Wed, 13 Jun 2007 09:52:55 +0000 (05:52 -0400)]
swapon: fix swapon headers and syscalls
This patch scrubs anything related to SWAPON_NEEDS_TWO_ARGS as this is only
relevant for < linux-1.3.2 and i say it's about time we let it go.
I also cleaned up the system call fallback logic as the _syscall#() macros are
the deprecated interface in favor of the real syscall() function.
The asm/page.h gets the boot as nothing in swapon.c utilizes defines from it
while unistd.h gets always included as defines/functions are used from it other
than just swapon().
Karel Zak [Tue, 12 Jun 2007 15:46:16 +0000 (17:46 +0200)]
cal: widechar code cleanup
This patch make widechar code (cal headers initialization) more
robust. That's possible to format wide char strings by swprintf() and
non-widechar version by sprintf(). This is better than the old
solution with wcscat().
Karel Zak [Thu, 31 May 2007 12:31:51 +0000 (14:31 +0200)]
fdisk: add GPT detection code
The GPT (GUID Partition Table) is unsupported by fdisk, sfdisk and
cfdisk. Unfortunately, the fdisk doesn't complain about GPT.. that's
dangerous, because user is able to blindly edit PT with unexpected
results.
Karel Zak [Wed, 30 May 2007 15:57:30 +0000 (17:57 +0200)]
fdisk: cleanup full disk detection code
The full disk (e.g. /dev/hda) detection code is duplicated on two places and
the code doesn't work correctly with devices which don't support HDIO_GETGEO.
Karel Zak [Mon, 28 May 2007 12:48:23 +0000 (14:48 +0200)]
mount: add support for mixed usage of SPECes
This patch improves a way how the mount works with SPECes (devname,
LABEL or UUID) and nodes (mountpoints) from command line.
The patch adds support for mixed usage of SPECes -- it means on
command line is different SPEC than in the /etc/fstab file. For
example:
command line:
mount LABEL=foo
fstab:
UID=915b048a-998d-4ee5-9e6b-7fcaaf34d3c5 /mnt/foo auto default
The mount command doesn't strictly require same SPEC on command line
and in fstab anymore. You can be more creative and mix UUID, LABEL
or device name.
This implementation is more effective that convert *all* entries from
/etc/fstab to a real devnames.
added debug mode to the mount command. It was mistake. It's better to
use old verbose mode instead a new debug mode. This patch transform
all staff from debug mode to to verbose mode.
Karel Zak [Fri, 25 May 2007 10:28:49 +0000 (12:28 +0200)]
mount: parse SPEC before search in fstab
The mount blindly uses a SPEC from command line and tries to found the
SPEC in /etc/fstab. It's better to parse the SPEC and search by UUID,
LABEL or devname only.