2010-02-26  Jim Meyering  <meyering@redhat.com>

	version 2.2
	* NEWS: Record release date.

2010-02-26  Curtis  Gedak  <gedakc@gmail.com>

	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.

2010-02-26  Jim Meyering  <meyering@redhat.com>

	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.

	tests: gpt-pmbr: don't ignore stdout comparison result
	* tests/t0202-gpt-pmbr.sh: Fail if we get unexpected output.

2010-02-25  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest
	* bootstrap: Copy from gnulib.

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

2010-02-25  Karel Zak  <kzak@redhat.com>

	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.

2010-02-25  Jim Meyering  <meyering@redhat.com>

	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.

2010-02-23  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest

	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.

2010-02-22  Hans de Goede  <hdegoede@redhat.com>

	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.

2010-02-22  Curtis Gedak  <gedakc@gmail.com>

	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):

2010-02-20  Jim Meyering  <meyering@redhat.com>

	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.

2010-02-13  Jim Meyering  <meyering@redhat.com>

	doc: update release procedure to account for soname version number
	* README-release: Add a step "0", and update step 3 to match reality.

	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.

2010-02-12  Jim Meyering  <meyering@redhat.com>

	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.

2010-02-10  Jim Meyering  <meyering@redhat.com>

	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.

	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.

2010-02-10  Hans de Goede  <hdegoede@redhat.com>

	dasd: don't dereference a NULL pointer in dasd_read
	* libparted/labels/dasd.c (dasd_read): Avoid NULL pointer dereference.

	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.

	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.

	parted: honor --align option also in mkpartfs, resize and print cmds
	* parted/parted.c (do_mkpartfs,do_print,do_resize): Honor --align.

	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.

	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.

	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.

2010-02-09  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest

	doc: NEWS: mention the install-related bug fix
	* NEWS (Bug fixes): Mention the fix.

	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

2010-02-08  Peter Breitenlohner  <peb@mppmu.mpg.de>

	do not install the test programs disk and label

2010-02-04  Otavio Salvador  <otavio@ossystems.com.br>

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

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

2010-02-04  Jim Meyering  <meyering@redhat.com>

	tests: avoid another spurious test failure with newer xfsprogs
	* tests/t4100-msdos-partition-limits.sh: Likewise.

	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.

2010-01-31  Hans de Goede  <hdegoede@redhat.com>

	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").

2010-01-31  Jim Meyering  <meyering@redhat.com>

	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.

	build: avoid -Wshadow warnings
	* parted/parted.c (do_print): Avoid two shadowing warnings.

2010-01-29  Hans de Goede  <hdegoede@redhat.com>

	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.

	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.

	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.

2010-01-18  Jim Meyering  <meyering@redhat.com>

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

2010-01-15  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest

	dos: don't leak a constraint upon partition-add failure
	* libparted/labels/dos.c (read_table): Free constraint upon failure.

	gpt: don't leak a constraint upon partition-add failure
	* libparted/labels/gpt.c (gpt_read): Free constraint upon failure.

	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.

	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.

	libparted: avoid double-free on an OOM failure path
	* libparted/disk.c (ped_disk_check): Don't double-free "fs_size".

2010-01-08  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest

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

	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.

	maint: update all FSF copyright year lists to include 2010
	Run this command: make update-copyright

	maint: record update-copyright options for this package
	* cfg.mk: Next time, just run "make update-copyright".

2009-12-31  Jim Meyering  <meyering@redhat.com>

	maint: newer gnulib; don't hard-code my GPG key ID
	* cfg.mk (gpg_key_ID): Remove definition, now that maint.mk automates it.
	* gnulib: Update to latest.

2009-12-20  Jim Meyering  <meyering@redhat.com>

	maint: make build-aux/gnu-web-doc-update work
	* cfg.mk (manual_title): Define.
	* doc/parted.texi (Concept index): Rename from "Index".
	Remove @ifnotplaintext..@end around its menu entry.

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

	version 2.1
	* NEWS: Record release date.

	doc: NEWS: mention the flag-truncation fix
	* NEWS (Bug fixes): Mention it.

