OSDN Git Service

android-x86/external-parted.git
14 years agoui: make --help tell where to report bugs
Jim Meyering [Wed, 28 Apr 2010 20:26:41 +0000 (22:26 +0200)]
ui: make --help tell where to report bugs

* parted/ui.c (help_msg): Tell where to report bugs.

14 years agotests: use gnulib's init.sh
Jim Meyering [Wed, 28 Apr 2010 20:18:51 +0000 (22:18 +0200)]
tests: use gnulib's init.sh

* tests/init.sh: New file, from gnulib.

14 years agotests: rename generated init.sh to old-init.sh
Jim Meyering [Wed, 28 Apr 2010 17:42:44 +0000 (19:42 +0200)]
tests: rename generated init.sh to old-init.sh

* tests/Makefile.am (old-init.sh): Rename from init.sh.
* libparted/tests/Makefile.am: Likewise.
* tests/test-lib.sh: Rename sole use.
* .gitignore: Rename here, too.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Wed, 28 Apr 2010 16:35:27 +0000 (18:35 +0200)]
build: update gnulib submodule to latest

14 years agotests: improved portability
Jim Meyering [Wed, 28 Apr 2010 17:20:21 +0000 (19:20 +0200)]
tests: improved portability

* tests/test-lib.sh: Don't use test's -a option.

14 years agomaint: remove empty lines at end of file
Jim Meyering [Wed, 28 Apr 2010 17:16:49 +0000 (19:16 +0200)]
maint: remove empty lines at end of file

This lets one more "syntax-check" test pass.
Run this command:
  git ls-files|grep -v gnulib|xargs perl -pi -0777 -e 's/\n\n+$/\n/'

14 years agomaint: pass newer "make syntax-check" tests from gnulib
Jim Meyering [Wed, 28 Apr 2010 17:14:17 +0000 (19:14 +0200)]
maint: pass newer "make syntax-check" tests from gnulib

* cfg.mk (local-checks-to-skip): Add these, to pass "make syntax-check"
sc_error_message_uppercase, sc_error_message_period.
* libparted/fs/ext2/ext2.h: Remove "#if HAVE_INTTYPES_H" guard.

14 years agotests: test all boolean flags
Jim Meyering [Wed, 21 Apr 2010 12:00:26 +0000 (14:00 +0200)]
tests: test all boolean flags

* tests/t3310-flags.sh: New test, suggested by Hans De Goede.
* tests/Makefile.am (TESTS): Add it.

14 years agodoc: use a valid http:.../AUTHORS URL
Jim Meyering [Tue, 27 Apr 2010 10:19:45 +0000 (12:19 +0200)]
doc: use a valid http:.../AUTHORS URL

* debug/clearfat/clearfat.c (AUTHORS): Point to the git repo.
* parted/parted.c (AUTHORS): Likewise.
* partprobe/partprobe.c (AUTHORS): Likewise.

* parted/parted.c: Include "version.h".
(_version): Use Version, not VERSION.

14 years agoui: get version number from a separately-compiled file
Jim Meyering [Mon, 26 Apr 2010 16:44:40 +0000 (18:44 +0200)]
ui: get version number from a separately-compiled file

* parted/Makefile.am (version.c, version.h): Generate.
(parted_LDADD): Add libver.a.
(noinst_LIBRARIES, nodist_libver_a_SOURCES): Define.
(BUILT_SOURCES): Initialize and append.
(MAINTAINERCLEANFILES): Update.
* parted/parted.c: Include "version.h".
(_version): Use the new global variable, Version, not VERSION.

14 years agolibparted: _disk_sync_part_table: allow interactive ignore
Jim Meyering [Fri, 23 Apr 2010 18:11:23 +0000 (20:11 +0200)]
libparted: _disk_sync_part_table: allow interactive ignore

* libparted/arch/linux.c (_disk_sync_part_table): Change diagnostic
so that it makes it clear what failed.  Let an interactive "ignore"
cause the function to succeed.

14 years agotests: remove partition explicitly before mklabel, to avoid new failure
Jim Meyering [Sun, 18 Apr 2010 09:15:45 +0000 (11:15 +0200)]
tests: remove partition explicitly before mklabel, to avoid new failure

* tests/t3000-resize-fs.sh: Before, mklabel was sufficient to clear
the partition table in preparation for the next iteration in this test.
However, with recent BLKRRPART/BLKPG changes that "mklabel" would evoke
a warning.  Remove the sole partition to avoid that.

14 years agolibparted: linux_disk_commit: don't ignore _disk_sync_part_table failure
Jim Meyering [Mon, 12 Apr 2010 10:08:16 +0000 (12:08 +0200)]
libparted: linux_disk_commit: don't ignore _disk_sync_part_table failure

* libparted/arch/linux.c (linux_disk_commit):
When calling _disk_sync_part_table, always return its result.

14 years agolibparted: _disk_sync_part_table: always return 0 upon failure
Jim Meyering [Mon, 12 Apr 2010 10:06:30 +0000 (12:06 +0200)]
libparted: _disk_sync_part_table: always return 0 upon failure

* libparted/arch/linux.c (_disk_sync_part_table):
Return 0 (not 1) upon failure.

14 years agodos: always allow at least two sectors for extended boot record
Colin Watson [Mon, 29 Mar 2010 13:40:54 +0000 (14:40 +0100)]
dos: always allow at least two sectors for extended boot record

Unless specifically told otherwise, the Linux kernel considers extended
boot records to be two sectors long, in order to "leave room for LILO".
When using anything other than cylinder alignment, libparted was only
allowing one sector in the minimum extended partition geometry, which in
some situations (e.g. following Phillip Susi's patch to reintroduce
BLKPG) could confuse the kernel into thinking that the EBR and the first
logical partition overlapped.

* libparted/labels/dos.c (_get_min_extended_part_geom): Allow at least
two sectors for the extended boot record.

14 years agotests: test for new 2-sector minimum ext-logical-separation
Jim Meyering [Tue, 30 Mar 2010 09:57:35 +0000 (11:57 +0200)]
tests: test for new 2-sector minimum ext-logical-separation

* tests/t2310-dos-extended-2-sector-min-offset.sh: New file.
* tests/Makefile.am (TESTS): Add it.

14 years agodos: accommodate very small devices (useful for testing)
Jim Meyering [Tue, 30 Mar 2010 14:50:59 +0000 (16:50 +0200)]
dos: accommodate very small devices (useful for testing)

* libparted/labels/dos.c (_primary_constraint): Don't pass a negative
"device_length" to ped_geometry_init when the underlying device
has fewer sectors than a "cylinder".

14 years agolibparted: allocate storage for diagnostic only when needed
Jim Meyering [Mon, 12 Apr 2010 08:13:18 +0000 (10:13 +0200)]
libparted: allocate storage for diagnostic only when needed

* libparted/arch/linux.c (_disk_sync_part_table): Rename local:
s/parts/bad_part_list/
Allocate space for it only if needed.
Use malloc rather than ped_malloc.
Move decl of FD down to first use.

14 years agolibparted: adjust code formatting
Jim Meyering [Mon, 12 Apr 2010 07:55:38 +0000 (09:55 +0200)]
libparted: adjust code formatting

14 years agolibparted: reword a diagnostic
Jim Meyering [Thu, 15 Apr 2010 11:45:44 +0000 (13:45 +0200)]
libparted: reword a diagnostic

14 years agolibparted: improve BLKPG error checking
Phillip Susi [Fri, 9 Apr 2010 19:22:20 +0000 (15:22 -0400)]
libparted: improve BLKPG error checking

This patch cleans up the BLKPG code that the previous patch put back
to perform proper error checking and in the event that some partitions
are in use, they can not be modified in the running kernel using BLKPG.
Warn the user that this is the case and advise them to reboot, just like
we do when BLKRRPART fails for the same reason, unless the partition in
question is unchanged.

14 years agolibparted: reenable use of BLKPG ioctls
Phillip Susi [Tue, 30 Mar 2010 19:04:43 +0000 (15:04 -0400)]
libparted: reenable use of BLKPG ioctls

This patch effectively reverses commit 1d8f9bec which removed the code
using the new BLKPG ioctls instead of the old BLKRRPART ioctl to update
the in-kernel partition table.  The reason for this is because BLKRRPART
fails if any partition on the disk is in use, but the BLKPG ioctls allow
you to manipulate the other partitions on the disk without requiring a
reboot.  Also BLKRRPART requires that the kernel understand the
partition table on the disk, which may not always be the case.

14 years agolinux: detect dm_task_run failure
Hans de Goede [Fri, 23 Apr 2010 11:08:43 +0000 (13:08 +0200)]
linux: detect dm_task_run failure

We were checking for a return value of < 0 for dm_task_run errors, but
dm_task_run returns 0 on error (and 1 on success). Thanks to Joe Jin
for spotting this, see Red Hat bug 582907.

* libparted/arch/linux.c(_dm_remove_map_name, _dm_is_part,
_dm_remove_parts, _dm_add_partition): dm_task_run returns 0 on error.

14 years agotests: test for palo and prep interaction
Jim Meyering [Tue, 20 Apr 2010 16:30:20 +0000 (18:30 +0200)]
tests: test for palo and prep interaction

* tests/t3300-palo-prep.sh: New file.
* tests/Makefile.am (TESTS): Add it.

14 years agodos: fix prep / palo flag handling
Hans de Goede [Mon, 19 Apr 2010 11:55:33 +0000 (13:55 +0200)]
dos: fix prep / palo flag handling

Setting the prep flag was not clearing the palo flag and vice versa
* libparted/labels/dos.c (msdos_partition_set_flag): Fix prep / palo
flag handling.

14 years agotests: remove unnecessary (duplicate) local var assignment
Jim Meyering [Tue, 20 Apr 2010 16:21:40 +0000 (18:21 +0200)]
tests: remove unnecessary (duplicate) local var assignment

* tests/t9021-maxima.sh: Remove duplicate ss=$sector_size_.

14 years agomaint: make PED_ASSERT and PED_DEBUG if-safe
Colin Watson [Tue, 20 Apr 2010 12:01:33 +0000 (13:01 +0100)]
maint: make PED_ASSERT and PED_DEBUG if-safe

Constructions such as:

  if (foo)
    PED_DEBUG (0, "foo");
  else
    PED_DEBUG (0, "not foo");

did not compile reliably, depending on the configuration.  Make this
work.

* include/parted/debug.h [DEBUG && __GNUC__ && !__JSFTRACE__]
(PED_DEBUG): Remove trailing semicolon.
[!DEBUG] (PED_ASSERT): Use do-while rather than while.
[!DEBUG] (PED_DEBUG): Likewise.

14 years agodoc: add HACKING
Jim Meyering [Sat, 17 Apr 2010 15:39:26 +0000 (17:39 +0200)]
doc: add HACKING

* HACKING: New file.  Copied from coreutils, with s/coreutils/parted/
and a few minor edits.

