0.8.6 release.

This commit is contained in:
srs5694
2013-01-09 12:55:40 -05:00
parent d8eed46294
commit 0741fa21ac
16 changed files with 131 additions and 86 deletions

View File

@@ -18,7 +18,7 @@ gdisk: $(LIB_OBJS) gpttext.o gdisk.o
# $(CXX) $(LIB_OBJS) -L/usr/lib -licucore gpttext.o gdisk.o -o gdisk
cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -lncurses -o sgdisk
$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -lncurses -o cgdisk
# $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licucore -lncurses -o cgdisk
sgdisk: $(LIB_OBJS) gptcl.o sgdisk.o

9
NEWS
View File

@@ -1,5 +1,10 @@
0.8.6 (?/??/2012):
------------------
0.8.6 (1/9/2013):
-----------------
- Fixed a bug that could cause sgdisk to crash when passing a partition
number of 0 to the -t option.
- Added support for building under Solaris.
- Added a new check to the verification code.

40
README
View File

@@ -78,7 +78,7 @@ sgdisk include:
access up to three GPT partitions on the disk (gdisk and sgdisk only)
Of course, GPT fdisk isn't without its limitations. Most notably, it lacks
the filesystem awareness and filesystem-related features of GNU Parted. You
the filesystem awareness and filesystem-related features of GParted. You
can't resize a partition's filesystem or create a partition with a
filesystem already in place with gdisk, for instance. There's no GUI
version of gdisk.
@@ -166,10 +166,10 @@ installed, most notably the GNU Compiler Collection (GCC) and its g++
compiler for C++. (Under Windows, Microsoft Visual C++ 2008 can also be
used.) In addition, note these requirements:
* On Linux, FreeBSD, and OS X, libuuid must be installed. This is the
standard for Linux and OS X, although you may need to install a package
called uuid-dev or something similar to get the headers. On FreeBSD, the
e2fsprogs-libuuid port must be installed.
* On Linux, FreeBSD, OS X, and Solaris, libuuid must be installed. This is
the standard for Linux and OS X, although you may need to install a
package called uuid-dev or something similar to get the headers. On
FreeBSD, the e2fsprogs-libuuid port must be installed.
* The ICU library (http://site.icu-project.org), which provides support for
Unicode partition names, is recommended on all
@@ -180,7 +180,9 @@ used.) In addition, note these requirements:
"-D USE_UTF16" part from the CXXFLAGS line and remove references to
-licuio, -licuuc, -licudata, and -licucore (details vary between
platforms) from the compilation options. Suitable lines are present, but
commented out, in the Makefile, Makefile.mac, and Makefile.bsd files.
commented out, in the Makefile, Makefile.solaris, Makefile.freebsd files.
Because of problems with ICU under OS X, the Makefile.mac file doesn't
build against ICU by default.
* The cgdisk program requires the ncurses library and its development files
(headers). Most Linux distributions install ncurses by default, but you
@@ -205,16 +207,16 @@ used.) In addition, note these requirements:
When all the necessary development tools and libraries are installed, you
can uncompress the package and type "make" at the command prompt in the
resulting directory. (You may need to type "make -f Makefile.mac" on Mac OS
X, "make -f Makefile.freebsd" on FreeBSD, or "make -f Makefile.mingw" to
compile using MinGW for Windows.) You may also need to add header (include)
directories or library directories by setting the CXXFLAGS environment
variable or by editing the Makefile. The result should be program files
called gdisk, sgdisk, and fixparts. Typing "make gdisk", "make cgdisk",
"make sgdisk", or "make fixparts" will compile only the requested programs.
You can use these programs in place or copy the files to a suitable
directory, such as /usr/local/sbin. You can copy the man pages (gdisk.8,
cgdisk.8, sgdisk.8, and fixparts.8) to /usr/local/man/man8 to make them
available.
X, "make -f Makefile.freebsd" on FreeBSD, "make -f Makefile.solaris" on
Solaris, or "make -f Makefile.mingw" to compile using MinGW for Windows.)
You may also need to add header (include) directories or library
directories by setting the CXXFLAGS environment variable or by editing the
Makefile. The result should be program files called gdisk, cgdisk, sgdisk,
and fixparts. Typing "make gdisk", "make cgdisk", "make sgdisk", or "make
fixparts" will compile only the requested programs. You can use these
programs in place or copy the files to a suitable directory, such as
/usr/local/sbin. You can copy the man pages (gdisk.8, cgdisk.8, sgdisk.8,
and fixparts.8) to /usr/local/man/man8 to make them available.
Caveats
-------
@@ -230,9 +232,9 @@ virtual QEMU and VirtualBox disks. I've received user reports of success with
RAID arrays over 2TiB in size, though.
My main development platform is a system running the 64-bit version of
Gentoo Linux (previously Ubuntu 8.04). I've also tested on several other
32- and 64-bit Linux distributions, Intel-based Mac OS X 10.5 and 10.6,
64-bit FreeBSD 7.1, and Windows 7.
Gentoo Linux. I've also tested on several other 32- and 64-bit Linux
distributions, Intel-based Mac OS X 10.5 and 10.6, 64-bit FreeBSD 7.1, and
Windows 7.
Redistribution
--------------

