[Parted-commits] GNU Parted Official Repository: Changes to 'stable-1.8.x'

Otavio Salvador otavio at alioth.debian.org
Mon May 14 18:39:58 UTC 2007


 libparted/fs/linux_swap/linux_swap.c |  276 +++--------------------------------
 1 file changed, 28 insertions(+), 248 deletions(-)

New commits:
commit 07134c3c77ed2bc18cd4b82b6c1874e4e51a74ad
Author: David Cantrell <dcantrell at redhat.com>
Date:   Tue Mar 20 13:26:10 2007 -0400

    Bump version number for 1.8.6.

diff --git a/NEWS b/NEWS
index 10fe829..a47c807 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+1.8.6
+=====
+
+Revert the implementation of the linux-swap(new) and linux-swap(old) types.
+The type is 'linux-swap' for v1, v2, and s1suspend swap partitions on Linux.
+
+
 1.8.5
 =====
 
diff --git a/configure.ac b/configure.ac
index 441507d..8c4b33d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ dnl
 dnl This file may be modified and/or distributed without restriction.
 
 AC_PREREQ(2.61)
-AC_INIT([GNU parted],[1.8.5],[bug-parted at gnu.org])
+AC_INIT([GNU parted],[1.8.6],[bug-parted at gnu.org])
 
 AC_CONFIG_SRCDIR(include/parted/parted.h)
 
@@ -24,7 +24,7 @@ dnl function signatures changed),
 dnl set PED_BINARY_AGE _and_ PED_INTERFACE_AGE to 0.
 PED_MAJOR_VERSION=1
 PED_MINOR_VERSION=8
-PED_MICRO_VERSION=5
+PED_MICRO_VERSION=6
 PED_INTERFACE_AGE=0
 PED_BINARY_AGE=0
 PED_VERSION_SUFFIX=
diff --git a/parted.lsm b/parted.lsm
index 18faef1..1cccfed 100644
--- a/parted.lsm
+++ b/parted.lsm
@@ -1,6 +1,6 @@
 Begin4
 Title: parted 
-Version: 1.8.5
+Version: 1.8.6
 Entered-date: 
 Description: GNU Parted is a program for creating, destroying, resizing,
 checking and copying partitions, and the filesystems on them. This is useful for
@@ -10,8 +10,8 @@ Keywords: partition, partitioning, file system, format, hard disk, storage, disk
 Author: <clausen at gnu.org> (Andrew Clausen)
 Maintained-by: <parted-devel at lists.alioth.debian.org> (GNU Parted development team)
 Primary-site: ftp://ftp.gnu.org/gnu/parted
-1.4M parted-1.8.5.tar.bz2
-2.1M parted-1.8.5.tar.gz
+1.4M parted-1.8.6.tar.bz2
+2.1M parted-1.8.6.tar.gz
 Platforms: Linux, FreeBSD, BeOS; compiles with GCC and probably other C99 compilers.
 Copying-policy: GPL
 End

commit 4858502bfd6e9dd540637d6216de94dd91328272
Author: David Cantrell <dcantrell at redhat.com>
Date:   Tue Mar 20 13:23:53 2007 -0400

    Revert the implementation of linux-swap(old) and linux-swap(new) types.  Inappropriate change for the stable branch.  Using just the linux-swap type as before.  Detection of v1, v2, and s1suspend partitions all cause a type of linux-swap to be used.

diff --git a/libparted/fs/linux_swap/linux_swap.c b/libparted/fs/linux_swap/linux_swap.c
index a8e95fd..e4f3edd 100644
--- a/libparted/fs/linux_swap/linux_swap.c
+++ b/libparted/fs/linux_swap/linux_swap.c
@@ -69,41 +69,20 @@ typedef struct {
 	unsigned int	max_bad_pages;
 } SwapSpecific;
 
-static PedFileSystemType _swap_v1_type;
-static PedFileSystemType _swap_v2_type;
-static PedFileSystemType _swap_swsusp_type;
+static PedFileSystemType swap_type;
 
