Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=be6a926ff2b37a0bcfcb8643afa9d87d181ac4fc
commit be6a926ff2b37a0bcfcb8643afa9d87d181ac4fc Author: James Buren <[email protected]> Date: Sat Aug 25 15:57:57 2012 -0500 add functions to setting a partition's type via a generic "purpose" string diff --git a/DosPartition.hh b/DosPartition.hh index 53f3056..d880cd5 100644 --- a/DosPartition.hh +++ b/DosPartition.hh @@ -10,8 +10,43 @@ public: virtual ~DosPartition() { } void setType(unsigned char type) { _dos_type = type; } virtual void setActive(bool active) { _dos_active = active; } + virtual void setPurpose(string purpose) + { + if(purpose == "extended") + _dos_type = 0x05; + else if(purpose == "efi") + _dos_type = 0xEF; + else if(purpose == "data") + _dos_type = 0x83; + else if(purpose == "swap") + _dos_type = 0x82; + else if(purpose == "raid") + _dos_type = 0xFD; + else if(purpose == "lvm") + _dos_type = 0x8E; + } unsigned char getType() { return _dos_type; } virtual bool getActive() { return _dos_active; } + virtual string getPurpose() + { + switch(_dos_type) + { + case 0x05: + return "extended"; + case 0xEF: + return "efi"; + case 0x83: + return "data"; + case 0x82: + return "swap"; + case 0xFD: + return "raid"; + case 0x8E: + return "lvm"; + default: + return "unknown"; + } + } protected: unsigned char _dos_type; diff --git a/Partition.hh b/Partition.hh index 94567db..4ffd7cc 100644 --- a/Partition.hh +++ b/Partition.hh @@ -15,11 +15,13 @@ public: void setEnd(unsigned long long end) { _end = end; } void setSectors(unsigned long long sectors) { _sectors = sectors; } virtual void setActive(bool active) { } + virtual void setPurpose(string purpose) { } unsigned long long getNumber() { return _number; } unsigned long long getStart() { return _start; } unsigned long long getEnd() { return _end; } unsigned long long getSectors() { return _sectors; } virtual bool getActive() { return true; } + virtual string getPurpose() { return ""; } protected: unsigned long long _number; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
