Commit Graph

1839 Commits

Author SHA1 Message Date
Karel Zak aae63de9ef fdisk: swap VTOC values for warning messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-19 16:11:49 +01:00
Karel Zak df82f6f305 libblkid: improve Sun VTOC
It seems that for example GNU Parted is able to generate Sun VTOC with
empty sanity, version and nparts fields. But there is still useful
info about partition flags in such VTOC.

This change makes libblkid Sun PT parser compatible with Sun PT
parser in Linux kernel.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-19 14:54:25 +01:00
Karel Zak aaf8fffb35 blkid: fix blkid_probe_lookup_value() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-19 10:15:11 +01:00
Karel Zak dcc58f62c4 blkid: encode PART_ENTRY_TYPE
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 23:04:22 +01:00
Karel Zak fbe66f6bcf libblkid: add PART_ENTRY_{SCHEME,NUMBER}
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 23:01:38 +01:00
Karel Zak 75838802d7 libblkid: add support for partition flags/attributes
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 22:53:44 +01:00
Karel Zak c2dacc61aa libblkid: add blkid_partition_set_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 22:28:41 +01:00
Bryn M. Reeves 5ac78ead3c sfdisk: make sure writes make it to disk in write_partitions()
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=565946
Signed-off-by: Bryn M. Reeves <bmr@errorists.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 21:41:58 +01:00
Karel Zak 4f74ffdbfe blkid: export ID_PART_ENTRY_* variables for udev
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 16:46:56 +01:00
Karel Zak 0c6dc61532 libblkid: add support for PART_ENTRY_* values
blkid(8) will be replacement for devkit-disks-part-id, so we have to
be able to found entry in partition table for requested partition.

This functionality is enabled by BLKID_PARTS_ENTRY_DETAILS flag
(see blkid_probe_set_partitions_flags() for more details).

This patch also add a new public function blkid_partlist_devno_to_partition().

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 16:38:59 +01:00
Karel Zak 5689113d88 libblkid: don't probe for nested PT on tiny disks (<=1.44MiB)
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 16:19:31 +01:00
Karel Zak 220c60151d libblkid: add generic functions for sysfs attributes
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 11:29:17 +01:00
Andreas Dilger e54a76ca07 libblkid: fix ZSF detection
Fix the ZFS device detection by looking at multiple uberblocks to see
if any are present, rather than looking for the ZFS boot block which
is not always present.

There may be up to 128 uberblocks, but the first 4 are not written to
disk on a newly-formatted filesystem so check several of them at
different offsets within the uberblock array.

