From 49de9c7010421a7dc665c93e5f8692ecffcd9845 Mon Sep 17 00:00:00 2001 From: Erik Troan Date: Tue, 17 Aug 1999 20:48:52 +0000 Subject: added generic partition types --- balkan/balkan.h | 4 ++++ balkan/dos.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'balkan') diff --git a/balkan/balkan.h b/balkan/balkan.h index 905047c9d..c4fe75fa4 100644 --- a/balkan/balkan.h +++ b/balkan/balkan.h @@ -5,6 +5,10 @@ #define BALKAN_ERROR_BADMAGIC 2 #define BALKAN_ERROR_BADTABLE 3 +#define BALKAN_PART_DOS 1 +#define BALKAN_PART_EXT2 2 +#define BALKAN_PART_OTHER 3 + struct partition { long startSector; long size; /* in sectors */ diff --git a/balkan/dos.c b/balkan/dos.c index 687756489..8cfeadda0 100644 --- a/balkan/dos.c +++ b/balkan/dos.c @@ -105,7 +105,7 @@ static int readNextTable(int fd, struct partitionTable * table, int nextNum, } int dospReadTable(int fd, struct partitionTable * table) { - int i; + int i, rc; table->maxNumPartitions = 16; @@ -114,7 +114,35 @@ int dospReadTable(int fd, struct partitionTable * table) { table->sectorSize = SECTOR_SIZE; - return readNextTable(fd, table, 0, 0, 0); + rc = readNextTable(fd, table, 0, 0, 0); + + if (!rc) { + for (i = 0; i < 16; i++) { + if (table->parts[i].type == -1) continue; + + switch (table->parts[i].type) { + case 0x01: + case 0x04: + case 0x06: + case 0x0b: + case 0x0c: + case 0x0e: + case 0x0f: + table->parts[i].type = BALKAN_PART_DOS; + break; + + case 0x83: + table->parts[i].type = BALKAN_PART_EXT2; + break; + + default: + table->parts[i].type = BALKAN_PART_OTHER; + break; + } + } + } + + return rc; } #ifdef STANDALONE_TEST -- cgit