[parted-devel] Strange linux-swap name change

Jim Meyering jim at meyering.net
Fri Jul 10 21:29:01 UTC 2009


Colin Watson wrote:
> On Fri, Jun 19, 2009 at 08:52:05PM +0200, Jim Meyering wrote:
>> Colin Watson wrote:
>> > One other thing I thought of is that perhaps linux-swap(old) and
>> > linux-swap(new) should also become aliases; I don't know whether the
>> > person who introduced them, or anyone else, is depending on them. I know
>> > that the Debian installer recently started using that name, but the
>> > change there was strictly contained to one program so it would be easy
>> > to adjust again.
>>
>> Good idea.
>> Extra credit if you can "deprecate" them, so that any
>> use evokes a warning that they'll be going away some day.
>
> Your wish is my (belated) command. How's this? I included a NEWS entry
> as well, as you requested in another mail.
>
> Colin Watson                                       [cjwatson at ubuntu.com]
>
>>From e1fcfd82c249ddc8b01732e532afc1a40207cfde Mon Sep 17 00:00:00 2001
> From: Colin Watson <cjwatson at ubuntu.com>
> Date: Fri, 10 Jul 2009 12:42:14 +0100
> Subject: [PATCH] Rationalise linux-swap fs names, and add a "linux-swap" alias
>
> * libparted/filesys.c (ped_file_system_alias_register,
> ped_file_system_alias_unregister, ped_file_system_alias_get_next): New
> functions.
> (ped_file_system_type_get): Walk aliases as well.
> * include/parted/filesys.h (struct _PedFileSystemAlias): New structure.
> (ped_file_system_alias_register, ped_file_system_alias_unregister,
> ped_file_system_alias_get_next): Add prototypes.
> * parted/parted.c (_init_messages): Walk file system aliases as well as
> types.
> * parted/ui.c (init_fs_type_str): Likewise.
>
> * libparted/fs/linux_swap/linux_swap.c (_swap_v1_type, _swap_v1_open,
> _swap_v1_probe, _swap_v1_clobber, _swap_v1_ops): Rename to _swap_v0_type
> etc. to match version number used in mkswap. Update all users.
> (_swap_v2_type, _swap_v2_open, _swap_v2_probe, _swap_v2_clobber,
> _swap_v2_ops): Rename to _swap_v1_type etc. to match version number used
> in mkswap. Update all users.
> (_swap_v0_type): Rename type from "linux-swap(old)" to "linux-swap(v0)".
> (_swap_v1_type): Rename type from "linux-swap(new)" to "linux-swap(v1)".
> (ped_file_system_linux_swap_init, ped_file_system_linux_swap_done):
> Register/unregister a "linux-swap" alias for "linux-swap(v1)", and
> deprecated aliases "linux-swap(old)" and "linux-swap(new)".
> * libparted/labels/misc.h (is_linux_swap): Update comment.
>
> * tests/t2100-mkswap.sh: Refer to "linux-swap(v1)" rather than
> "linux-swap(new)". Test creation via the new alias.
> ---
>  NEWS                                 |    7 +++
>  include/parted/filesys.h             |   21 +++++++++
>  libparted/filesys.c                  |   76 +++++++++++++++++++++++++++++++++-
>  libparted/fs/linux_swap/linux_swap.c |   68 +++++++++++++++++-------------
>  libparted/labels/misc.h              |    2 +-
>  parted/parted.c                      |   37 +++++++++++++++-
>  parted/ui.c                          |    9 ++++
>  tests/t2100-mkswap.sh                |   11 ++++-
>  8 files changed, 193 insertions(+), 38 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index efeb258..f19d303 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -2,6 +2,13 @@ GNU parted NEWS                                    -*- outline -*-
>
>  * Noteworthy changes in release 1.9.0 (????-??-??) [stable]
>
> +libparted:
> +* The linux-swap "filesystem" types are now called "linux-swap(v0)" and
> +  "linux-swap(v1)" rather than "linux-swap(old)" and "linux-swap(new)"
> +  as in parted 1.8, or "linux-swap" as in older versions; "old" and
> +  "new" generally make poor names, and v1 is the only format supported
> +  by current Linux kernels. Aliases for all previous names are
> +  available.

Thanks for doing that.
Note that your aliases apply to strings read from
a file system, not from the command line interface:

    $ ./parted -s $dev mkfs 1 "linux-swap(v1)"
    $ ./parted -s $dev mkfs 1 "linux-swap(new)"
    ./parted: invalid token: linux-swap(new)
    Error: Expecting a file system type.
    [Exit 1]

If you were to make them apply also to the UI,
then no one could complain at all, but it's not a big deal.

I'm about to push your change set with this small amendment,
for slightly improved readability/maintainability:

diff --git a/libparted/filesys.c b/libparted/filesys.c
index 80ec147..d57c3cd 100644
--- a/libparted/filesys.c
+++ b/libparted/filesys.c
 	PED_ASSERT (fs_type != NULL, return);
 	PED_ASSERT (alias != NULL, return);

-	fs_alias = ped_malloc (sizeof (PedFileSystemAlias));
+	fs_alias = ped_malloc (sizeof *fs_alias);
 	if (!fs_alias)
 		return;



More information about the parted-devel mailing list