View File

@@ -1,6 +1,6 @@
.\" Copyright 2011, 2012 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
.TH "CGDISK" "8" "0.8.5" "Roderick W. Smith" "GPT fdisk Manual"
.TH "CGDISK" "8" "0.8.6" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
cgdisk \- Curses-based GUID partition table (GPT) manipulator
.SH "SYNOPSIS"
@@ -268,7 +268,7 @@ Write data. Use this command to save your changes.
.SH "BUGS"
As of May 2012 (version 0.8.5), \fBcgdisk\fR should be considered
As of January 2013 (version 0.8.6), \fBcgdisk\fR should be considered
beta software. Although the underlying partition manipulation code is much
older, the \fBcgdisk\fR ncurses user interface is brand new with GPT fdisk
version 0.8.0. Known bugs and limitations include:

View File

@@ -1,11 +1,11 @@
Summary: GPT partitioning and MBR repair software
Name: gptfdisk
Version: 0.8.5
Version: 0.8.6
Release: 1%{?dist}
License: GPLv2
URL: http://www.rodsbooks.com/gdisk
Group: Applications/System
Source: http://www.rodsbooks.com/gdisk/gptfdisk-0.8.5.tar.gz
Source: http://www.rodsbooks.com/gdisk/gptfdisk-0.8.6.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%description
@@ -80,5 +80,5 @@ provides a few additional partition manipulation features.
%changelog
* Wed May 30 2012 R Smith <rodsmith@rodsbooks.com> - 0.8.5
- Created spec file for 0.8.5 release
* Wed Jan 9 2013 R Smith <rodsmith@rodsbooks.com> - 0.8.6
- Created spec file for 0.8.6 release

View File

