On Thu, May 07, 2009 at 06:34:29PM +0200, Zdenek Behan wrote: > To make things short, after trying several different approaches, I ended > up writing my own tiny utility that has as little functionality as > needed for my exact need, but is able to create the GPT partition > tables. That was mostly due to time constraints, because i already spent > quite too much time dealing with the issue. However, for this kind of > task, the perfect, most flexible, most simple, and scriptable tool still > seems to be fdisk (and its variants), if it wasn't for the fact that it > cannot create GPT headers, so IMO "fixing" fdisk is the right way to go. Yes, it would be nice to have GPT support in fdisk(s). <joke> Do you want to kill GNU Parted? Add GPT support to fdisk! </joke> > GNU parted was way too bloated for my taste and for embedded use with > its filesystem support, and it kept malfunctioning on arm machines. Unfortunately, it seems that parted upstream is not ready to remove FS-specific code from libparted. Reality is that many people don't like this library now. > To do things the clean way, the initial task is a massive > cleanup/refactoring of the code, in some parts possibly even > rewrite. Yes, the code it terrible. We need lightweight library for disk labels reading -- now we duplicate PT parsing code in kpartx, partx, fdisks, libdisk and HAL (and in Linux kernel;-) My suggestion: 1) write "libptread" library - use the library in partx-like programs and HAL - remove libdisk from xfsprogs - use the library in fdisks 2) write "libptwrite" library (with functionality like add_partition, remove_partition, ...) - use the library in fdisks The "libptread" is more important for us now. > 1) Most of the fdisk code is based around MSDOS partitioning scheme. [...] > 2) Separating disk-independent and disk-dependent utilities [...] > 3) Error reporting/handling [...] > 4) Global variables [...] > 5) Unified label handling between *fdisk I think fdisk code could be refactored in parallel to work on the libs. But don't forget to use small easy-to-review patches. Karel -- Karel Zak <kzak@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html