[kzak@redhat.com: - port e2fsprogs patch to util-linux-ng]

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-17 10:23:55 +01:00
Karel Zak 98e9ff610e swapon: fix swapsize calculation
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-16 13:48:09 +01:00
Karel Zak 4fc5d65bf2 blkid: report open() errors in low-level probing
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-16 09:43:26 +01:00
Karel Zak a47e839cd7 fdisk: don't use 1MiB grain on small devices
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-15 16:46:05 +01:00
Karel Zak c89d620e03 tests: update fdisk tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-15 16:08:20 +01:00
Karel Zak 9b15ea8048 fdisk: use 1MiB offset and grain always when possible
It would be nice to minimize dependence between the disk layout and
disk topology. We have to follow disk topology for alignment_offset
and huge (> 1MiB) I/O sizes only. For all others disks we can use 1MiB
grain and 1MiB offset.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-15 16:08:02 +01:00
Karel Zak 78498b7b90 fdisk: add -c option (switch off DOS mode)
* add -c to allows to switch off DOS mode from command line

 * recommend sectors (command 'u' or option -u)

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-15 14:43:49 +01:00
Karel Zak d42ef322d0 fdisk: fix ALIGN_UP
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-15 14:43:49 +01:00
Karel Zak e57fb0dec0 fdisk: fallback for topology values
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-15 14:43:33 +01:00
Karel Zak 3b19e88dab fdisk: cleanup help, add -h option
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-15 10:08:03 +01:00
Karel Zak 1c5530fb74 tests: update fdisk tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 22:10:52 +01:00
Karel Zak 99bdcd5fbd fdisk: use more elegant way to count and check alignment
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 21:43:03 +01:00
Karel Zak 1cb1641dde include: add min/max macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 21:42:46 +01:00
Karel Zak 4bc7b0e24d mount: advise users to use "modprobe", not "insmod"
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=562394
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 19:58:45 +01:00
Francesco Cosoleto 7929b548cc cfdisk: set '[New]' as default item on menu for non allocated space instead of '[Help]'.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2010-02-12 19:31:41 +01:00
Karel Zak 2a7c1f70a6 build-sys: add missing tests for libuuid and libblkid
$ make checkconfig
misc-utils/blkid.c : HAVE_TERMIO_H
misc-utils/blkid.c : HAVE_TERMIOS_H
shlibs/blkid/src/getsize.c : HAVE_FSTAT64
shlibs/blkid/src/llseek.c : HAVE_LLSEEK_PROTOTYPE
shlibs/blkid/src/llseek.c : HAVE_LSEEK64_PROTOTYPE
shlibs/uuid/src/gen_uuid.c : HAVE_SA_LEN*/
shlibs/uuid/src/gen_uuid.c : HAVE_SYS_SOCKET_H
shlibs/uuid/src/gen_uuid.c : HAVE_SYS_SYSCALL_H

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 12:43:07 +01:00
Karel Zak 06b1e27aaf blkid: fix #ifdef HAVE_TERMIO[S]_H
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 10:32:34 +01:00
Karel Zak a4a1da09cd build-sys: remove duplicate #includes
$ make checkincludes
fsck/fsck.c: errno.h is included more than once.
lib/canonicalize.c: string.h is included more than once.
shlibs/blkid/src/blkidP.h: stdio.h is included more than once.
shlibs/blkid/src/devname.c: string.h is included more than once.
shlibs/blkid/src/devno.c: string.h is included more than once.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 10:21:05 +01:00
Karel Zak ce7ca2aac3 docs: update TODO file
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-11 17:25:06 +01:00
Karel Zak aebb9522b7 cal: fix first day of the week calculation on BE systems
This reverts commit dcb54fafb1,
"cal: remove gcc-ism from nl_langinfo() call".

The code:

	int wfd = (int)(intptr_t) nl_langinfo(_NL_TIME_WEEK_1STDAY);

does not work on big-endian machines. The original solution based on
union is better.

Note that the "type punning" is not gcc-ism any more, it's allowed
by C99 (6.5.2.3).

Reported-by: Joseph Jezak <josejx@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-11 16:29:05 +01:00
Francesco Cosoleto f4bf2458f6 cfdisk: set '[Quit]' as default menu item on first run instead of '[Bootable]'.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2010-02-11 14:12:08 +01:00
Karel Zak 978ba3889c mount: warn users that mtab is read-only
In repair mode the root filesystem is read-only and mtab file is not
up to date.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=427183
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-11 13:54:06 +01:00
Karel Zak a5445cd2e5 tests: fix and update old fdisk tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-09 16:24:51 +01:00
Karel Zak 5792255b54 tests: add fdisk alignment tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-09 15:47:32 +01:00
Karel Zak a8a86a1c5e fdisk: cleanup warnings
* don't print:

	The number of cylinders for this disk is set to 12161.
	There is nothing wrong with that, but this is larger than 1024,
	and could in certain setups cause problems with:
	1) software that runs at boot time (e.g., old versions of LILO)
	2) booting and partitioning software from other OSs
	   (e.g., DOS FDISK, OS/2 FDISK)

  we really don't care about MS-DOS or extremely old LILO.

* inform users that DOS-compatible mode is bad and deprecated thing
  (It's difficult to use 2048 sectors grain or 4KiB sectors or
   alignment_offset in DOS mode where all is based on cylinders...)

* don't check for cylinders boundary in non-DOS mode