14 years ago.gitignore: ignore index files generated by ctags and cscope
Petr Uzel [Fri, 16 Apr 2010 08:01:08 +0000 (10:01 +0200)]
.gitignore: ignore index files generated by ctags and cscope

14 years agolibparted: add support for Linux software RAID arrays (mdraid)
Petr Uzel [Fri, 16 Apr 2010 08:01:29 +0000 (10:01 +0200)]
libparted: add support for Linux software RAID arrays (mdraid)

Recognize MD devices, so "parted -s /dev/md0 print" now prints
"Model: Linux Software RAID Array (md)" instead of
"Model: Unknown (unknown)".

* include/parted/device.h (PedDeviceType): Add PED_DEVICE_MD.
* libparted/arch/linux.c (MD_MAJOR): New define.
* libparted/arch/linux.c (_device_probe_type): Recognize MD array.
* libparted/arch/linux.c (linux_new): Handle MD array.
* parted/parted.c(do_print): Add "md" to the list of available
transports.
* NEWS (New features): Mention it.

14 years agotests: propagate recent improvements to copied-from code
Jim Meyering [Tue, 13 Apr 2010 19:17:50 +0000 (21:17 +0200)]
tests: propagate recent improvements to copied-from code

* tests/t1700-ext-probe.sh: Fix typo s/2>1/2>&1/ and use
a tighter regexp also in the preceding loop.
Noted by Colin Watson.

14 years agomaint: constify ped_device_get_constraint interface
Colin Watson [Mon, 12 Apr 2010 09:16:21 +0000 (10:16 +0100)]
maint: constify ped_device_get_constraint interface

* include/parted/device.h (ped_device_get_constraint): Constify "dev"
parameter.
* libparted/device.c (ped_device_get_constraint): Likewise.

14 years agolibparted: uninit_bg and flex_bg features should indicate ext4
Colin Watson [Mon, 12 Apr 2010 23:11:13 +0000 (00:11 +0100)]
libparted: uninit_bg and flex_bg features should indicate ext4

According to tune2fs(8), the uninit_bg and flex_bg features are only
supported by ext4, so libparted should treat their presence as
indicating ext4.  Reported by C de-Avillez in
https://bugs.launchpad.net/ubuntu/+source/parted/+bug/561599.

* libparted/fs/ext2/ext2_fs.h: Define EXT4_FEATURE_RO_COMPAT_GDT_CSUM
and EXT4_FEATURE_INCOMPAT_FLEX_BG.
* libparted/fs/ext2/interface.c (_ext2_generic_probe): Test for
EXT4_FEATURE_RO_COMPAT_GDT_CSUM and EXT4_FEATURE_INCOMPAT_FLEX_BG when
probing for ext4.
* tests/t1700-ext-probe.sh: Test for this.
* NEWS (Bug fixes): Mention this.

14 years agolibparted: fix diagnostics about exceeding partition limits
Colin Watson [Fri, 9 Apr 2010 12:22:27 +0000 (13:22 +0100)]
libparted: fix diagnostics about exceeding partition limits

* libparted/labels/pt-tools.c (ptt_partition_max_start_len): Use the
correct value in the diagnostics that print the upper bound on
partition size and largest starting sector number.  Before, each
would use UINT32_MAX.  Now each prints the partition-table-specific
limit.

14 years agolibparted: add test for /dev/mapper symlink issue
Hans de Goede [Tue, 6 Apr 2010 13:57:17 +0000 (15:57 +0200)]
libparted: add test for /dev/mapper symlink issue

Sometimes, libparted operates on device mapper files with a path of
/dev/mapper/foo.  With newer lvm versions /dev/mapper/foo is a symlink
to /dev/dm-#. However some storage administration programs (anaconda,
for example) may do the following:
1) Create a ped_device for /dev/mapper/foo
2) ped_get_device resolves the symlink to /dev/dm-#, and the path
   in the PedDevice struct points to /dev/dm-#
3) The program does some things to lvm, causing the symlink to
   point to a different /dev/dm-# node
4) The program does something with the PedDevice, which results
   in an operation on the wrong device

Newer libparted versions do not suffer from this problem, as they
do not canonicalize device names under /dev/mapper. This test checks
for this bug.

* libparted/tests/symlink.c: New test which tests for this issue.
* libparted/tests/t3000-symlink.sh: New file.
* libparted/tests/Makefile.am: Include the new files.  Run the new test.

14 years agolibparted: don't canonicalize /dev/mapper paths
Hans de Goede [Tue, 6 Apr 2010 13:57:18 +0000 (15:57 +0200)]
libparted: don't canonicalize /dev/mapper paths

Besides fixing the issue displayed by libparted/tests/symlink.c,
this has the added advantage that the output of parted p on one of these
devices now says:
"Disk /dev/mapper/BigVol2-lv_iscsi_disk2: 34.4GB"

Which is a lot more user friendly then the output before this patch:
"Disk /dev/dm-6: 34.4GB"

* libparted/device.c (ped_device_get): Don't canonicalize names
that start with "/dev/mapper/".
* NEWS (Bug fixes): Mention it.
Thanks to Ales Kozumplik for the analysis.
Details in <http://bugzilla.redhat.com/577824>.

14 years agodoc: add @dircategory to Info documentation
Colin Watson [Tue, 30 Mar 2010 09:55:42 +0000 (10:55 +0100)]
doc: add @dircategory to Info documentation

The Texinfo documentation says that Info files should use @dircategory,
and suggests consulting the Free Software Directory to select a category
name.  The directory places Parted under "System administration".