-static PedFileSystem* _swap_v1_open (PedGeometry* geom);
-static PedFileSystem* _swap_v2_open (PedGeometry* geom);
-static PedFileSystem* _swap_swsusp_open (PedGeometry* geom);
+static PedFileSystem* swap_open (PedGeometry* geom);
 static int swap_close (PedFileSystem* fs);
 
 static PedGeometry*
-_generic_swap_probe (PedGeometry* geom, int kind)
+swap_probe (PedGeometry* geom)
 {
 	PedFileSystem*	fs;
 	SwapSpecific*	fs_info;
 	PedGeometry*	probed_geom;
 	PedSector	length;
 
-        switch (kind) {
-        /* Check for old style swap partitions. */
-                case 0:
-                        fs = _swap_v1_open(geom);
-                        break;
-        /* Check for new style swap partitions. */
-                case 1:
-                        fs = _swap_v2_open(geom);
-                        break;
-        /* Check for swap partitions containing swsusp data. */
-                case -1:
-                        fs = _swap_swsusp_open(geom);
-                        break;
-        /* Not reached. */
-                default:
-                        goto error;
-        }
-
+	fs = swap_open (geom);
 	if (!fs)
 		goto error;
 	fs_info = SWAP_SPECIFIC (fs);
@@ -111,8 +90,7 @@ _generic_swap_probe (PedGeometry* geom, int kind)
 	if (fs_info->version)
 		length = fs_info->page_sectors * fs_info->page_count;
 	else
-	        length = geom->length;
-
+		length = geom->length;
 	probed_geom = ped_geometry_new (geom->dev, geom->start, length);
 	if (!probed_geom)
 		goto error_close_fs;
@@ -127,29 +105,12 @@ error:
 
 #ifndef DISCOVER_ONLY
 static int
-_generic_swap_clobber (PedGeometry* geom, int kind)
+swap_clobber (PedGeometry* geom)
 {
 	PedFileSystem*		fs;
 	char			buf[512];
 
-        switch (kind) {
-        /* Check for old style swap partitions. */
-                case 0:
-                        fs = _swap_v1_open(geom);
-                        break;
-        /* Check for new style swap partitions. */
-                case 1:
-                        fs = _swap_v2_open(geom);
-                        break;
-        /* Check for swap partitions containing swsusp data. */
-                case -1:
-                        fs = _swap_swsusp_open(geom);
-                        break;
-        /* Not reached */
-                default:
-                        goto error;
-        }
-
+	fs = swap_open (geom);
 	if (!fs)
 		return 1;
 
@@ -167,7 +128,7 @@ error:
 }
 #endif /* !DISCOVER_ONLY */
 
-static int
+static void
 swap_init (PedFileSystem* fs, int fresh)
 {
 	SwapSpecific*	fs_info = SWAP_SPECIFIC (fs);
@@ -178,13 +139,11 @@ swap_init (PedFileSystem* fs, int fresh)
 	fs_info->max_bad_pages = (getpagesize()
 					- sizeof (SwapNewHeader)) / 4;
 
-	if (fresh) {
+	if (fresh)
 		memset (fs_info->header, 0, getpagesize());
-                return 1;
-        }
 	else
-                return ped_geometry_read (fs->geom, fs_info->header,
-                                          0, fs_info->page_sectors);
+		ped_geometry_read (fs->geom, fs_info->header,
+				   0, fs_info->page_sectors);
 }
 
 static PedFileSystem*
@@ -215,7 +174,7 @@ swap_alloc (PedGeometry* geom)
 	fs->geom = ped_geometry_duplicate (geom);
 	if (!fs->geom)
 		goto error_free_buffer;
-	fs->type = &_swap_v2_type;
+	fs->type = &swap_type;
 	return fs;
 
 error_free_buffer:
@@ -244,7 +203,7 @@ swap_free (PedFileSystem* fs)
 }
 
 static PedFileSystem*
-_swap_v1_open (PedGeometry* geom)
+swap_open (PedGeometry* geom)
 {
 	PedFileSystem*		fs;
 	SwapSpecific*		fs_info;
@@ -266,96 +225,18 @@ _swap_v1_open (PedGeometry* geom)
 		fs_info->page_count
 			= PED_MIN (fs->geom->length / fs_info->page_sectors,
 				   8 * (getpagesize() - 10));
-	} else {
-		char	_sig [11];
-
-		memcpy (_sig, sig, 10);
-		_sig [10] = 0;
- 		ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
-			_("Unrecognised old style linux swap signature '%10s'."), _sig);
- 		goto error_free_fs;
-	}
-
-	fs->checked = 1;
-	return fs;
-
-error_free_fs:
-	swap_free (fs);
-error:
-	return NULL;
-}
-
-static PedFileSystem*
-_swap_v2_open (PedGeometry* geom)
-{
-	PedFileSystem*		fs;
-	SwapSpecific*		fs_info;
-	const char*		sig;
-
-	fs = swap_alloc (geom);
-	if (!fs)
-		goto error;
-/* 	swap_init (fs, 0); */
-
-/* 	fs_info = SWAP_SPECIFIC (fs); */
-/* 	if (!ped_geometry_read (fs->geom, fs_info->header, 0, */
-/* 				fs_info->page_sectors)) */
-        if (!swap_init(fs, 0))
-		goto error_free_fs;
-
-        fs_info = SWAP_SPECIFIC (fs);
-
-	sig = ((char*) fs_info->header) + getpagesize() - 10;
-	if (strncmp (sig, "SWAPSPACE2", 10) == 0) {
+	} else if (strncmp (sig, "SWAPSPACE2", 10) == 0) {
 		fs_info->version = 1;
 		fs_info->page_count = fs_info->header->new.last_page;
+	} else if (strncmp (sig, "S1SUSPEND", 9) == 0) {
+		fs_info->version = -1;
 	} else {
 		char	_sig [11];
 
 		memcpy (_sig, sig, 10);
 		_sig [10] = 0;
  		ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
-			_("Unrecognised new style linux swap signature '%10s'."), _sig);
- 		goto error_free_fs;
-	}
-
-	fs->checked = 1;
-	return fs;
-
-error_free_fs:
-	swap_free (fs);
-error:
-	return NULL;
-}
-
-static PedFileSystem*
-_swap_swsusp_open (PedGeometry* geom)
-{
-	PedFileSystem*		fs;
-	SwapSpecific*		fs_info;
-	const char*		sig;
-
-	fs = swap_alloc (geom);
-	if (!fs)
-		goto error;
-        fs->type = &_swap_swsusp_type;
-	swap_init (fs, 0);
-
-	fs_info = SWAP_SPECIFIC (fs);
-	if (!ped_geometry_read (fs->geom, fs_info->header, 0,
-				fs_info->page_sectors))
-		goto error_free_fs;
-
-	sig = ((char*) fs_info->header) + getpagesize() - 10;
-       	if (strncmp (sig, "S1SUSPEND", 9) == 0) {
-	        fs_info->version = -1;
-	} else {
-		char	_sig [10];
-
-		memcpy (_sig, sig, 9);
-		_sig [9] = 0;
- 		ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
-			_("Unrecognised swsusp linux swap signature '%9s'."), _sig);
+			_("Unrecognised linux swap signature '%10s'."), _sig);
  		goto error_free_fs;
 	}
 
@@ -558,7 +439,7 @@ error:
 static PedFileSystem*
 swap_copy (const PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
 {
-	return ped_file_system_create (geom, &_swap_v2_type, timer);
+	return ped_file_system_create (geom, &swap_type, timer);
 }
 
 static int
@@ -594,68 +475,11 @@ swap_get_copy_constraint (const PedFileSystem* fs, const PedDevice* dev)
 }
 #endif /* !DISCOVER_ONLY */
 