* inform about sector and I/O sizes

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-09 11:18:53 +01:00
Karel Zak 7ded5afc57 fdisk: fix default first sector
The previous release 2.17 introduces aligned defaults for the first
and last sectors on the partition. Unfortunately, there is endless
loop when the code looks for first unused aligned sector.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-09 11:06:42 +01:00
Karel Zak 40c7aaf395 fdisk: cleanup alignment, default to 1MiB offset
* add heuristic to detect that the device does not provide
  topology information. We can use topology if:

	- alignment_offset is not 0
	- or optimal_io_size is not 0
	- or minimal_io_size is not power of 2

* default to 1MiB offset for the start of the first partition
  if topology is unknown. This (2048 512-byte sectors)
  is Windows Vista default.

* use optimal_io_size, minimal_io_size or 1MiB as a grain for
  partitions alignment

Note that this all is used when DOS-compatible mode is disabled.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-09 10:55:56 +01:00
Karel Zak 1d07e336ca fdisk: fix check_alignment()
The old version of check_alignment() does not work with extended
partitions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-09 10:32:29 +01:00
Karel Zak 2b9e638a0f fdisk: don't check alignment_offset against geometry
The alignment_offset is compensation for DOS compatible partitioning.

It usually matches with disk geometry (e.g. 63 sectors), but the
offset is also exported from phy.disks to RAIDs there the geometry
don't match with the offset. So.. don't print unnecessary warning.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-09 10:27:34 +01:00
Karel Zak 88923b0889 libblkid: don't return error on empty files
Currently, the library does not allow to initialize blkid_probe if the
file (or block device) is empty. The empty file is reported as an
error. That's wrong. The empty file should be interpreted as a file
without any FS or PT. It means that

	blkid_do_{probe,safeprobe,fullprobe}()

have to return 1 ("nothing").

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-04 22:19:38 +01:00
Karel Zak 435c73ec71 docs: update TODO file
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-04 21:47:47 +01:00
Karel Zak 269c1a2a64 wipefs: ignore devices with partition table
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-04 21:18:34 +01:00
Karel Zak cdfb1e8822 chrt: add --reset-on-fork
This new option allows to set SCHED_RESET_ON_FORK flag for FIFO and RR
policies.

Example:

	$ chrt --fifo --reset-on-fork 1 /bin/bash

	$ schedutils/chrt --pid $$
	pid 31579's current scheduling policy: SCHED_FIFO|SCHED_RESET_ON_FORK
	pid 31579's current scheduling priority: 1

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-02 21:28:45 +01:00
Adrian Knoth 0fefbedc72 chrt: add support for SCHED_RESET_ON_FORK
From 9262c9832134f8a33ac2ea2854dc6d20acc712d1 Mon Sep 17 00:00:00 2001
From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Date: Tue, 2 Feb 2010 16:57:23 +0100
Subject: [PATCH] Add support for SCHED_RESET_ON_FORK to chrt

SCHED_RESET_ON_FORK has been added in 2.6.31. If a thread has this flag
set, chrt reports "unknown" policy, which is confusing.

The patch adds support for this new flag. It will (can) only be applied
to SCHED_FIFO or SCHED_RR, so there's no need to catch the other
scheduling policies.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
2010-02-02 18:16:05 +01:00
Karel Zak a39ff47a18 libblkid: minor fixes in befs.c
The library does not reset the probing result (e.g. LABEL, VERSION)
when the probing function failed (return value != 0). We have to be
absolutely sure that the FS has been properly detected before we set
LABEL or VERSION or so.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-02 16:01:28 +01:00
Karel Zak 2a986d6a53 tests: add BeFS test image
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-02 15:49:35 +01:00
Jeroen Oortwijn b39ee04ed8 libblkid: Add probing function for BeFS
Add probing function for the Be File System to libblkid. It sets LABEL,
VERSION and UUID. But UUID is only set if the be:volume_id attribute is
found in the small_data area of the i-node of the root directory.

[kzak@redhat.com: - add .minsz = 1024*1440 to avoid BeFS probing on
                    very small devices]

Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-02 15:46:02 +01:00
Jeroen Oortwijn 5f9fb168f3 libblkid: Add initial support for BeFS detection
Add initial support for detection of the Be File System
<http://en.wikipedia.org/wiki/Be_File_System> to libblkid.

Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
2010-02-02 14:53:04 +01:00