* doc/parted.texi: Add `@dircategory System administration'.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Tue, 30 Mar 2010 10:13:11 +0000 (12:13 +0200)]
build: update gnulib submodule to latest

14 years agotests: disable new texinfo-acronym syntax-check from gnulib
Jim Meyering [Tue, 30 Mar 2010 10:23:16 +0000 (12:23 +0200)]
tests: disable new texinfo-acronym syntax-check from gnulib

* cfg.mk (local-checks-to-skip): Add new sc_texinfo_acronym, to skip it.

14 years agomaint: avoid using test's -o and -a operators: they are not portable
Jim Meyering [Tue, 30 Mar 2010 10:22:10 +0000 (12:22 +0200)]
maint: avoid using test's -o and -a operators: they are not portable

* tests/lvm-utils.sh: Don't use test ... -o.
* configure.ac: Don't use test ... -a.

14 years agomaint: remove unneeded #include
Jim Meyering [Tue, 30 Mar 2010 10:19:06 +0000 (12:19 +0200)]
maint: remove unneeded #include

* libparted/disk.c: Don't include "intprops.h".  It was unused.

14 years agobuild: prepare for gnulib's updated lib-ignore
Jim Meyering [Tue, 30 Mar 2010 10:18:35 +0000 (12:18 +0200)]
build: prepare for gnulib's updated lib-ignore

* parted/Makefile.am (parted_LDFLAGS): Now that we're using
gnulib's newer lib-ignore, add $(IGNORE_UNUSED_LIBRARIES_CFLAGS).

14 years agotests: distribute a few more tests and documentation files
Colin Watson [Tue, 30 Mar 2010 09:59:26 +0000 (11:59 +0200)]
tests: distribute a few more tests and documentation files

* debug/test/Makefile.am (noinst_SCRIPTS): Add test_fs_hfs and
test_fs_hfsplus.
* libparted/fs/hfs/Makefile.am (EXTRA_DIST): Add DOC and HISTORY.
* tests/Makefile.am (TESTS): Add t3200-type-change.sh.

14 years agobuild: avoid warning from bootstrap about obsolete strdup module
Jim Meyering [Tue, 16 Mar 2010 11:38:42 +0000 (12:38 +0100)]
build: avoid warning from bootstrap about obsolete strdup module

* bootstrap.conf (gnulib_modules): Use the strdup-posix module,
rather than the "strdup" one.

14 years agotests: reenable a "bsd" partition table test
Jim Meyering [Thu, 11 Mar 2010 18:48:08 +0000 (19:48 +0100)]
tests: reenable a "bsd" partition table test

* libparted/tests/common.c (_implemented_disk_label): Remove "bsd" from
the list of not-implemented-yet partition table types, since it appears
to pass the tests.

14 years agolibparted: remove "HIGHLY EXPERIMENTAL" warning for >512B-sector devices
Jim Meyering [Thu, 11 Mar 2010 18:01:41 +0000 (19:01 +0100)]
libparted: remove "HIGHLY EXPERIMENTAL" warning for >512B-sector devices

* libparted/arch/linux.c (_device_set_sector_size): Remove the
"HIGHLY EXPERIMENTAL" warning, now that support for >512-byte sectors
seems to be usable.  Suggested by Colin Watson.
* NEWS (Changes in behavior): Note this

14 years agolibparted: msdos_partition_is_flag_available: fix hidden on extended
David Cantrell [Tue, 2 Mar 2010 08:58:18 +0000 (09:58 +0100)]
libparted: msdos_partition_is_flag_available: fix hidden on extended

Since the hidden flag cannot be set on extended partitions,
msdos_partition_is_flag_available() should return 0 for hidden on
extended partitions. Also change msdos_partition_get_flag()
to always return 0 for hidden on extended partitions.
* libparted/labels/dos.c (msdos_partition_is_flag_available):
Return 0 for hidden on extended partitions.
* libparted/labels/dos.c (msdos_partition_get_flag):
Always return 0 for hidden on extended partitions.
* NEWS (Bug fixes): Mention it.
Reported by Flóki Pálsson in http://bugzilla.redhat.com/567118
Patch forwarded by Hans De Goede.

14 years agotests: skip tests that require mkfs.hfs, when it is unavailable
Petr Uzel [Mon, 1 Mar 2010 16:04:51 +0000 (17:04 +0100)]
tests: skip tests that require mkfs.hfs, when it is unavailable

t3000-resize-fs.sh would fails if mkfs.hfs is not installed.
* tests/t-lib.sh (require_hfs_): New function.
* tests/t3000-resize-fs.sh: Use require_hfs_.

14 years agotests: convert more tests to the newer infrastructure
Jim Meyering [Fri, 26 Feb 2010 18:28:36 +0000 (19:28 +0100)]
tests: convert more tests to the newer infrastructure

* tests/t1700-ext-probe.sh: Convert from test-lib.sh to t-lib.sh.
* tests/t2200-dos-label-recog.sh: Likewise.
* tests/t2300-dos-label-extended-bootcode.sh: Likewise.

14 years agolibparted: don't export linux_get_*_alignment functions
Colin Watson [Fri, 26 Feb 2010 17:37:53 +0000 (17:37 +0000)]
libparted: don't export linux_get_*_alignment functions

These functions are only used in libparted/arch/linux.c or via
linux_dev_ops, so do not export them.

* libparted/arch/linux.c (linux_get_minimum_alignment): Declare static.
(linux_get_optimum_alignment): Likewise.

14 years agoAdd support for ATA over Ethernet (AoE) devices
Petr Uzel [Fri, 26 Feb 2010 16:59:24 +0000 (17:59 +0100)]
Add support for ATA over Ethernet (AoE) devices

Recognize AoE Devices, so "parted -s /dev/etherd/eX.Y" now
prints "Model: ATA over Ethernet Device (aoe)" instead of
"Model: Unknown (unknown)".

* include/parted/device.h(PedDeviceType): Add PED_DEVICE_AOE.
* libparted/arch/linux.c(AOE_MAJOR): New define.
* libparted/arch/linux.c(_device_probe_type): Recognize AoE devices.
* libparted/arch/linux.c(linux_new): Handle AoE devices.
* parted/parted.c(do_print): Add "aoe" to the list of available
transports.
* NEWS (New features): Mention it.

14 years agopost-release administrivia
Jim Meyering [Fri, 26 Feb 2010 14:29:58 +0000 (15:29 +0100)]
post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

14 years agoversion 2.2
Jim Meyering [Fri, 26 Feb 2010 14:25:29 +0000 (15:25 +0100)]
version 2.2

* NEWS: Record release date.

14 years agodos: set HFS/HFS+ partition identifier to proper value
Curtis Gedak [Fri, 26 Feb 2010 14:07:29 +0000 (15:07 +0100)]
dos: set HFS/HFS+ partition identifier to proper value

The correct value for an "hfs" partition identifier is 0xAF.
Previously the partition identifier was incorrectly set to 0x83.
* libparted/labels/dos.c (PARTITION_HFS): Define.
(msdos_partition_set_system): Use it.

14 years agotests: exercise today's HFS partition type fix
Jim Meyering [Fri, 26 Feb 2010 13:53:33 +0000 (14:53 +0100)]
tests: exercise today's HFS partition type fix

* tests/t2400-dos-hfs-partition-type.sh: New script.
* tests/Makefile.am: Add it.
* NEWS (Bug fixes): Mention it.

14 years agotests: gpt-pmbr: don't ignore stdout comparison result
Jim Meyering [Fri, 26 Feb 2010 13:47:52 +0000 (14:47 +0100)]
tests: gpt-pmbr: don't ignore stdout comparison result

* tests/t0202-gpt-pmbr.sh: Fail if we get unexpected output.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Thu, 25 Feb 2010 17:32:58 +0000 (18:32 +0100)]
build: update gnulib submodule to latest

* bootstrap: Copy from gnulib.

14 years agotests: convert t4001 to use the new framework
Jim Meyering [Thu, 25 Feb 2010 17:19:10 +0000 (18:19 +0100)]
tests: convert t4001 to use the new framework

* tests/t4001-sun-vtoc.sh: Convert.
* tests/Makefile.am (TESTS): Add it to the list.

14 years agosun: initialize basic partition table fields
Karel Zak [Fri, 19 Feb 2010 15:12:52 +0000 (16:12 +0100)]
sun: initialize basic partition table fields

libparted completely ignores basic fields (version, nparts and sanity)
in the sun VTOC, then for example fdisk prints warnings for such
partition table:

# fdisk -lu /dev/sdb
Detected sun disklabel with wrong version [0x00000000].
Detected sun disklabel with wrong sanity [0x00000000].
Detected sun disklabel with wrong num_partitions [0].

It seems that the current libparted sun support follows old Linux
kernel code, but the code was changed 3 years ago (see kernel commit
3961bae0ac030a70ae2e0578270203889021f1a1).

Note that the number of partitions (nparts) is optional for Linux
kernel, but fdisk(8) strictly requires SUN_DISK_MAXPARTITIONS (=8)
there. This patch sets nparts to SUN_DISK_MAXPARTITIONS rather then
use a real number of partitions.

* NEWS (Bug fixes): Mention it.
* libparted/labels/sun.c: Update from kernel.
* tests/t4001-sun-vtoc.sh: New file.  Test for this.

14 years agotests: wrap the dup-clobber test in a script, ...
Jim Meyering [Thu, 25 Feb 2010 14:05:46 +0000 (15:05 +0100)]
tests: wrap the dup-clobber test in a script, ...

so that its artifacts are created in the usual temporary subdir
* tests/Makefile.am (TESTS): Remove dup-clobber, and instead...
Add t0500-dup-clobber.sh.
* tests/t0500-dup-clobber.sh: New script.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Tue, 23 Feb 2010 17:51:16 +0000 (18:51 +0100)]
build: update gnulib submodule to latest

14 years agotests: test for the ped_disk_duplicate needs_clobber fix
Jim Meyering [Tue, 23 Feb 2010 16:26:48 +0000 (17:26 +0100)]
tests: test for the ped_disk_duplicate needs_clobber fix

* tests/dup-clobber.c: New file.
Exercise the fix in commit jabb411b, "libparted: copy the
needs_clobber value in ped_disk_duplicate()".
* tests/Makefile.am (TESTS, check_PROGRAMS): Add dup-clobber.

14 years agolibparted: copy the needs_clobber value in ped_disk_duplicate()
Hans de Goede [Thu, 18 Feb 2010 14:34:41 +0000 (15:34 +0100)]
libparted: copy the needs_clobber value in ped_disk_duplicate()

Most duplicate disk_ops use ped_disk_new_fresh, which sets needs_clobber
to 1. This would lead to clobbering the disk when committing a duplicate
disk even when the original disk was not made with ped_disk_new_fresh.
* libparted/disk.c (ped_disk_duplicate): Copy the needs_clobber member.
* NEWS (Bug fixes): Describe it.

14 years agolinux: add wait time and retries to kernel partition reread
Curtis Gedak [Mon, 22 Feb 2010 08:13:53 +0000 (09:13 +0100)]
linux: add wait time and retries to kernel partition reread

Occasionally when using parted with newer GNU/Linux kernels (2.6.31)
and udev (145), the kernel would fail to reread the partition table.
This could lead to problems with subsequent actions such as formatting
the partition.

Basically this patch increases the retry_count, and adds one sleep(1)
function call prior to the the last few ioctl() calls.

This patch might not be a perfect solution to this problem of "failure
to inform kernel of partition changes", but it does significantly
reduce the likelihood of encountering the problem.

Details on the testing results and procedures used can be found at
the following link:
https://bugzilla.gnome.org/show_bug.cgi?id=604298#c9

* libparted/arch/linux.c (_kernel_reread_part_table): Sleep for a
full second if retry_count makes it down to "3".  Start it at 9
rather than at 5.
* NEWS (Bug fixes):

14 years agomaint: remove now-unused <partition_table_type>_clobber functions
Jim Meyering [Sat, 20 Feb 2010 11:44:47 +0000 (12:44 +0100)]
maint: remove now-unused <partition_table_type>_clobber functions

All of these functions were rendered unused by commit 376b143045,
"ped_disk_clobber: change semantics" on 2009-11-13.
Also, Update each <...>_disk_ops "clobber:" member to be NULL.
* libparted/labels/aix.c (aix_clobber): Remove function.
* libparted/labels/bsd.c (bsd_clobber): Likewise.
* libparted/labels/dasd.c (dasd_clobber): Likewise.
* libparted/labels/dos.c (msdos_clobber): Likewise.
* libparted/labels/dvh.c (dvh_clobber): Likewise.
* libparted/labels/gpt.c (gpt_clobber): Likewise.
* libparted/labels/loop.c (loop_clobber): Likewise.
* libparted/labels/mac.c (_clobber_part_map, mac_clobber): Likewise.
* libparted/labels/pc98.c (pc98_clobber): Likewise.
* libparted/labels/rdb.c (amiga_clobber): Likewise.
* libparted/labels/sun.c (sun_clobber): Likewise.
Suggested by Hans De Goede.

14 years agodoc: update release procedure to account for soname version number
Jim Meyering [Sat, 13 Feb 2010 09:04:44 +0000 (10:04 +0100)]
doc: update release procedure to account for soname version number

* README-release: Add a step "0", and update step 3 to match reality.

14 years agolibparted: set the shared library version number manually
Jim Meyering [Sat, 13 Feb 2010 08:25:56 +0000 (09:25 +0100)]
libparted: set the shared library version number manually

* libparted/Makefile.am (CURRENT, REVISION, AGE): Define here.
(libparted_la_LDFLAGS): Use them, rather than using the
automatically-defined LT_-prefixed variables.
Stop using the "-release" option.
Hans De Goede pointed out that the build process was automatically
changing the shared library name.

14 years agogpt: clean-up wrt write_back (no semantic change)
Jim Meyering [Fri, 12 Feb 2010 13:59:04 +0000 (14:59 +0100)]
gpt: clean-up wrt write_back (no semantic change)

* libparted/labels/gpt.c (gpt_read): Initialize write_back to 0
once again, and set it to 1 on the sole path that requires that.

14 years agogpt: "read-only" operation could clobber the pMBR in another way
Jim Meyering [Wed, 10 Feb 2010 16:11:25 +0000 (17:11 +0100)]
gpt: "read-only" operation could clobber the pMBR in another way

A read-only operation like "parted $dev print" would overwrite $dev's
pMBR when exactly one of the primary and backup tables was corrupt.
* libparted/labels/gpt.c (gpt_read): Clear "write_back" in those
two cases.  Hans De Goede spotted this bug by inspection.
* NEWS (Bug fixes): Mention it.
* tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh: New test.
* tests/Makefile.am (TESTS): Add
t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh.

14 years agotests: factor utility functions into "library"
Jim Meyering [Wed, 10 Feb 2010 16:09:49 +0000 (17:09 +0100)]
tests: factor utility functions into "library"

...since we're about to use them from a second test.
* tests/t-local.sh (peek_, poke_, gpt1_pte_name_offset_): New functions.
(gpt_corrupt_primary_table_, gpt_restore_primary_table_): New functions.
* tests/t0280-gpt-corrupt.sh: Remove local copies of those functions.
Use the new ones.

14 years agodasd: don't dereference a NULL pointer in dasd_read
Hans de Goede [Wed, 10 Feb 2010 13:13:01 +0000 (14:13 +0100)]
dasd: don't dereference a NULL pointer in dasd_read

* libparted/labels/dasd.c (dasd_read): Avoid NULL pointer dereference.

14 years agoparted: change default alignment to "optimal"
Hans de Goede [Wed, 10 Feb 2010 14:19:18 +0000 (15:19 +0100)]
parted: change default alignment to "optimal"

* NEWS (Changes in behavior): Mention it.
* parted/parted.c: Change --align default value to optimal.
* tests/t2100-mkswap.sh: Adjust for alignment changes where necessary.
* tests/t0220-gpt-msftres.sh: Likewise.
* tests/t0280-gpt-corrupt.sh: Likewise.
* tests/t2200-dos-label-recog.sh: Likewise.
* tests/t2300-dos-label-extended-bootcode.sh: Likewise.
* tests/t3000-resize-fs.sh: Likewise.
* tests/t4100-msdos-partition-limits.sh: Likewise.
* tests/t4100-msdos-starting-sector.sh: Likewise.
* tests/t5000-tags.sh: Likewise.
* tests/t8000-loop.sh: Likewise.
* tests/t9021-maxima.sh: Likewise.

14 years agoparted: change warnings when initial constrained mkpart fails
Hans de Goede [Wed, 10 Feb 2010 13:12:59 +0000 (14:12 +0100)]
parted: change warnings when initial constrained mkpart fails

In do_mkpart we first try to create a partition using a constraint
derived from the user input intersected with the devices alignment
needs. And if that fails we try again without any constraint.

However the warning given when this happens only takes into account
the user not getting what he asked for, while the alignment might be
a problem too (or even the only problem). So this patch adds a check
to see if the user really did not get what he asked before giving that
warning, and adds a new check + warning to see if the created partition
is properly aligned.
*parted/parted.c (do_mkpart,do_mkpartfs): change warnings when initial
constrained mkpart fails.

14 years agoparted: honor --align option also in mkpartfs, resize and print cmds
Hans de Goede [Sat, 30 Jan 2010 16:53:50 +0000 (17:53 +0100)]
parted: honor --align option also in mkpartfs, resize and print cmds

* parted/parted.c (do_mkpartfs,do_print,do_resize): Honor --align.

14 years agolinux: handle incomplete topology information
Hans de Goede [Sat, 30 Jan 2010 16:53:49 +0000 (17:53 +0100)]
linux: handle incomplete topology information

The topology information returned by libblkid is not always complete
(as the kernel does not always have complete information).
This patch makes the linux_get_*_alignment() alignment functions handle
this. The algorithm used for linux_get_optimum_alignment is:
1) Always use the reported aligment offset as offset
2a)If optimal io size is present in the topology info use that as grain
2b)If optimal io size is not present in topology info and aligment
   offset is 0 and minimum io size is a power of 2, use the device.c
   default optimal alignment (grain 1MiB).
2c) If neither 2a and 2b, use the minimum io size, or if that is not
   defined, use the physical sector size as grain (iow the minimum
   alignment).
The algorithm used for linux_get_minimum_alignment is:
1) Always use the reported aligment offset as offset
2) Use the minimum io size, or if that is not defined the physical
   sector size as grain.
* libparted/arch/linux.c (linux_get_*_alignment): Handle incomplete
topology information.

14 years agolibparted: Give device_get_*_alignment sane defaults
Hans de Goede [Sat, 30 Jan 2010 16:53:48 +0000 (17:53 +0100)]
libparted: Give device_get_*_alignment sane defaults

When the topology info is incomplete or non existent, return something
more sensible than NULL (which ends up being interpreted as
PedAlignmentAny in most cases). The default minimum alignment aligns to
physical sector size, the default optimal alignment is 1 MiB, which is
what vista and windows 7 do.
* libparted/device.c (device_get_*_alignment): Add default aligments.
* NEWS (New features): Mention it.

14 years agolinux: correct phys_sector_size setting
Hans de Goede [Sat, 30 Jan 2010 16:53:47 +0000 (17:53 +0100)]
linux: correct phys_sector_size setting

1) Use the logical sector size as physical sector size instead of 512
   when not compiled with libblkid support, this fixes problems
   with logical sector size > physical sector size.
2) blkid_topology_get_physical_sector_size() returns 0 when it fails
   to determine the physical sector size, handle this.
* libparted/arch/linux.c (_device_set_sector_size): Correct
phys_sector_size setting.
* NEWS (Bug fixes): Mention it.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Sun, 7 Feb 2010 19:22:53 +0000 (20:22 +0100)]
build: update gnulib submodule to latest

14 years agodoc: NEWS: mention the install-related bug fix
Jim Meyering [Tue, 9 Feb 2010 11:32:36 +0000 (12:32 +0100)]
doc: NEWS: mention the install-related bug fix

* NEWS (Bug fixes): Mention the fix.

14 years agogpt: read-only operation could clobber MBR part of hybrid GPT+MBR table
Jim Meyering [Sun, 7 Feb 2010 19:31:11 +0000 (20:31 +0100)]
gpt: read-only operation could clobber MBR part of hybrid GPT+MBR table

* libparted/labels/gpt.c (gpt_read): Fix a bug introduced by me in
commit 7f753b1b, "gpt: rewrite GPT header-reading code".
Set write_back=0 in one more code path.
* tests/Makefile.am (TESTS): Add t0205-gpt-list-clobbers-pmbr.sh.
* tests/t0205-gpt-list-clobbers-pmbr.sh: New test.
* NEWS (Bug fixes): Mention this.
Reported by aix27249 in
http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/250

14 years agodo not install the test programs disk and label
Peter Breitenlohner [Mon, 8 Feb 2010 13:01:13 +0000 (14:01 +0100)]
do not install the test programs disk and label

Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
14 years agoFix minor spelling errors
Otavio Salvador [Thu, 4 Feb 2010 16:16:33 +0000 (14:16 -0200)]
Fix minor spelling errors

This fixes minor spelling errors in the source code. Basically:

 s/informations/information/g
 s/prefered/preferred/g

14 years agotests: avoid another spurious test failure with newer xfsprogs
Jim Meyering [Thu, 4 Feb 2010 10:04:34 +0000 (11:04 +0100)]
tests: avoid another spurious test failure with newer xfsprogs

* tests/t4100-msdos-partition-limits.sh: Likewise.

14 years agotests: avoid spurious test failure with newer xfsprogs
Jim Meyering [Thu, 4 Feb 2010 09:30:16 +0000 (10:30 +0100)]
tests: avoid spurious test failure with newer xfsprogs

* tests/t4100-dvh-partition-limits.sh: Use mkfs.xfs' -f (force)
option.  It is required at least for xfsprogs-3.1.0.

14 years agobuild: fix check-other-sector_sizes
Hans de Goede [Sat, 30 Jan 2010 16:53:52 +0000 (17:53 +0100)]
build: fix check-other-sector_sizes

"make check-other-sector_sizes" was running tests of 512-byte sectors
four times, rather than simulating larger sector-sizes for the latter
three iterations.
* Makefile.am (ss-1024 ss-2048 ss-4096): Fix the typo (missing "subst").

14 years agotests: adjust t9021-maxima not to fail with 2048-byte sectors
Jim Meyering [Sun, 31 Jan 2010 14:52:02 +0000 (15:52 +0100)]
tests: adjust t9021-maxima not to fail with 2048-byte sectors

* tests/t9021-maxima.sh: At 10,000*512 bytes, the backing file
was too small to support a test simulating a sector size of 2048 bytes.
Use 10,000*$sector_size bytes instead.

14 years agobuild: avoid -Wshadow warnings
Jim Meyering [Sun, 31 Jan 2010 14:43:20 +0000 (15:43 +0100)]
build: avoid -Wshadow warnings

* parted/parted.c (do_print): Avoid two shadowing warnings.

14 years agolinux: remove PED_DEVICE_FILE check from _device_set_sector_size
Hans de Goede [Mon, 11 Jan 2010 10:59:27 +0000 (11:59 +0100)]
linux: remove PED_DEVICE_FILE check from _device_set_sector_size

_device_set_sector_size is never called for devices with a type of
PED_DEVICE_FILE.
* libparted/arch/linux.c (_device_set_sector_size): Remove
PED_DEVICE_FILE check.

14 years agolinux: remove unused blkpg.h header file
Hans de Goede [Mon, 11 Jan 2010 10:59:26 +0000 (11:59 +0100)]
linux: remove unused blkpg.h header file

* libparted/arch/linux.c: Don't include blkpg.h.
* libparted/arch/blkpg.h: Deleted.
* libparted/Makefile.am (libparted_la_SOURCES): Remove arch/blkpg.h.

14 years agolinux: use blkid_topology_get_physical_sector_size
Hans de Goede [Mon, 11 Jan 2010 10:59:25 +0000 (11:59 +0100)]
linux: use blkid_topology_get_physical_sector_size

The official 2.17 release of util-linux-ng, has added a function to
get the physical sector size.  Use that instead of getting the
minimum io size.
* libparted/arch/linux.c (_device_set_sector_size): Use
blkid_topology_get_physical_sector_size.

14 years agomaint: remove unreachable code
Jim Meyering [Mon, 18 Jan 2010 14:19:48 +0000 (15:19 +0100)]
maint: remove unreachable code

* parted/parted.c (do_print): Remove unreachable ped_disk_destroy call.

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Fri, 15 Jan 2010 20:11:22 +0000 (21:11 +0100)]
build: update gnulib submodule to latest

14 years agodos: don't leak a constraint upon partition-add failure
Jim Meyering [Fri, 15 Jan 2010 19:14:38 +0000 (20:14 +0100)]
dos: don't leak a constraint upon partition-add failure

* libparted/labels/dos.c (read_table): Free constraint upon failure.

14 years agogpt: don't leak a constraint upon partition-add failure
Jim Meyering [Fri, 15 Jan 2010 18:53:36 +0000 (19:53 +0100)]
gpt: don't leak a constraint upon partition-add failure

* libparted/labels/gpt.c (gpt_read): Free constraint upon failure.

14 years agogpt: do not leak a GPT header on an error path
Jim Meyering [Fri, 15 Jan 2010 18:34:00 +0000 (19:34 +0100)]
gpt: do not leak a GPT header on an error path

* libparted/labels/gpt.c (gpt_write): Avoid a leak by freeing the
header buffer after pth_get_raw call where it's used, but before
checking whether that pth_get_raw call succeeded.
Avoid another leak in identical just 10 lines down.
Add "FIXME: caution..." comments to warn about the duplication.

14 years agolibparted: remove unreachable code
Jim Meyering [Fri, 15 Jan 2010 18:18:48 +0000 (19:18 +0100)]
libparted: remove unreachable code

* libparted/labels/gpt.c (gpt_write): Remove dead code.
* libparted/labels/bsd.c (bsd_partition_new): Likewise.
* libparted/disk.c (_ped_disk_alloc): Likewise.

14 years agolibparted: avoid double-free on an OOM failure path
Jim Meyering [Fri, 15 Jan 2010 17:56:37 +0000 (18:56 +0100)]
libparted: avoid double-free on an OOM failure path

* libparted/disk.c (ped_disk_check): Don't double-free "fs_size".

14 years agobuild: update gnulib submodule to latest
Jim Meyering [Fri, 8 Jan 2010 10:00:46 +0000 (11:00 +0100)]
build: update gnulib submodule to latest

14 years agomaint: update old_NEWS_hash
Jim Meyering [Fri, 8 Jan 2010 10:16:42 +0000 (11:16 +0100)]
maint: update old_NEWS_hash

* cfg.mk (old_NEWS_hash): Update for GFDL license update.

14 years agomaint: update all GFDL licenses to version 1.3
Jim Meyering [Fri, 8 Jan 2010 09:53:12 +0000 (10:53 +0100)]
maint: update all GFDL licenses to version 1.3

* NEWS: Use 1.3, not 1.2.
* doc/API: Use 1.3, not 1.1.
* doc/FAT: Likewise.
* doc/USER.jp: Likewise.
* doc/fdl.texi: Likewise.
* doc/parted-pt_BR.texi: Likewise.
* doc/parted.texi: Likewise.