-static PedGeometry*
-_swap_v1_probe (PedGeometry* geom) {
-        return _generic_swap_probe (geom, 0);
-}
-
-static PedGeometry*
-_swap_v2_probe (PedGeometry* geom) {
-        return _generic_swap_probe (geom, 1);
-}
-
-static PedGeometry*
-_swap_swsusp_probe (PedGeometry* geom) {
-        return _generic_swap_probe (geom, -1);
-}
-
-static int
-_swap_v1_clobber (PedGeometry* geom) {
-        return _generic_swap_clobber (geom, 0);
-}
-
-static int
-_swap_v2_clobber (PedGeometry* geom) {
-        return _generic_swap_clobber (geom, 1);
-}
-
-static int
-_swap_swsusp_clobber (PedGeometry* geom) {
-        return _generic_swap_clobber (geom, -1);
-}
-
-static PedFileSystemOps _swap_v1_ops = {
-	probe:		_swap_v1_probe,
-#ifndef DISCOVER_ONLY
-	clobber:	_swap_v1_clobber,
-	open:		_swap_v1_open,
-	create:		swap_create,
-	close:		swap_close,
-	check:		swap_check,
-	copy:		swap_copy,
-	resize:		swap_resize,
-	get_create_constraint:	swap_get_create_constraint,
-	get_resize_constraint:	swap_get_resize_constraint,
-	get_copy_constraint:	swap_get_copy_constraint
-#else
-	clobber:	NULL,
-	open:		NULL,
-	create:		NULL,
-	close:		NULL,
-	check:		NULL,
-	copy:		NULL,
-	resize:		NULL,
-	get_create_constraint:	NULL,
-	get_resize_constraint:	NULL,
-	get_copy_constraint:	NULL
-#endif /* !DISCOVER_ONLY */
-};
-
-static PedFileSystemOps _swap_v2_ops = {
-	probe:		_swap_v2_probe,
+static PedFileSystemOps swap_ops = {
+	probe:		swap_probe,
 #ifndef DISCOVER_ONLY
-	clobber:	_swap_v2_clobber,
-	open:		_swap_v2_open,
+	clobber:	swap_clobber,
+	open:		swap_open,
 	create:		swap_create,
 	close:		swap_close,
 	check:		swap_check,
@@ -678,66 +502,22 @@ static PedFileSystemOps _swap_v2_ops = {
 #endif /* !DISCOVER_ONLY */
 };
 
-static PedFileSystemOps _swap_swsusp_ops = {
-  probe:		_swap_swsusp_probe,
-#ifndef DISCOVER_ONLY
-	clobber:	_swap_swsusp_clobber,
-	open:		_swap_swsusp_open,
-	create:		swap_create,
-	close:		swap_close,
-	check:		swap_check,
-	copy:		swap_copy,
-	resize:		swap_resize,
-	get_create_constraint:	swap_get_create_constraint,
-	get_resize_constraint:	swap_get_resize_constraint,
-	get_copy_constraint:	swap_get_copy_constraint
-#else
-	clobber:	NULL,
-	open:		NULL,
-	create:		NULL,
-	close:		NULL,
-	check:		NULL,
-	copy:		NULL,
-	resize:		NULL,
-	get_create_constraint:	NULL,
-	get_resize_constraint:	NULL,
-	get_copy_constraint:	NULL
-#endif /* !DISCOVER_ONLY */
-};
-
-static PedFileSystemType _swap_v1_type = {
-	next:	NULL,
-	ops:	&_swap_v1_ops,
-	name:	"linux-swap(old)",
-	block_sizes: LINUXSWAP_BLOCK_SIZES
-};
-
-static PedFileSystemType _swap_v2_type = {
+static PedFileSystemType swap_type = {
 	next:	NULL,
-	ops:	&_swap_v2_ops,
-	name:	"linux-swap(new)",
+	ops:	&swap_ops,
+	name:	"linux-swap",
 	block_sizes: LINUXSWAP_BLOCK_SIZES
 };
 
-static PedFileSystemType _swap_swsusp_type = {
-        next:   NULL,
-	ops:    &_swap_swsusp_ops,
-	name:   "swsusp",
-        block_sizes: LINUXSWAP_BLOCK_SIZES
-};
-
 void
 ped_file_system_linux_swap_init ()
 {
-	ped_file_system_type_register (&_swap_v1_type);
-	ped_file_system_type_register (&_swap_v2_type);
-	ped_file_system_type_register (&_swap_swsusp_type);
+	ped_file_system_type_register (&swap_type);
 }
 
 void
 ped_file_system_linux_swap_done ()
 {
-	ped_file_system_type_unregister (&_swap_v1_type);
-	ped_file_system_type_unregister (&_swap_v2_type);
-	ped_file_system_type_unregister (&_swap_swsusp_type);
+	ped_file_system_type_unregister (&swap_type);
 }
+



More information about the Parted-commits mailing list