@@ -132,6 +132,9 @@ void DiskIO::Close(void) {
// (512). If the disk can't be opened at all, return a value of 0.
int DiskIO::GetBlockSize(void) {
int err = -1, blockSize = 0;
#ifdef __sun__
struct dk_minfo minfo;
#endif
// If disk isn't open, try to open it....
if (!isOpen) {
@@ -142,6 +145,11 @@ int DiskIO::GetBlockSize(void) {
#ifdef __APPLE__
err = ioctl(fd, DKIOCGETBLOCKSIZE, &blockSize);
#endif
#ifdef __sun__
err = ioctl(fd, DKIOCGMEDIAINFO, &minfo);
if (err == 0)
blockSize = minfo.dki_lbsize;
#endif
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
err = ioctl(fd, DIOCGSECTORSIZE, &blockSize);
#endif
@@ -217,13 +225,17 @@ int DiskIO::DiskSync(void) {
if (isOpen) {
sync();
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__sun__)
cout << "Warning: The kernel may continue to use old or deleted partitions.\n"
<< "You should reboot or remove the drive.\n";
/* don't know if this helps
* it definitely will get things on disk though:
* http://topiks.org/mac-os-x/0321278542/ch12lev1sec8.html */
#ifdef __sun__
i = ioctl(fd, DKIOCFLUSHWRITECACHE);
#else
i = ioctl(fd, DKIOCSYNCHRONIZECACHE);
#endif
platformFound++;
#endif
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
@@ -377,6 +389,9 @@ uint64_t DiskIO::DiskSize(int *err) {
off_t bytes = 0; // size in bytes
struct stat64 st;
int platformFound = 0;
#ifdef __sun__
struct dk_minfo minfo;
#endif
// If disk isn't open, try to open it....
if (!isOpen) {
@@ -393,6 +408,12 @@ uint64_t DiskIO::DiskSize(int *err) {
*err = ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors);
platformFound++;
#endif
#ifdef __sun__
*err = ioctl(fd, DKIOCGMEDIAINFO, &minfo);
if (*err == 0)
sectors = minfo.dki_capacity;
platformFound++;
#endif
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
*err = ioctl(fd, DIOCGMEDIASIZE, &bytes);
long long b = GetBlockSize();

View File

@@ -25,6 +25,10 @@
#include <sys/ioctl.h>
#endif
#ifdef __sun__
#include <sys/dkio.h>
#endif
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
#define fstat64 fstat
#define stat64 stat

View File

@@ -1,6 +1,6 @@
.\" Copyright 2011, 2012 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
.TH "FIXPARTS" "8" "0.8.5" "Roderick W. Smith" "FixParts Manual"
.TH "FIXPARTS" "8" "0.8.6" "Roderick W. Smith" "FixParts Manual"
.SH "NAME"
fixparts \- MBR partition table repair utility
.SH "SYNOPSIS"
@@ -202,7 +202,7 @@ see a summary of available options.
.PP
.SH "BUGS"
As of May 2012 (version 0.8.5), \fBfixparts\fR
As of January 2013 (version 0.8.6), \fBfixparts\fR
should be considered beta software. Known bugs and limitations include:
.TP

View File

@@ -1,6 +1,6 @@
.\" Copyright 2011, 2012 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
.TH "GDISK" "8" "0.8.5" "Roderick W. Smith" "GPT fdisk Manual"
.TH "GDISK" "8" "0.8.6" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
gdisk \- Interactive GUID partition table (GPT) manipulator
.SH "SYNOPSIS"
@@ -561,7 +561,7 @@ entering data. When only one option is possible, \fBgdisk\fR
usually bypasses the prompt entirely.
.SH "BUGS"
As of May 2012 (version 0.8.5), \fBgdisk\fR
As of January 2013 (version 0.8.6), \fBgdisk\fR
should be considered beta software. Known bugs and limitations include:
.TP

10
gpt.cc
View File

@@ -261,10 +261,10 @@ int GPTData::Verify(void) {
if ((mainHeader.lastUsableLBA >= diskSize) || (mainHeader.lastUsableLBA > mainHeader.backupLBA)) {
problems++;
cout << "\nProblem: GPT claims the disk is larger than it is!\n";
cout << "(Claimed last usable sector is " << mainHeader.lastUsableLBA << ", but\n";
cout << "backup header is at " << mainHeader.backupLBA << " and disk size is\n";
cout << diskSize << "sectors\n";
cout << "\nProblem: GPT claims the disk is larger than it is! (Claimed last usable\n"
<< "sector is " << mainHeader.lastUsableLBA << ", but backup header is at\n"
<< mainHeader.backupLBA << " and disk size is " << diskSize << " sectors.\n"
<< "The 'e' option on the experts' menu will probably fix this problem\n";
}
// Check for overlapping partitions....
@@ -1741,7 +1741,7 @@ uint32_t GPTData::CreatePartition(uint32_t partNum, uint64_t startSector, uint64
if (FindLastInFree(startSector) >= endSector) {
partitions[partNum].SetFirstLBA(startSector);
partitions[partNum].SetLastLBA(endSector);
partitions[partNum].SetType(DEFAULT_TYPE);
partitions[partNum].SetType(DEFAULT_GPT_TYPE);
partitions[partNum].RandomizeUniqueGUID();
} else retval = 0; // if free space until endSector
} else retval = 0; // if startSector is free

View File

@@ -49,7 +49,7 @@ void GPTDataCL::LoadBackupFile(string backupFile, int &saveData, int &neverSaveD
neverSaveData = 1;
cerr << "Error loading backup file!\n";
} // else
} //
} // GPTDataCL::LoadBackupFile()
// Perform the actions specified on the command line. This is necessarily one
// monster of a function!
@@ -64,7 +64,6 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
GPTData secondDevice;
int opt, numOptions = 0, saveData = 0, neverSaveData = 0;
int partNum = 0, saveNonGPT = 1, retval = 0, pretend = 0;
uint32_t gptPartNum = 0;
uint64_t low, high, startSector, endSector, sSize;
uint64_t temp; // temporary variable; free to use in any case
char *device;
@@ -194,6 +193,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
case 'c':
JustLooking(0);
partNum = (int) GetInt(partName, 1) - 1;
if ((partNum >= 0) && (partNum < (int) GetNumParts())) {
name = GetString(partName, 2);
if (SetName(partNum, (UnicodeString) name.c_str())) {
saveData = 1;
@@ -203,6 +203,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
neverSaveData = 1;
} // if/else
free(partName);
}
break;
case 'C':
JustLooking(0);
@@ -348,6 +349,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
case 't':
JustLooking(0);
partNum = (int) GetInt(typeCode, 1) - 1;
if ((partNum >= 0) && (partNum < (int) GetNumParts())) {
typeHelper = GetString(typeCode, 2);
if ((typeHelper != (GUIDData) "00000000-0000-0000-0000-000000000000") &&
(ChangePartType(partNum, typeHelper))) {
@@ -358,6 +360,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
neverSaveData = 1;
} // if/else
free(typeCode);
}
break;
case 'T':
JustLooking(0);
@@ -367,8 +370,10 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
case 'u':
JustLooking(0);
saveData = 1;
gptPartNum = (int) GetInt(partGUID, 1) - 1;
SetPartitionGUID(gptPartNum, GetString(partGUID, 2).c_str());
partNum = (int) GetInt(partGUID, 1) - 1;
if ((partNum >= 0) && (partNum < (int) GetNumParts())) {
SetPartitionGUID(partNum, GetString(partGUID, 2).c_str());
}
break;
case 'U':
JustLooking(0);

View File

@@ -219,7 +219,9 @@ void GPTDataCurses::IdentifySpaces(void) {
Space* GPTDataCurses::ShowSpace(int spaceNum, int lineNum) {
Space *space;
int i = 0;
#ifdef USE_UTF16
char temp[40];
#endif
space = firstSpace;
while ((space != NULL) && (i < spaceNum)) {
@@ -308,7 +310,9 @@ void GPTDataCurses::DeletePartition(int partNum) {
// Displays information on the specified partition
void GPTDataCurses::ShowInfo(int partNum) {
uint64_t size;
#ifdef USE_UTF16
char temp[NAME_SIZE / 2 + 1];
#endif
clear();
move(2, (COLS - 29) / 2);

View File

@@ -277,13 +277,13 @@ void GPTPart::ChangeType(void) {
cout << "Current type is '" << GetTypeName() << "'\n";
do {
cout << "Hex code or GUID (L to show codes, Enter = " << hex << DEFAULT_TYPE << dec << "): ";
cout << "Hex code or GUID (L to show codes, Enter = " << hex << DEFAULT_GPT_TYPE << dec << "): ";
line = ReadString();
if ((line[0] == 'L') || (line[0] == 'l')) {
partitionType.ShowAllTypes();
} else {
if (line.length() == 0)
tempType= DEFAULT_TYPE;
tempType = DEFAULT_GPT_TYPE;
else
tempType = line;
} // if/else

View File

@@ -259,7 +259,7 @@ PartType & PartType::operator=(uint16_t ID) {
} // while
if (!found) {
// Assign a default value....
operator=(DEFAULT_TYPE);
operator=(DEFAULT_GPT_TYPE);
cout.setf(ios::uppercase);
cout.fill('0');
cout << "Exact type match not found for type code ";

View File

@@ -1,6 +1,6 @@
.\" Copyright 2011, 2012 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
.TH "SGDISK" "8" "0.8.5" "Roderick W. Smith" "GPT fdisk Manual"
.TH "SGDISK" "8" "0.8.6" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix
.SH "SYNOPSIS"
@@ -490,7 +490,7 @@ sgdisk, but may with gdisk)
Disk replication operation (-R) failed
.SH "BUGS"
As of May 2012 (version 0.8.5), \fBsgdisk\fR
As of January 2013 (version 0.8.6), \fBsgdisk\fR
should be considered beta software. Known bugs and limitations include:
.TP

View File

@@ -8,7 +8,7 @@
#ifndef __GPTSUPPORT
#define __GPTSUPPORT
#define GPTFDISK_VERSION "0.8.5.4"
#define GPTFDISK_VERSION "0.8.6"
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
// Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
@@ -17,15 +17,19 @@
#endif
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
#define DEFAULT_TYPE 0xA503
#define DEFAULT_GPT_TYPE 0xA503
#endif
#ifdef __APPLE__
#define DEFAULT_TYPE 0xAF00
#define DEFAULT_GPT_TYPE 0xAF00
#endif
#ifdef _WIN32
#define DEFAULT_TYPE 0x0700
#define DEFAULT_GPT_TYPE 0x0700
#endif
#ifdef __sun__
#define DEFAULT_GPT_TYPE 0xbf01
#endif
// Microsoft Visual C++ only
@@ -38,11 +42,11 @@
// Linux only....
#ifdef __linux__
#include <linux/fs.h>
#define DEFAULT_TYPE 0x8300
#define DEFAULT_GPT_TYPE 0x8300
#endif
#ifndef DEFAULT_TYPE
#define DEFAULT_TYPE 0x8300
#ifndef DEFAULT_GPT_TYPE
#define DEFAULT_GPT_TYPE 0x8300
#endif
// Set this as a default