3
* (C) Copyright IBM Corp. 2001, 2003
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13
* the GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37
#include "solarisX86.h"
39
static int DisplayDiskSeg( DISKSEG *seg )
47
u_int32_t SectorCount;
48
SEG_PRIVATE_DATA *pdata;
53
pdata = (SEG_PRIVATE_DATA *) seg->private_data;
55
StartLBA = seg->start;
56
EndLBA = seg->start + seg->size -1;
57
SectorCount = seg->size;
61
strncpy(Name, seg->name, EVMS_NAME_SIZE );
68
if ( pdata->boot_ind & ACTIVE_PARTITION ) strcpy(Boot," * ");
70
switch (seg->data_type) {
72
if ( pdata->flags & SEG_IS_EBR )
73
strcpy(Type, "Meta Data: EBR");
74
else if ( pdata->flags & SEG_IS_MBR )
75
strcpy(Type, "Meta Data: MBR");
77
strcpy(Type, "Meta Data");
81
if ( pdata->flags & SEG_IS_LINUX_SWAP_PARTITION)
82
strcpy(Type, "Data Seg: Linux Swap");
84
strcpy(Type, "Data Seg");
88
strcpy(Type, "Free Space");
92
strcpy(Type, "Unknown ");
96
LOG_DEBUG("%-20s %-4s %02X %08d %08d %08d %s\n", Type, Boot, Id, StartLBA, EndLBA, SectorCount, Name);
107
void DisplayDiskSegmentList(LOGICALDISK *ld)
112
if (ld==NULL) return;
113
if (ld->parent_objects==NULL) return;
116
LOG_DEBUG("\t\tLogical Disk Segment List ... \n");
117
LOG_DEBUG("Type Boot Id Start LBA End LBA Sectors SegName\n");
119
LIST_FOR_EACH( ld->parent_objects, iter, seg ) {
126
void DisplayPartitionRecord( Partition_Record *part ,
128
boolean logical_partition )
135
u_int32_t SectorCount;
139
StartLBA = (u_int32_t) DISK_TO_CPU32(START_LBA(part));
140
EndLBA = (u_int32_t) DISK_TO_CPU32(START_LBA(part))+DISK_TO_CPU32(NR_SECTS(part));
141
SectorCount = DISK_TO_CPU32(NR_SECTS(part));
144
if (EndLBA) --EndLBA;
146
if (BOOT_IND(part)) strcpy(Boot," * ");
150
case OPENBSD_PARTITION:
151
case FREEBSD_PARTITION:
152
case NETBSD_PARTITION:
156
case LINUX_SWAP_PARTITION:
157
strcpy(Type, "Linux Swap/Solaris");
159
case LINUX_RAID_PARTITION:
160
strcpy(Type, "Linux RAID");
162
case LINUX_LVM_PARTITION:
163
strcpy(Type, "Linux LVM");
165
case LINUX_EXT2_PARTITION:
166
strcpy(Type, "Linux");
168
case LINUX_EXTENDED_PARTITION:
169
strcpy(Type, "Linux Extd");
171
case UNIXWARE_PARTITION:
172
strcpy(Type, "UnixWare");
174
case DOS_EXTENDED_PARTITION:
175
strcpy(Type, "DOS Extd");
177
case WIN98_EXTENDED_PARTITION:
178
strcpy(Type, "Win95 Extd");
180
case HPFSNTFS_PARTITION:
181
strcpy(Type, "Hpfs/Ntfs");
183
case HIDDEN_OS2_PARTITION:
184
strcpy(Type, "OS2 Hidden C");
186
case OS2_BOOT_MGR_PARTITION:
187
strcpy(Type,"OS2 Boot Mgr");
189
case OS2_LVM_SIGNATURE_PARTITION:
190
strcpy(Type,"OS2 LVM");
192
case HIDDEN_OS2_LVM_SIGNATURE_PARTITION:
193
strcpy(Type,"OS2 Hidden LVM");
195
case SMALL_FAT16_PARTITION:
196
case LARGE_FAT16_PARTITION:
197
strcpy(Type,"FAT16");
199
case UNUSED_PARTITION_ENTRY:
200
strcpy(Type, "Unused Entry");
202
case GPT_ENTIRE_DISK_PARTITION:
203
strcpy(Type, "GPT-ENTIRE-DISK");
205
case GPT_ESP_PARTITION:
206
strcpy(Type, "GPT-ESP");
213
LOG_DEBUG("%-20s %-4s %02X %08d %08d %08d\n", Type, Boot, Id, StartLBA, EndLBA, SectorCount);
217
void DisplayPartitionTable(LOGICALDISK *ld, Partition_Record *partptr , boolean mbr)
220
Partition_Record *part = partptr;
224
LOG_DEBUG("\t\tMaster Boot Record \n");
226
LOG_DEBUG("\t\tExtended Boot Record\n");
228
LOG_DEBUG("Type Boot Id Start LBA End LBA Sectors\n");
230
for (i=0; i<4; i++) {
233
DisplayPartitionRecord( part, i, FALSE );
235
DisplayPartitionRecord( part, i, TRUE );