summaryrefslogtreecommitdiffstats
path: root/fdisk/fdiskaixlabel.c
Commit message (Collapse)AuthorAgeFilesLines
* build-sys: rename fdisk -> fdisks/, convert to moduleKarel Zak2012-06-261-67/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: API: add geometryDavidlohr Bueso2012-06-211-1/+1
| | | | | | | | | | | Add device geometry to the fdisk API. While it maintains traditional behaviour, the cylinders are changed to sector_t instead of unsigned int in order to avoid dealing with truncated cylinders. A new helper is added to compute the amount of cylinders based on the heads and sectors - if a user passed -H or -S to the program, it must call this function to update the corresponding values. This patch passes regression tests. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: API: add mbrDavidlohr Bueso2012-06-211-5/+6
| | | | | | | | | | | | This patch adds to the fdisk API the relevant logic to buffers that have MBR. This also serves for future GPT support for the protective MBR. All labels have been updated to have access to the cxt structure for the corresponding buffer. An important observation is that SGI no longer uses the standard qsort(3) function to sort partitions, as it needs access to cxt. To address this, a heap sort implementation from the kernel was added to the label code and adapted to fdisk. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: use a single variable for the current disklabelFrancesco Cosoleto2011-07-111-4/+1Star
| | | | | | | | | | | | Using a variable for each supported partition table type doesn't seem necessary. This fixes also a minor bug in switching from SGI label to SUN label: the expert menu isn't available as sgi_label variable remains set to true. Code a bit more clear as *_label names have similarity with names such as "sgilabel", "struct sun_label". Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* fdisk: fix strict-aliasing bugsKarel Zak2009-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc 4.4 produces tons of "dereferencing type-punned pointer will break strict-aliasing rules" warnings for fdisk code where is char buffer[BUFSIZ]; ((struct disklabel *) MBRBuffer)->foo There are two ways how fix the problem: 1/ union { char buffer[BUFSIZ], struct disklabel label } MBRBuffer; 2/ use allocated buffer, this way seems less invasive. This patch implements 2/. Old version: $ make -C fdisk | grep -c warning 236 New version: $ make -C fdisk | grep -c warning 0 About aliasing: - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40665 - http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html - C99 Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.12 tarball.Karel Zak2006-12-071-1/+0Star
|
* Imported from util-linux-2.10m tarball.Karel Zak2006-12-071-4/+3Star
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-3/+10
|
* Imported from util-linux-2.9i tarball.Karel Zak2006-12-071-0/+64