2009-12-19  Hans de Goede  <hdegoede@redhat.com>

	dos: honor cylinder alignment disk flag when allocating metadata
	* libparted/labels/dos.c (add_startend_metadata): Honor cylinder
	alignment flag.

2009-12-18  Hans de Goede  <hdegoede@redhat.com>

	libparted: push/pop update mode around ped_disk_set_flag
	Disk flags can change how the metadata gets allocated, so push/pop
	update mode around ops->disk_set_flag, so that the metadata gets
	re-allocated.
	* libparted/disk.c (ped_disk_set_flag): push/pop update mode.

	linux: fix use-after-free in devicemapper code
	* libparted/arch/linux.c (_dm_add_partition): Fix use of dm_task
	information after freeing it.

	ui: Do not truncate flag names when printing
	The partition_print_flags() function was truncating the flag names,
	but these are translated strings, and thus can contain multibyte
	characters. Truncating multibyte chars in a non multibyte aware way
	is not good and was causing issues when printing tables in Russian:
	http://bugzilla.redhat.com/show_bug.cgi?id=543029

	Since the truncating does not seem to make sense at all this patch
	simply removes it (it was likely an attempt to stay within 80 chars
	when printing, but as one partition can have multiple flags set this
	won't work)

	* parted/parted.c (partition_print_flags): Don't truncate flag names.

2009-12-16  Jim Meyering  <meyering@redhat.com>

	libparted: plug a leak in mac_write
	* libparted/labels/mac.c (mac_write): Free mac_driverdata.

	maint: use "int", not "bool" for value returned by ped_device_write
	* libparted/labels/gpt.c (gpt_write): Correct type of local.
	* libparted/labels/mac.c (mac_clobber): Likewise.
	* libparted/labels/sun.c (sun_write): Likewise.

	libparted: plug a leak in mac's write_block_zero
	* libparted/labels/mac.c (write_block_zero): Don't leak a
	1-sector-sized buffer.

	dos: remove unreachable code
	* libparted/labels/dos.c (msdos_partition_new): Remove dead code.

	libparted: plug a leak in gpt_probe
	* libparted/labels/gpt.c (gpt_probe): Avoid a leak when dev->length
	is one sector or smaller.

2009-12-14  Jim Meyering  <meyering@redhat.com>

	maint: improve dist-check.mk rules
	* dist-check.mk (null_AM_MAKEFLAGS): Remove LIBTOOL.  Adding it was
	erroneous, since it is required when building from a distribution
	tarball of a libtool-using project.  Reported by Ralf Wildenhues.
	(my-distcheck): Reorganize to use a subshell and set -e, so that
	failures propagate "out".  Without this change, setting LIBTOOL=false
	would cause a failure that would then be ignored, probably due to a
	problem in $(install-transform-check).

	maint: dist-check.mk adapt to parted-specific details
	* dist-check.mk (built_programs): Use parted/, not src/.
	(install-transform-check): Search sbin/, not /bin.
	Expect man pages to be in man8/*.8.

2009-12-13  Jim Meyering  <meyering@redhat.com>

	maint: sync dist-check.mk from coreutils
	* dist-check.mk: Sync from coreutils.
	* gnulib: Update to latest.

	maint: sync dist-check.mk from coreutils
	* dist-check.mk: Sync from coreutils.
	* gnulib: Update to latest.

	build: distribute gperf-generated file, pt-limit.c
	* libparted/labels/Makefile.am (EXTRA_DIST): Distribute the
	gperf-generated file, pt-limit.c, so that people don't need to
	run gperf at build-from-tarball time.

2009-12-12  Jim Meyering  <meyering@redhat.com>

	ui: mkpart: avoid double free
	* parted/parted.c (do_mkpart): This function frees "part_name"
	immediately after the final use, but also upon e.g., ped_disk_commit
	failure.  Set part_name to NULL after the first free, to make
	the second a no-op after the first.

	build: update spec: gperf is a new build-requirement
	* parted.spec.in (BuildRequires): Add gperf.
	Reported by Jeff Darcy.

2009-12-11  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest

	tests: ensure that parted can partition a loop device
	* tests/t8000-loop.sh: Reverse sense of tests, now that
	partitioning a loop device succeeds again.
	* NEWS (Bug fixes): Mention it.

2009-12-11  Hans de Goede  <hdegoede@redhat.com>

	linux: treat loopback devices as files
	We cannot do partition related ioctl's on loopback devices,
	so treat them as files.
	* libparted/arch/linux.c (LOOP_MAJOR): Define.
	* libparted/arch/linux.c (_device_probe_type): Treat loopback
	devices as files.
	Reported by Josef Bacik in http://bugzilla.redhat.com/546622

2009-12-10  Hans de Goede  <hdegoede@redhat.com>

	libparted: missing pop update mode in ped_disk_delete_all error path
	* libparted/disk.c(ped_disk_delete_all): Add missing update mode pop
	call in error path.

	libparted: make pop/push update mode propagate sanity check errors
	Sanity check errors indicate something is really really wrong, still
	sometimes they happen, when they happen it helps a lot in debugging
	them when the libparted caller immediately errors out at the first
	moment, rather then slugging along until things crash somewere.
	* libparted/disk.c(_disk_push_update_mode,_disk_pop_update_mode):
	Change return value from void to int, and return 0 when the sanity
	check calls fail.
	* libparted/disk.c(*): Update all _disk_push_update_mode /
	_disk_pop_update_mode callers to propagate the return value.

2009-12-10  Joel Granados Moreno  <jgranado@redhat.com>

	libparted: add missing update mode pop in duplicate error path
	* libparted/disk.c(ped_disk_duplicate): Add missing update mode
	pop call in error path.

	gpt: Add support for appletv partitions
	* include/parted/disk.h(PedPartitionFlag): Add
	PED_PARTITION_APPLE_TV_RECOVERY.
	* libparted/disk.c(ped_partition_flag_get_name): Handle
	PED_PARTITION_APPLE_TV_RECOVERY.
	* libparted/labels/gpt.c(PARTITION_APPLE_TV_RECOVERY_GUID):
	New define.
	* libparted/labels/gpt.c(GPTPartitionData): Add atvrecv member.
	* libparted/labels/gpt.c(_parse_part_entry, gpt_partition_new,
	gpt_partition_set_system, gpt_partition_set_flag,
	gpt_partition_get_flag, gpt_partition_is_flag_available):
	Handle atvrecv / PARTITION_APPLE_TV_RECOVERY_GUID.

	build: don't install s390 dasd internal headers into /usr/include
	* include/parted/Makefile.am (partedinclude_HEADERS):
	Remove $(S390_HDRS).
	(noinst_HEADERS): Put them here instead.

2009-12-10  Hans de Goede  <hdegoede@redhat.com>

	ui: add --align command-line option to specify mkpart alignment
	The new --align command-line option can have the following values:
	none:     Use the minimum alignment allowed by the disk type
	cylinder: Align partitions to cylinders (the default)
	minimal: Use minimum alignment as given by the disk topology information
	optimal: Use optimum alignment as given by the disk topology information

	Note the "minimal" and "optimal" values will use layout information
	provided by the disk to align the logical partition table addresses
	to actual physical blocks on the disks.  The "minimal" value is the
	minimum aligment needed to align the partition properly to physical
	blocks, which avoids performance degradation.  Whereas the "optimum"
	alignment align's to a multiple of the physical block size in a way
	that guarantees optimal performance.

	The "minimal" and "optimal" values are useful only when parted is
	compiled with libblkid >= 2.17 and running on a kernel >= 2.6.31,
	otherwise they are equivalent to --align=none.

	* parted/parted.c (ALIGNMENT_ enum values): New enum.
	(options, options_help): Add --align option.
	(align_args, align_types, alignment): New global variables.
	(do_mkpart): Honor aligment variable.
	(_parse_options): handle --align option.
	* bootstrap.conf (gnulib_modules): Add argmatch.
	* NEWS: Mention the new --align option.
	* doc/parted.texi: Document --align option.
	* doc/C/parted.8: Likewise.

	NEWS: update with libblkid and kernel requirements for alignment funcs
	* NEWS: Change the note for the align-check command to also reference
	libblkid, add a note to the libparted alignment functions NEWS entry
	about libblkid and kernel requirements.

	NEWS: Add new disk flag functions to NEWS
	* NEWS: Add new disk flag functions.

	msdos, sun: implement disk flag operations
	* libparted/labels/dos.c (DosDiskData): New struct.
	* libparted/labels/dos.c (msdos_alloc, msdos_duplicate, msdos_free):
	Handle per disk DosDiskData.
	* libparted/labels/dos.c (msdos_disk_set_flag, msdos_disk_get_flag,
	msdos_disk_is_flag_available): New functions.
	* libparted/labels/sun.c (sun_disk_set_flag, sun_disk_get_flag,
	sun_disk_is_flag_available): New functions.

	libparted: add disk flag functions and PED_DISK_CYLINDER_ALIGNMENT flag
	Sometimes we want to be able to set flags at the disk level rather then
	at the parition level, to influence how new partitions will be created
	for example.  This patch adds functions to do this (modelled after the
	partition flag functions), and adds a PED_DISK_CYLINDER_ALIGNMENT flag.

	This flag (which defaults to true) controls if disk types for which
	cylinder alignment is optional do cylinder alignment when a new
	partition gets added. This flag is available for msdos and sun
	disklabels (for sun labels it only controls the aligning of the end of
	the partition).
	* include/parted/disk.h (PedDiskFlag): New type
	* include/parted/disk.h (ped_disk_set_flag, ped_disk_get_flag,
	ped_disk_is_flag_available): new functions and PedDiskOps members
	* include/parted/disk.h (ped_disk_flag_get_name,
	ped_disk_flag_get_by_name, ped_disk_flag_next): new functions
	* libparted/disk.c (ped_disk_set_flag, ped_disk_get_flag,
	ped_disk_is_flag_available, ped_disk_flag_get_name,
	ped_disk_flag_get_by_name, ped_disk_flag_next): new functions

	dasd: fix leak in dasd_free
	* libparted/labels/dasd.c (dasd_free): Free disk_specific data.

2009-12-09  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest

	build: make it clear which sector size is in use upon test failure
	* Makefile.am (ss-1024 ss-2048 ss-4096): New targets.
	Before this, top-level "make check" would lead to four separate
	runs through all the regression tests, one for each of the following
	simulated sector sizes: 1024 2048 4096, and one more for the native
	(usually 512), and it was not easy to tell which sector size was
	in use for a failing test.  Now, we still perform exactly the same
	tests, but the sector size is now part of each target name.

2009-12-08  Jim Meyering  <meyering@redhat.com>

	tests: exercise the new interfaces
	* tests/print-max.c: New file.
	* tests/t9021-maxima.sh: New file.
	* tests/Makefile.am (TESTS): Add t9021-maxima.sh.
	(check_PROGRAMS): Add print-max.

	libparted: new interfaces: max start sector, max partition length
	* libparted/disk.c (ped_disk_max_partition_start_sector): New function.
	(ped_disk_max_partition_length): New function.
	* include/parted/disk.h: Declare them.
	* NEWS (New features): Mention them.

	libparted: factor out duplication, hook up new APIs
	* include/parted/disk.h [struct _PedDiskOps]:
	(max_length, max_start_sector): New members.
	* libparted/labels/pt-common.h: New file.
	* libparted/labels/Makefile.am (liblabels_la_SOURCES): Add it.
	* libparted/labels/dos.c: Include "pt-common.h".
	(msdos_partition_check): Remove function.
	(msdos_disk_ops): Remove factored out initializers.
	* libparted/labels/gpt.c: Likewise.
	* libparted/labels/dvh.c: Likewise.
	* libparted/labels/aix.c:
	(aix_disk_ops, aix_partition_check): Likewise.
	* libparted/labels/bsd.c:
	(bsd_disk_ops, bsd_partition_check): Likewise.
	* libparted/labels/dasd.c:
	(dasd_disk_ops, dasd_partition_check): Likewise.
	* libparted/labels/loop.c:
	(loop_disk_ops, loop_partition_check): Likewise.
	* libparted/labels/mac.c:
	(mac_disk_ops, mac_partition_check): Likewise.
	* libparted/labels/pc98.c:
	(pc98_disk_ops, pc98_partition_check): Likewise.
	* libparted/labels/rdb.c:
	(amiga_disk_ops, amiga_partition_check): Likewise.
	* libparted/labels/sun.c:
	(sun_disk_ops, sun_partition_check): Likewise.
	* libparted/labels/gpt.c (NULL_IF_DISCOVER_ONLY): Remove definition,
	now that it's in pt-common.h.

	libparted: use gperf-generated lookup function
	* libparted/labels/pt-tools.c (ptt_partition_max_start_len):
	Rewrite to use the gperf-generated look-up function.
	(ptt_partition_max_start_sector): New function.
	(ptt_partition_max_length): New function.
	* libparted/labels/pt-tools.h: Declare them.
	* libparted/labels/Makefile.am (GPERF, GPERF_OPTIONS): Define.
	(BUILT_SOURCES): Define.
	(liblabels_la_SOURCES): Append pt-limit.gperf.
	(pt-limit.c): New rule.
	(MAINTAINERCLEANFILES): Remove useless definition.
	(DISTCLEANFILES): Set to $(BUILT_SOURCES).
	* libparted/labels/pt-limit.gperf: New file.
	* cfg.mk (bootstrap-tools): Mention gperf.
	* bootstrap.conf (buildreq): Require gperf-3.0.3.

	pc98: avoid segfault with simulated large sectors
	The pc98 partition table is by no means ready for >512-byte sectors,
	but at least it now gets past mklabel.  E.g., this usage no longer
	provokes double-free and read-uninitialized errors:
	dd if=/dev/zero of=F bs=512 count=1 seek=10000
	PARTED_SECTOR_SIZE=4096 valgrind ../parted/parted -s F mklabel pc98
	* libparted/labels/pc98.c (pc98_write): Rewrite to avoid
	invalid access with >512-byte sectors.

	libparted: ptt_read_sectors: new function
	* libparted/labels/pt-tools.c (ptt_read_sectors): New function.
	(ptt_read_sector): Rewrite to use it.
	* libparted/labels/pt-tools.h: Declare it.

2009-12-03  Jim Meyering  <meyering@redhat.com>

	mac: hook up the partition_check function for this partition table type
	* libparted/labels/pt-tools.c (ptt_partition_max_start_len): Define
	for MAC partition tables.  They too have 32-bit-limited partition
	starting sector number and partition length (in sectors).
	* libparted/labels/mac.c (mac_partition_check): Use
	ptt_partition_max_start_len.

2009-11-30  Jim Meyering  <meyering@redhat.com>

	tests: exercise new align-check command
	* tests/t9030-align-check.sh: New file.
	* tests/Makefile.am (TESTS): Add it.

	ui: new command: align-check TYPE N
	e.g.,
	  parted -s /dev/sda align-check min 1 && echo partition 1 is min-aligned
	  parted -s /dev/sda align-check opt 2 && echo partition 2 is opt-aligned

	* parted/parted.c:
	* parted/ui.c:
	* parted/ui.h:
	* NEWS (New features): Mention it.
	* doc/parted.texi (align-check): Describe it.

	tests: correct a comment
	* tests/t9020-alignment.sh: Correct a comment.

2009-11-27  Jim Meyering  <meyering@redhat.com>

	libparted: ped_disk_clobber_exclude: remove now-unused function
	I see no utility in ped_disk_clobber_exclude (just a thin wrapper
	around ped_disk_clobber), so am removing the interface.
	* include/parted/disk.h (ped_disk_clobber_exclude): Remove prototype.
	* libparted/disk.c (ped_disk_clobber_exclude): Remove function.
	Now that all callers use NULL as 2nd argument, replace each call
	with one to ped_disk_clobber.
	* scripts/data/abi/baseline_symbols.txt: Remove it.

	Reviewed-by: Karel Zak <kzak@redhat.com>

	ped_disk_clobber: change semantics
	Why?  Because if we're going to clobber a partition table,
	it is wasteful and error prone to try to interpret as a partition
	table whatever existing data there may be.  It may be corrupt, or
	a mix of two or more types.  It is far cleaner just to zero out
	the key sectors.

	The previous mechanism was like this:
	for each partition table type, T,
	    # See if the device has a partition of type T.
	    # If so, run the partition-table-specific code to clear it.
	    if t->ops->probe (dev)
	      t->ops->clobber (dev)
	Instead, simply zero out the first few and last few sectors.
	Except for GPT, for which we exempt the first sector (the pMBR).
	In order to zero out even the bits DASD uses for its identifying
	strings, we have to clobber at least the 8.5KiB at the beginning
	of the disk, so round up to 9KiB.
	* libparted/disk.c: Include "labels/pt-tools.h".
	(find_disk_type): New helper function.
	(ped_disk_clobber_exclude):

	Reviewed-by: Karel Zak <kzak@redhat.com>

	dasd: allow the use of a *regular* backing file
	Before this change, dasd partition tables had to be associated with
	very specialized block devices available only on IBM s390 systems.
	This made testing especially hard.  Not only did you need access
	to one of those relatively uncommon systems, but you also needed
	access to a spare block device.  In addition, many of Parted's
	tests may be run as a non-privileged user, using regular files,
	and those tests would fail when run on an s390.

	This change makes it so you may now write a DASD partition table
	to a regular backing file, just as you may with any other supported
	partition table type.  However, note that even now, DASD support
	is conditionally compiled and hence enabled only when compiling
	for an s390 target.

	* libparted/arch/linux.c (_device_set_sector_size) [__s390__]:
	Allow operation on a device of type PED_DEVICE_FILE, as well as
	those of type PED_DEVICE_DASD.
	* libparted/labels/fdasd.c: Include <parted/device.h>.
	(fdasd_get_geometry): Add a new "dev" parameter, required for
	dev-phys-sector_size, which is needed in order to initialize
	the "anc" structure without using the device-specific ioctls.
	When file descriptor "f" refers to a regular file, initialize
	"anc", "dasd_info", etc. from other sources (fstat and dev->).
	Update all callers to reflect added parameter.
	(fdasd_check_api_version): Skip ioctl-calling tests when "f" is
	a regular file.
	* include/parted/fdasd.h: Update fdasd_get_geometry prototype.
	* libparted/labels/dasd.c (dasd_probe): Also allow PED_DEVICE_FILE.
	(dasd_alloc_metadata): Initialize arch_specific->real_sector_size,
	which is used in calculating vtoc_end.

	Reviewed-by: Karel Zak <kzak@redhat.com>

	loop: simplify/correct loop_clobber
	Before, it would clear a sector only if it recognized its own
	signature.  In addition, it would continue clearing subsequent
	sectors as long as loop_probe succeeded.  Now we simply clear
	the first sector.
	* libparted/labels/loop.c (loop_clobber): Simplify.

	Reviewed-by: Karel Zak <kzak@redhat.com>

2009-11-26  Jim Meyering  <meyering@redhat.com>

	tests: indicate that we expect t3200-type-change to fail, for now
	* tests/Makefile.am (TESTS): Move t3200-type-change.sh to ...
	(XFAIL_TESTS): ...here.

2009-11-24  Jim Meyering  <meyering@redhat.com>

	tests: correct t3200-type-change.sh
	* tests/t3200-type-change.sh: The initial version was incomplete.

	tests: provide a new function: fail_
	* tests/t-lib.sh (fail_): New function.

	tests: t0001-tiny.sh: avoid spurious failure when run as root.
	* tests/t0001-tiny.sh: Control characters were getting in the way.
	Filter them out.

2009-11-23  Jim Meyering  <meyering@redhat.com>

	dasd: avoid NULL-dereference via disk->type->ops->partition_check
	Commit f387fee8 added the new ops->partition_check() function,
	and a <type>_partition_check function for each partition table
	format _except_ dasd.  This change adds one for dasd, too.
	* libparted/labels/dasd.c: Include "pt-tools.h".
	(dasd_partition_check): New function.
	* libparted/labels/pt-tools.c (ptt_partition_max_start_len): Add "dasd"
	to the list of partition table type names for which the 32-bit
	limits on starting sector and partition length apply.
	Correct a comment.
	Considering the 32-bit fields in "struct fdasd_hd_geometry",
	it is safe to assume that larger offset or size is not possible.

2009-11-18  Jim Meyering  <meyering@redhat.com>

	build: "make stable" emitted an invalid gnupload command
	* cfg.mk (gnu_ftp_host-stable): Rename from gnu_ftp_host-major.

2009-11-17  Jim Meyering  <meyering@redhat.com>

	test for partition-type-changing bug
	* tests/t3200-type-change.sh: New file.
	* tests/Makefile.am (TESTS): Add it.

2009-11-13  Jim Meyering  <meyering@redhat.com>

	gpt: greatly simply gpt_clobber; minor semantic change, too
	* libparted/labels/gpt.c (gpt_clobber): Don't bother to read and
	parse existing headers.  Instead, simply clear three sectors:
	the pMBR, the primary header (LBA1), and the last sector.
	There is no point in clearing what the primary header says is the
	AlternateLBA, since once the primary header and the last sector
	are cleared, there is no risk of any tool using it by mistake.

	tests: t0000-basic.sh: minor correction
	* tests/t0000-basic.sh: When zeroing out the first sector,
	use dd's conv=notrunc.  Otherwise, we'd also truncate the
	backing file size to 4KiB.

	linux_read: give a proper diagnostic for an "end of file" error
	Before today's gpt_probe bug fix, its test case would provoke
	an invalid diagnostic.  This makes the diagnostic useful.
	* libparted/arch/linux.c (linux_read): When hitting EOF while reading,
	diagnose it properly, rather than via strerror(0) (i.e., "Success").

	gpt_probe: don't attempt to read beyond end of a very small disk
	* libparted/labels/gpt.c (gpt_probe): Don't try to read the
	2nd sector if that's beyond the end of the disk.
	* tests/t0001-tiny.sh: New test, to expose the above boundary-case bug.
	Part of the msdos-partition-creation process involves probing for
	other types of partition tables.  Probing for gpt would evoke a
	nonsensical diagnostic.
	* tests/Makefile.am (TESTS): Add t0001-tiny.sh.

	dvh: replace open-coded dvh_clobber with equivalent, shorter code
	* libparted/labels/dvh.c (dvh_clobber): Simply use ptt_clear_sectors.

	tests: weaken t0202-gpt-pmbr to assume a preexisting GPT table
	* tests/t0202-gpt-pmbr.sh: Lay down an initial GPT table before
	writing to the MBR, so this test passes with the new semantics.

	tests: rewrite t0202 to use new framework
	* tests/t0202-gpt-pmbr.sh: Rewrite.

	ped_disk_type_get_next: fix a const-correctness bug
	* libparted/disk.c (ped_disk_type_get_next): Make param const.
	* include/parted/disk.h (ped_disk_type_get_next): Update prototype.

2009-11-12  Hans de Goede  <hdegoede@redhat.com>

	NEWS: mention recent changes

2009-11-12  Jim Meyering  <meyering@redhat.com>

	maint: more const-correctness fixes

2009-11-12  Hans de Goede  <hdegoede@redhat.com>

	dasd: fix ped_disk_new_fresh to not read old data from disk
	dasd_write(), was reading the volume label from the disk (trough
	fdasd_check_volume()) and later writing it back again, this is fine for
	existing dasd labels, but when creating a fresh label, this would
	also cause the old volume label to be re-used, and if the old label
	was corrupt, it would cause fdasd_check_volume() and thus dasd_write()
	to fail.  Reported here: http://bugzilla.redhat.com/533808

	* libparted/arch/linux.c: include fdasd.h.
	(init_dasd): Do BIODASDINFO ioctl, and store the dasd devno in
	arch_specific.
	(init_dasd): Remove dead (never reached) code.
	* libparted/arch/linux.h (struct _LinuxSpecific): Add devno member.
	* libparted/labels/dasd.c (DasdDiskSpecific): add vlabel member.
	(dasd_alloc): Init DasdDiskSpecific.vlabel for fresh disks
	(dasd_read): Store read vlabel in DasdDiskSpecific.vlabel.
	(dasd_write): Write DasdDiskSpecific.vlabel instead of on disk vlabel.

2009-11-10  Jim Meyering  <meyering@redhat.com>

	build: avoid s390-specific compilation failiure
	* libparted/labels/vtoc.c (vtoc_volume_label_init): Don't use
	strncpy to copy 84 bytes into a 4-byte field.  Instead, use
	memcpy to copy "sizeof *vlabel" bytes into the "vlabel".

	maint: fix s390-specific const correctness problems
	* libparted/labels/vtoc.c (vtoc_error, vtoc_ebcdic_enc):
	(vtoc_ebcdic_dec): Declare parameters to be const, as required.
	* libparted/labels/fdasd.c (fdasd_error): Likewise.
	* include/parted/vtoc.h (vtoc_ebcdic_enc, vtoc_ebcdic_enc): Update
	prototypes.

	gpt: fix a bug in the new PE-array CRC checks on big-endian systems
	* libparted/labels/gpt.c (check_PE_array_CRC, gpt_read): Always
	convert the PartitionEntryArrayCRC32 to CPU endianness before
	comparing with a just-computed CRC.

2009-11-08  Jim Meyering  <meyering@redhat.com>

	build: use gnulib's canonicalize-lgpl module
	Replace Parted's private version of canonicalize_file_name.
	* libparted/device.c: Include <stdlib.h>.
	(canonicalize_file_name) [!HAVE_CANONICALIZE_FILE_NAME]:
	Remove definition.
	* bootstrap.conf (gnulib_modules): Add canonicalize-lgpl.

2009-11-07  Jim Meyering  <meyering@redhat.com>

	libparted: linux: don't deref NULL upon failed malloc or realloc
	* libparted/arch/linux.c (_read_fd): Handle allocation failure.

	build: update gnulib submodule to latest

	maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exit
	Convert all uses automatically, via these two commands:
	git grep -l '\<exit *(1)'|xargs --no-run-if-empty \
	  perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/'
	git grep -l '\<exit *(0)'|xargs --no-run-if-empty \
	  perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/'
	* libparted/fs/fat/table.c (fat_table_get): Use symbolic exit codes.
	* libparted/labels/vtoc.c (vtoc_update_format5_label_add): Likewise.
	(vtoc_update_format5_label_del): Likewise.
	(vtoc_update_format7_label_add): Likewise.
	(vtoc_update_format7_label_del): Likewise.
	* m4/parted.m4 (PARTED_CHECK_LIBPARTED): Likewise.
	* parted/parted.c (do_quit): Likewise.
	* parted/strlist.c (gettext_to_wchar, wchar_to_str): Likewise.
	* parted/ui.c (reset_env, help_msg, non_interactive_mode): Likewise.

2009-11-06  Hans de Goede  <hdegoede@redhat.com>

	dasd: fix unused variable warning
	* libparted/labels/dasd.c (dasd_get_partition_alignment): Fix unused
	variable warning.

	linux: use cached major minor instead of statting the device again
	* libparted/arch/linux.c (_dm_remove_parts): Use cached major/minor
	numbers.

	linux: use devicemapper task name instead of device node name
	Use devicemapper task name instead of device node name as basename for
	devicemapper disk partitions.

	This is needed for upcoming lvm changes where the /dev/mapper/foobar
	files are becoming symlinks, so we will end up opening /dev/dm-#,
	and naming our partitions dm-#p1, dm-#p2, instead of foobarp1,
	foobarp2, etc.
[--snip--]
