summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisk.c
diff options
context:
space:
mode:
authorDavid Miller2007-06-30 00:50:21 +0200
committerKarel Zak2007-07-02 14:41:36 +0200
commit899736f12f276341294145f464dcc988cd94cb97 (patch)
treeb1518e2096c08e5a2eced4162342d62fc1a5c534 /fdisk/fdisk.c
parentionice: fix ionice build on sparc (diff)
downloadkernel-qcow2-util-linux-899736f12f276341294145f464dcc988cd94cb97.tar.gz
kernel-qcow2-util-linux-899736f12f276341294145f464dcc988cd94cb97.tar.xz
kernel-qcow2-util-linux-899736f12f276341294145f464dcc988cd94cb97.zip
fdisk: many significant improvements and fixes to Sun label handling
1) Properly describe the exact layout and fields of the sun disk label. Several fields were incorrectly mentioned and others wrongly sized. 2) Properly set the version, sane, and num_partitions fields. Because we weren't doing this, programs such as Solaris's format and the Solaris kernel itself refused to recognize our disk labels as valid. 3) Move SSWAP*() macros into fdisksunlabel.c as there is no reason for them to be exposed to the rest of fdisk. 4) Kill the sun_predefined_drives array hack and assosciated code. Instead size the disk and figure out the geometry properly just like the SGI and MSDOS partition handling do, by means of the HD_GETGEO ioctl() and disksize(). 5) If the disk label read is found to not have the proper values set in version, sane, or num_partitions, fix them, recompute the label checksum, dirty the disk label, and let the user know what we did and that the fixed values will be written out if they 'w'. This gives users an easy way to fix up disk labels created by disk labelling programs which had this bug. 6) Create a sun_sys_getid() function so that fdisk.c does not need to reference the sun disk label details directly, just like the SGI code does. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r--fdisk/fdisk.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index c4ab6d569..292b7a85e 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -470,7 +470,7 @@ xmenu(void) {
static int
get_sysid(int i) {
return (
- sun_label ? sunlabel->infos[i].id :
+ sun_label ? sun_get_sysid(i) :
sgi_label ? sgi_get_sysid(i) :
ptes[i].part_table->sys_ind);
}
@@ -1178,7 +1178,7 @@ get_partition(int warn, int max) {
if ((!sun_label && !sgi_label && !pe->part_table->sys_ind)
|| (sun_label &&
(!sunlabel->partitions[i].num_sectors ||
- !sunlabel->infos[i].id))
+ !sunlabel->part_tags[i].tag))
|| (sgi_label && (!sgi_get_num_sectors(i)))
)
fprintf(stderr,
@@ -1400,7 +1400,7 @@ change_sysid(void) {
}
if (sys < 256) {
- if (sun_label && i == 2 && sys != WHOLE_DISK)
+ if (sun_label && i == 2 && sys != SUN_TAG_BACKUP)
printf(_("Consider leaving partition 3 "
"as Whole disk (5),\n"
"as SunOS/Solaris expects it and "
@@ -2614,7 +2614,7 @@ main(int argc, char **argv) {
toggle_active(get_partition(1, partitions));
else if (sun_label)
toggle_sunflags(get_partition(1, partitions),
- 0x01);
+ SUN_FLAG_UNMNT);
else if (sgi_label)
sgi_set_bootpartition(
get_partition(1, partitions));
@@ -2638,7 +2638,7 @@ main(int argc, char **argv) {
toggle_dos_compatibility_flag();
else if (sun_label)
toggle_sunflags(get_partition(1, partitions),
- 0x10);
+ SUN_FLAG_RONLY);
else if (sgi_label)
sgi_set_swappartition(
get_partition(1, partitions));