diff options
author | Colin Watson <cjwatson@ubuntu.com> | 2009-07-10 12:42:14 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-07-10 23:29:10 +0200 |
commit | 2882b5300103238f8d71bdf6d0c1f54c4c59646d (patch) | |
tree | 568a51dae3bec0704f69d15a618a4323d429b319 /parted | |
parent | 32dcfa4738ce7a430308615d9e4236e71ba94b66 (diff) | |
download | parted-2882b5300103238f8d71bdf6d0c1f54c4c59646d.tar.gz |
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.
Diffstat (limited to 'parted')
-rw-r--r-- | parted/parted.c | 37 | ||||
-rw-r--r-- | parted/ui.c | 9 |
2 files changed, 43 insertions, 3 deletions
diff --git a/parted/parted.c b/parted/parted.c index e6364bf..17b2b6c 100644 --- a/parted/parted.c +++ b/parted/parted.c @@ -1983,6 +1983,7 @@ _init_messages () StrList* list; int first; PedFileSystemType* fs_type; + PedFileSystemAlias* fs_alias; PedDiskType* disk_type; PedPartitionFlag part_flag; PedUnit unit; @@ -2039,7 +2040,7 @@ _init_messages () label_type_msg = str_list_convert (list); str_list_destroy (list); -/* mkfs - file system types */ +/* mkfs - file system types and aliases */ list = str_list_create (_(fs_type_msg_start), NULL); first = 1; @@ -2054,12 +2055,23 @@ _init_messages () str_list_append (list, ", "); str_list_append (list, fs_type->name); } + for (fs_alias = ped_file_system_alias_get_next (NULL); + fs_alias; fs_alias = ped_file_system_alias_get_next (fs_alias)) { + if (fs_alias->fs_type->ops->create == NULL) + continue; + + if (first) + first = 0; + else + str_list_append (list, ", "); + str_list_append (list, fs_alias->alias); + } str_list_append (list, "\n"); mkfs_fs_type_msg = str_list_convert (list); str_list_destroy (list); -/* mkpart - file system types */ +/* mkpart - file system types and aliases */ list = str_list_create (_(fs_type_msg_start), NULL); first = 1; @@ -2071,12 +2083,20 @@ _init_messages () str_list_append (list, ", "); str_list_append (list, fs_type->name); } + for (fs_alias = ped_file_system_alias_get_next (NULL); + fs_alias; fs_alias = ped_file_system_alias_get_next (fs_alias)) { + if (first) + first = 0; + else + str_list_append (list, ", "); + str_list_append (list, fs_alias->alias); + } str_list_append (list, "\n"); mkpart_fs_type_msg = str_list_convert (list); str_list_destroy (list); -/* resize - file system types */ +/* resize - file system types and aliases */ list = str_list_create (_(resize_msg_start), NULL); first = 1; @@ -2091,6 +2111,17 @@ _init_messages () str_list_append (list, ", "); str_list_append (list, fs_type->name); } + for (fs_alias = ped_file_system_alias_get_next (NULL); + fs_alias; fs_alias = ped_file_system_alias_get_next (fs_alias)) { + if (fs_alias->fs_type->ops->resize == NULL) + continue; + + if (first) + first = 0; + else + str_list_append (list, ", "); + str_list_append (list, fs_alias->alias); + } str_list_append (list, "\n"); resize_fs_type_msg = str_list_convert (list); diff --git a/parted/ui.c b/parted/ui.c index 7b2a248..f50536c 100644 --- a/parted/ui.c +++ b/parted/ui.c @@ -1347,6 +1347,7 @@ static int init_fs_type_str () { PedFileSystemType* walk; + PedFileSystemAlias* alias_walk; fs_type_list = NULL; @@ -1357,6 +1358,14 @@ init_fs_type_str () if (!fs_type_list) return 0; } + for (alias_walk = ped_file_system_alias_get_next (NULL); alias_walk; + alias_walk = ped_file_system_alias_get_next (alias_walk)) + { + fs_type_list = str_list_insert (fs_type_list, + alias_walk->alias); + if (!fs_type_list) + return 0; + } return 1; } |