[parted-devel] Strange linux-swap name change

Colin Watson cjwatson at ubuntu.com
Thu Jun 18 12:52:06 UTC 2009


This might be a bit more controversial than my last linux-swap patch.
:-)


I just noticed due to a comment from Otavio Salvador that linux-swap had
its name changed to "linux-swap(new)" a while back. I know this was ages
ago (January 2007!), but I'd like to suggest that this was poorly
designed, for the following reasons:

Firstly, "old" and "new" is never a good way to name anything. When a
third format comes along, you either have to rename things or you have
to cope with "new" not being current any more. I used to live in a place
called "New Court" which was built in the early 19th century. :-) There
are perfectly good version numbers for the swap formats, 0 and 1 - why
not use them?

Secondly, according to mkswap(8) swap v0 has not been supported since
Linux 2.5.22, and swap v1 has been supported since 2.1.117. In other
words, just about the entire Linux planet is using swap v1 now. It seems
wrong to make them all type "(new)" as a sort of code for "the one that
actually works".

Thirdly, even if you want to call the current swap format something
other than "linux-swap", it would be most convenient if "linux-swap"
were supported for input. I suppose this means that people using
libparted still have to cope with the new name on output (?), but even
so it would be useful.

Fourthly, linux_swap.c calls the formats "swap_v1" and "swap_v2" in its
function names, but mkswap uses the options -v0 and -v1 and calls the
versions thus. This seems eccentric.


I think this should be fixed before a 1.9.0 release, before people start
depending on the new behaviour too much.

How about the attached patch? Supporting alternative names for file
systems is a little bit tricky, because you don't want to probe the file
system once for each name (not only is it inefficient, but it confuses
_best_match something rotten). I added a new PedFileSystemAlias
structure so that we can register alternative names outside of the main
list of file system types.

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]


More information about the parted-devel mailing list