Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gptfdisk
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
gptfdisk
Commits
ea17cffd
Commit
ea17cffd
authored
15 years ago
by
srs5694
Browse files
Options
Downloads
Patches
Plain Diff
Added two new project files
parent
3b29c89b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
partnotes.cc
+709
-0
709 additions, 0 deletions
partnotes.cc
partnotes.h
+101
-0
101 additions, 0 deletions
partnotes.h
with
810 additions
and
0 deletions
partnotes.cc
0 → 100644
+
709
−
0
View file @
ea17cffd
This diff is collapsed.
Click to expand it.
partnotes.h
0 → 100644
+
101
−
0
View file @
ea17cffd
/*
partnotes.h -- Class that takes notes on GPT partitions for purpose of MBR conversion
Copyright (C) 2010 Roderick W. Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __PARTNOTES_H
#define __PARTNOTES_H
#include
"gpt.h"
#include
"gptpart.h"
using
namespace
std
;
#define WILL_NOT_CONVERT 0
#define PRIMARY 1
#define LOGICAL 2
// Data structure used in GPT-to-MBR conversions; holds pointer to GPT
// partition number, start and end sectors, and a few MBR-specific details
struct
PartInfo
{
int
gptPartNum
;
int
spaceBefore
;
// boolean; if 1, can theoretically become a logical part.
int
active
;
// boolean
int
type
;
// WILL_NOT_CONVERT, PRIMARY, or LOGICAL
uint64_t
firstLBA
;
uint64_t
lastLBA
;
unsigned
int
hexCode
;
struct
PartInfo
*
next
;
};
struct
ExtendedInfo
{
int
startNum
;
int
numLogicals
;
};
class
PartNotes
{
protected:
struct
PartInfo
dummyNote
;
struct
PartInfo
*
notes
;
struct
PartInfo
*
currentNote
;
int
currentIndex
;
GPTPart
*
gptParts
;
int
gptTableSize
;
int
blockSize
;
void
DeleteNotes
(
void
);
public:
PartNotes
();
PartNotes
(
GPTPart
*
parts
,
GPTData
*
gpt
,
int
num
,
int
blockSize
);
~
PartNotes
();
// Add partition notes (little or no error checking)
int
PassPartitions
(
GPTPart
*
parts
,
GPTData
*
gpt
,
int
num
,
int
blockSize
);
int
AddToEnd
(
struct
PartInfo
*
newOne
);
int
AddToStart
(
struct
PartInfo
*
newOne
);
void
SetType
(
int
partNum
,
int
type
);
// type is PRIMARY, LOGICAL, or WILL_NOT_CONVERT
void
SetMbrHexType
(
int
i
,
uint8_t
type
);
void
ToggleActiveStatus
(
int
partNum
);
// Retrieve data or metadata
void
Rewind
(
void
);
int
GetNextInfo
(
struct
PartInfo
*
info
);
int
GetNumParts
();
int
GetNumPrimary
();
int
GetNumExtended
();
int
GetNumLogical
();
int
GetType
(
int
partNum
);
uint8_t
GetMbrHexType
(
int
i
);
int
GetGptNum
(
int
partNum
);
int
GetActiveStatus
(
int
partNum
);
int
CanBeLogical
(
int
partNum
);
// returns boolean
int
FindExtended
(
int
&
start
);
int
IsSorted
(
void
);
int
IsLegal
(
void
);
// returns boolean
// Manipulate data or metadata
int
MakeItLegal
(
void
);
void
TrimSmallestExtended
(
void
);
// Interact with users, possibly changing data with error handling
void
ShowSummary
(
void
);
int
MakeChange
(
int
partNum
);
int
ChangeType
(
int
partNum
,
int
newType
);
};
#endif // __PARTNOTES_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment