0.8.6 release.
This commit is contained in:
@@ -18,7 +18,7 @@ gdisk: $(LIB_OBJS) gpttext.o gdisk.o
|
|||||||
# $(CXX) $(LIB_OBJS) -L/usr/lib -licucore gpttext.o gdisk.o -o gdisk
|
# $(CXX) $(LIB_OBJS) -L/usr/lib -licucore gpttext.o gdisk.o -o gdisk
|
||||||
|
|
||||||
cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
|
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
|
# $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licucore -lncurses -o cgdisk
|
||||||
|
|
||||||
sgdisk: $(LIB_OBJS) gptcl.o sgdisk.o
|
sgdisk: $(LIB_OBJS) gptcl.o sgdisk.o
|
||||||
|
|||||||
9
NEWS
9
NEWS
@@ -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.
|
- Added a new check to the verification code.
|
||||||
|
|
||||||
|
|||||||
40
README
40
README
@@ -78,7 +78,7 @@ sgdisk include:
|
|||||||
access up to three GPT partitions on the disk (gdisk and sgdisk only)
|
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
|
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
|
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
|
filesystem already in place with gdisk, for instance. There's no GUI
|
||||||
version of gdisk.
|
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
|
compiler for C++. (Under Windows, Microsoft Visual C++ 2008 can also be
|
||||||
used.) In addition, note these requirements:
|
used.) In addition, note these requirements:
|
||||||
|
|
||||||
* On Linux, FreeBSD, and OS X, libuuid must be installed. This is the
|
* On Linux, FreeBSD, OS X, and Solaris, libuuid must be installed. This is
|
||||||
standard for Linux and OS X, although you may need to install a package
|
the standard for Linux and OS X, although you may need to install a
|
||||||
called uuid-dev or something similar to get the headers. On FreeBSD, the
|
package called uuid-dev or something similar to get the headers. On
|
||||||
e2fsprogs-libuuid port must be installed.
|
FreeBSD, the e2fsprogs-libuuid port must be installed.
|
||||||
|
|
||||||
* The ICU library (http://site.icu-project.org), which provides support for
|
* The ICU library (http://site.icu-project.org), which provides support for
|
||||||
Unicode partition names, is recommended on all
|
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
|
"-D USE_UTF16" part from the CXXFLAGS line and remove references to
|
||||||
-licuio, -licuuc, -licudata, and -licucore (details vary between
|
-licuio, -licuuc, -licudata, and -licucore (details vary between
|
||||||
platforms) from the compilation options. Suitable lines are present, but
|
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
|
* The cgdisk program requires the ncurses library and its development files
|
||||||
(headers). Most Linux distributions install ncurses by default, but you
|
(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
|
When all the necessary development tools and libraries are installed, you
|
||||||
can uncompress the package and type "make" at the command prompt in the
|
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
|
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
|
X, "make -f Makefile.freebsd" on FreeBSD, "make -f Makefile.solaris" on
|
||||||
compile using MinGW for Windows.) You may also need to add header (include)
|
Solaris, or "make -f Makefile.mingw" to compile using MinGW for Windows.)
|
||||||
directories or library directories by setting the CXXFLAGS environment
|
You may also need to add header (include) directories or library
|
||||||
variable or by editing the Makefile. The result should be program files
|
directories by setting the CXXFLAGS environment variable or by editing the
|
||||||
called gdisk, sgdisk, and fixparts. Typing "make gdisk", "make cgdisk",
|
Makefile. The result should be program files called gdisk, cgdisk, sgdisk,
|
||||||
"make sgdisk", or "make fixparts" will compile only the requested programs.
|
and fixparts. Typing "make gdisk", "make cgdisk", "make sgdisk", or "make
|
||||||
You can use these programs in place or copy the files to a suitable
|
fixparts" will compile only the requested programs. You can use these
|
||||||
directory, such as /usr/local/sbin. You can copy the man pages (gdisk.8,
|
programs in place or copy the files to a suitable directory, such as
|
||||||
cgdisk.8, sgdisk.8, and fixparts.8) to /usr/local/man/man8 to make them
|
/usr/local/sbin. You can copy the man pages (gdisk.8, cgdisk.8, sgdisk.8,
|
||||||
available.
|
and fixparts.8) to /usr/local/man/man8 to make them available.
|
||||||
|
|
||||||
Caveats
|
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.
|
RAID arrays over 2TiB in size, though.
|
||||||
|
|
||||||
My main development platform is a system running the 64-bit version of
|
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
|
Gentoo Linux. I've also tested on several other 32- and 64-bit Linux
|
||||||
32- and 64-bit Linux distributions, Intel-based Mac OS X 10.5 and 10.6,
|
distributions, Intel-based Mac OS X 10.5 and 10.6, 64-bit FreeBSD 7.1, and
|
||||||
64-bit FreeBSD 7.1, and Windows 7.
|
Windows 7.
|
||||||
|
|
||||||
Redistribution
|
Redistribution
|
||||||
--------------
|
--------------
|
||||||
|
|||||||
6
cgdisk.8
6
cgdisk.8
@@ -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
|
.\" 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"
|
.SH "NAME"
|
||||||
cgdisk \- Curses-based GUID partition table (GPT) manipulator
|
cgdisk \- Curses-based GUID partition table (GPT) manipulator
|
||||||
.SH "SYNOPSIS"
|
.SH "SYNOPSIS"
|
||||||
@@ -268,7 +268,7 @@ Write data. Use this command to save your changes.
|
|||||||
|
|
||||||
.SH "BUGS"
|
.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
|
beta software. Although the underlying partition manipulation code is much
|
||||||
older, the \fBcgdisk\fR ncurses user interface is brand new with GPT fdisk
|
older, the \fBcgdisk\fR ncurses user interface is brand new with GPT fdisk
|
||||||
version 0.8.0. Known bugs and limitations include:
|
version 0.8.0. Known bugs and limitations include:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
Summary: GPT partitioning and MBR repair software
|
Summary: GPT partitioning and MBR repair software
|
||||||
Name: gptfdisk
|
Name: gptfdisk
|
||||||
Version: 0.8.5
|
Version: 0.8.6
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: http://www.rodsbooks.com/gdisk
|
URL: http://www.rodsbooks.com/gdisk
|
||||||
Group: Applications/System
|
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)
|
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@@ -80,5 +80,5 @@ provides a few additional partition manipulation features.
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed May 30 2012 R Smith <rodsmith@rodsbooks.com> - 0.8.5
|
* Wed Jan 9 2013 R Smith <rodsmith@rodsbooks.com> - 0.8.6
|
||||||
- Created spec file for 0.8.5 release
|
- Created spec file for 0.8.6 release
|
||||||
|
|||||||
@@ -132,6 +132,9 @@ void DiskIO::Close(void) {
|
|||||||
// (512). If the disk can't be opened at all, return a value of 0.
|
// (512). If the disk can't be opened at all, return a value of 0.
|
||||||
int DiskIO::GetBlockSize(void) {
|
int DiskIO::GetBlockSize(void) {
|
||||||
int err = -1, blockSize = 0;
|
int err = -1, blockSize = 0;
|
||||||
|
#ifdef __sun__
|
||||||
|
struct dk_minfo minfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
// If disk isn't open, try to open it....
|
// If disk isn't open, try to open it....
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
@@ -142,6 +145,11 @@ int DiskIO::GetBlockSize(void) {
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
err = ioctl(fd, DKIOCGETBLOCKSIZE, &blockSize);
|
err = ioctl(fd, DKIOCGETBLOCKSIZE, &blockSize);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __sun__
|
||||||
|
err = ioctl(fd, DKIOCGMEDIAINFO, &minfo);
|
||||||
|
if (err == 0)
|
||||||
|
blockSize = minfo.dki_lbsize;
|
||||||
|
#endif
|
||||||
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
||||||
err = ioctl(fd, DIOCGSECTORSIZE, &blockSize);
|
err = ioctl(fd, DIOCGSECTORSIZE, &blockSize);
|
||||||
#endif
|
#endif
|
||||||
@@ -217,13 +225,17 @@ int DiskIO::DiskSync(void) {
|
|||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
sync();
|
sync();
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) || defined(__sun__)
|
||||||
cout << "Warning: The kernel may continue to use old or deleted partitions.\n"
|
cout << "Warning: The kernel may continue to use old or deleted partitions.\n"
|
||||||
<< "You should reboot or remove the drive.\n";
|
<< "You should reboot or remove the drive.\n";
|
||||||
/* don't know if this helps
|
/* don't know if this helps
|
||||||
* it definitely will get things on disk though:
|
* it definitely will get things on disk though:
|
||||||
* http://topiks.org/mac-os-x/0321278542/ch12lev1sec8.html */
|
* http://topiks.org/mac-os-x/0321278542/ch12lev1sec8.html */
|
||||||
|
#ifdef __sun__
|
||||||
|
i = ioctl(fd, DKIOCFLUSHWRITECACHE);
|
||||||
|
#else
|
||||||
i = ioctl(fd, DKIOCSYNCHRONIZECACHE);
|
i = ioctl(fd, DKIOCSYNCHRONIZECACHE);
|
||||||
|
#endif
|
||||||
platformFound++;
|
platformFound++;
|
||||||
#endif
|
#endif
|
||||||
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
||||||
@@ -377,6 +389,9 @@ uint64_t DiskIO::DiskSize(int *err) {
|
|||||||
off_t bytes = 0; // size in bytes
|
off_t bytes = 0; // size in bytes
|
||||||
struct stat64 st;
|
struct stat64 st;
|
||||||
int platformFound = 0;
|
int platformFound = 0;
|
||||||
|
#ifdef __sun__
|
||||||
|
struct dk_minfo minfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
// If disk isn't open, try to open it....
|
// If disk isn't open, try to open it....
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
@@ -393,6 +408,12 @@ uint64_t DiskIO::DiskSize(int *err) {
|
|||||||
*err = ioctl(fd, DKIOCGETBLOCKCOUNT, §ors);
|
*err = ioctl(fd, DKIOCGETBLOCKCOUNT, §ors);
|
||||||
platformFound++;
|
platformFound++;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __sun__
|
||||||
|
*err = ioctl(fd, DKIOCGMEDIAINFO, &minfo);
|
||||||
|
if (*err == 0)
|
||||||
|
sectors = minfo.dki_capacity;
|
||||||
|
platformFound++;
|
||||||
|
#endif
|
||||||
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
||||||
*err = ioctl(fd, DIOCGMEDIASIZE, &bytes);
|
*err = ioctl(fd, DIOCGMEDIASIZE, &bytes);
|
||||||
long long b = GetBlockSize();
|
long long b = GetBlockSize();
|
||||||
|
|||||||
4
diskio.h
4
diskio.h
@@ -25,6 +25,10 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __sun__
|
||||||
|
#include <sys/dkio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
|
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
|
||||||
#define fstat64 fstat
|
#define fstat64 fstat
|
||||||
#define stat64 stat
|
#define stat64 stat
|
||||||
|
|||||||
@@ -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
|
.\" 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"
|
.SH "NAME"
|
||||||
fixparts \- MBR partition table repair utility
|
fixparts \- MBR partition table repair utility
|
||||||
.SH "SYNOPSIS"
|
.SH "SYNOPSIS"
|
||||||
@@ -202,7 +202,7 @@ see a summary of available options.
|
|||||||
.PP
|
.PP
|
||||||
|
|
||||||
.SH "BUGS"
|
.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:
|
should be considered beta software. Known bugs and limitations include:
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
6
gdisk.8
6
gdisk.8
@@ -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
|
.\" 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"
|
.SH "NAME"
|
||||||
gdisk \- Interactive GUID partition table (GPT) manipulator
|
gdisk \- Interactive GUID partition table (GPT) manipulator
|
||||||
.SH "SYNOPSIS"
|
.SH "SYNOPSIS"
|
||||||
@@ -561,7 +561,7 @@ entering data. When only one option is possible, \fBgdisk\fR
|
|||||||
usually bypasses the prompt entirely.
|
usually bypasses the prompt entirely.
|
||||||
|
|
||||||
.SH "BUGS"
|
.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:
|
should be considered beta software. Known bugs and limitations include:
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
10
gpt.cc
10
gpt.cc
@@ -261,10 +261,10 @@ int GPTData::Verify(void) {
|
|||||||
|
|
||||||
if ((mainHeader.lastUsableLBA >= diskSize) || (mainHeader.lastUsableLBA > mainHeader.backupLBA)) {
|
if ((mainHeader.lastUsableLBA >= diskSize) || (mainHeader.lastUsableLBA > mainHeader.backupLBA)) {
|
||||||
problems++;
|
problems++;
|
||||||
cout << "\nProblem: GPT claims the disk is larger than it is!\n";
|
cout << "\nProblem: GPT claims the disk is larger than it is! (Claimed last usable\n"
|
||||||
cout << "(Claimed last usable sector is " << mainHeader.lastUsableLBA << ", but\n";
|
<< "sector is " << mainHeader.lastUsableLBA << ", but backup header is at\n"
|
||||||
cout << "backup header is at " << mainHeader.backupLBA << " and disk size is\n";
|
<< mainHeader.backupLBA << " and disk size is " << diskSize << " sectors.\n"
|
||||||
cout << diskSize << "sectors\n";
|
<< "The 'e' option on the experts' menu will probably fix this problem\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for overlapping partitions....
|
// Check for overlapping partitions....
|
||||||
@@ -1741,7 +1741,7 @@ uint32_t GPTData::CreatePartition(uint32_t partNum, uint64_t startSector, uint64
|
|||||||
if (FindLastInFree(startSector) >= endSector) {
|
if (FindLastInFree(startSector) >= endSector) {
|
||||||
partitions[partNum].SetFirstLBA(startSector);
|
partitions[partNum].SetFirstLBA(startSector);
|
||||||
partitions[partNum].SetLastLBA(endSector);
|
partitions[partNum].SetLastLBA(endSector);
|
||||||
partitions[partNum].SetType(DEFAULT_TYPE);
|
partitions[partNum].SetType(DEFAULT_GPT_TYPE);
|
||||||
partitions[partNum].RandomizeUniqueGUID();
|
partitions[partNum].RandomizeUniqueGUID();
|
||||||
} else retval = 0; // if free space until endSector
|
} else retval = 0; // if free space until endSector
|
||||||
} else retval = 0; // if startSector is free
|
} else retval = 0; // if startSector is free
|
||||||
|
|||||||
13
gptcl.cc
13
gptcl.cc
@@ -49,7 +49,7 @@ void GPTDataCL::LoadBackupFile(string backupFile, int &saveData, int &neverSaveD
|
|||||||
neverSaveData = 1;
|
neverSaveData = 1;
|
||||||
cerr << "Error loading backup file!\n";
|
cerr << "Error loading backup file!\n";
|
||||||
} // else
|
} // else
|
||||||
} //
|
} // GPTDataCL::LoadBackupFile()
|
||||||
|
|
||||||
// Perform the actions specified on the command line. This is necessarily one
|
// Perform the actions specified on the command line. This is necessarily one
|
||||||
// monster of a function!
|
// monster of a function!
|
||||||
@@ -64,7 +64,6 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
|
|||||||
GPTData secondDevice;
|
GPTData secondDevice;
|
||||||
int opt, numOptions = 0, saveData = 0, neverSaveData = 0;
|
int opt, numOptions = 0, saveData = 0, neverSaveData = 0;
|
||||||
int partNum = 0, saveNonGPT = 1, retval = 0, pretend = 0;
|
int partNum = 0, saveNonGPT = 1, retval = 0, pretend = 0;
|
||||||
uint32_t gptPartNum = 0;
|
|
||||||
uint64_t low, high, startSector, endSector, sSize;
|
uint64_t low, high, startSector, endSector, sSize;
|
||||||
uint64_t temp; // temporary variable; free to use in any case
|
uint64_t temp; // temporary variable; free to use in any case
|
||||||
char *device;
|
char *device;
|
||||||
@@ -194,6 +193,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
|
|||||||
case 'c':
|
case 'c':
|
||||||
JustLooking(0);
|
JustLooking(0);
|
||||||
partNum = (int) GetInt(partName, 1) - 1;
|
partNum = (int) GetInt(partName, 1) - 1;
|
||||||
|
if ((partNum >= 0) && (partNum < (int) GetNumParts())) {
|
||||||
name = GetString(partName, 2);
|
name = GetString(partName, 2);
|
||||||
if (SetName(partNum, (UnicodeString) name.c_str())) {
|
if (SetName(partNum, (UnicodeString) name.c_str())) {
|
||||||
saveData = 1;
|
saveData = 1;
|
||||||
@@ -203,6 +203,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
|
|||||||
neverSaveData = 1;
|
neverSaveData = 1;
|
||||||
} // if/else
|
} // if/else
|
||||||
free(partName);
|
free(partName);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
JustLooking(0);
|
JustLooking(0);
|
||||||
@@ -348,6 +349,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
|
|||||||
case 't':
|
case 't':
|
||||||
JustLooking(0);
|
JustLooking(0);
|
||||||
partNum = (int) GetInt(typeCode, 1) - 1;
|
partNum = (int) GetInt(typeCode, 1) - 1;
|
||||||
|
if ((partNum >= 0) && (partNum < (int) GetNumParts())) {
|
||||||
typeHelper = GetString(typeCode, 2);
|
typeHelper = GetString(typeCode, 2);
|
||||||
if ((typeHelper != (GUIDData) "00000000-0000-0000-0000-000000000000") &&
|
if ((typeHelper != (GUIDData) "00000000-0000-0000-0000-000000000000") &&
|
||||||
(ChangePartType(partNum, typeHelper))) {
|
(ChangePartType(partNum, typeHelper))) {
|
||||||
@@ -358,6 +360,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
|
|||||||
neverSaveData = 1;
|
neverSaveData = 1;
|
||||||
} // if/else
|
} // if/else
|
||||||
free(typeCode);
|
free(typeCode);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
JustLooking(0);
|
JustLooking(0);
|
||||||
@@ -367,8 +370,10 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
|
|||||||
case 'u':
|
case 'u':
|
||||||
JustLooking(0);
|
JustLooking(0);
|
||||||
saveData = 1;
|
saveData = 1;
|
||||||
gptPartNum = (int) GetInt(partGUID, 1) - 1;
|
partNum = (int) GetInt(partGUID, 1) - 1;
|
||||||
SetPartitionGUID(gptPartNum, GetString(partGUID, 2).c_str());
|
if ((partNum >= 0) && (partNum < (int) GetNumParts())) {
|
||||||
|
SetPartitionGUID(partNum, GetString(partGUID, 2).c_str());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
JustLooking(0);
|
JustLooking(0);
|
||||||
|
|||||||
@@ -219,7 +219,9 @@ void GPTDataCurses::IdentifySpaces(void) {
|
|||||||
Space* GPTDataCurses::ShowSpace(int spaceNum, int lineNum) {
|
Space* GPTDataCurses::ShowSpace(int spaceNum, int lineNum) {
|
||||||
Space *space;
|
Space *space;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
#ifdef USE_UTF16
|
||||||
char temp[40];
|
char temp[40];
|
||||||
|
#endif
|
||||||
|
|
||||||
space = firstSpace;
|
space = firstSpace;
|
||||||
while ((space != NULL) && (i < spaceNum)) {
|
while ((space != NULL) && (i < spaceNum)) {
|
||||||
@@ -308,7 +310,9 @@ void GPTDataCurses::DeletePartition(int partNum) {
|
|||||||
// Displays information on the specified partition
|
// Displays information on the specified partition
|
||||||
void GPTDataCurses::ShowInfo(int partNum) {
|
void GPTDataCurses::ShowInfo(int partNum) {
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
|
#ifdef USE_UTF16
|
||||||
char temp[NAME_SIZE / 2 + 1];
|
char temp[NAME_SIZE / 2 + 1];
|
||||||
|
#endif
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
move(2, (COLS - 29) / 2);
|
move(2, (COLS - 29) / 2);
|
||||||
|
|||||||
@@ -277,13 +277,13 @@ void GPTPart::ChangeType(void) {
|
|||||||
|
|
||||||
cout << "Current type is '" << GetTypeName() << "'\n";
|
cout << "Current type is '" << GetTypeName() << "'\n";
|
||||||
do {
|
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();
|
line = ReadString();
|
||||||
if ((line[0] == 'L') || (line[0] == 'l')) {
|
if ((line[0] == 'L') || (line[0] == 'l')) {
|
||||||
partitionType.ShowAllTypes();
|
partitionType.ShowAllTypes();
|
||||||
} else {
|
} else {
|
||||||
if (line.length() == 0)
|
if (line.length() == 0)
|
||||||
tempType= DEFAULT_TYPE;
|
tempType = DEFAULT_GPT_TYPE;
|
||||||
else
|
else
|
||||||
tempType = line;
|
tempType = line;
|
||||||
} // if/else
|
} // if/else
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ PartType & PartType::operator=(uint16_t ID) {
|
|||||||
} // while
|
} // while
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// Assign a default value....
|
// Assign a default value....
|
||||||
operator=(DEFAULT_TYPE);
|
operator=(DEFAULT_GPT_TYPE);
|
||||||
cout.setf(ios::uppercase);
|
cout.setf(ios::uppercase);
|
||||||
cout.fill('0');
|
cout.fill('0');
|
||||||
cout << "Exact type match not found for type code ";
|
cout << "Exact type match not found for type code ";
|
||||||
|
|||||||
6
sgdisk.8
6
sgdisk.8
@@ -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
|
.\" 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"
|
.SH "NAME"
|
||||||
sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix
|
sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix
|
||||||
.SH "SYNOPSIS"
|
.SH "SYNOPSIS"
|
||||||
@@ -490,7 +490,7 @@ sgdisk, but may with gdisk)
|
|||||||
Disk replication operation (-R) failed
|
Disk replication operation (-R) failed
|
||||||
|
|
||||||
.SH "BUGS"
|
.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:
|
should be considered beta software. Known bugs and limitations include:
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
18
support.h
18
support.h
@@ -8,7 +8,7 @@
|
|||||||
#ifndef __GPTSUPPORT
|
#ifndef __GPTSUPPORT
|
||||||
#define __GPTSUPPORT
|
#define __GPTSUPPORT
|
||||||
|
|
||||||
#define GPTFDISK_VERSION "0.8.5.4"
|
#define GPTFDISK_VERSION "0.8.6"
|
||||||
|
|
||||||
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
|
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
|
||||||
// Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
|
// Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
|
||||||
@@ -17,15 +17,19 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
|
||||||
#define DEFAULT_TYPE 0xA503
|
#define DEFAULT_GPT_TYPE 0xA503
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define DEFAULT_TYPE 0xAF00
|
#define DEFAULT_GPT_TYPE 0xAF00
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define DEFAULT_TYPE 0x0700
|
#define DEFAULT_GPT_TYPE 0x0700
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __sun__
|
||||||
|
#define DEFAULT_GPT_TYPE 0xbf01
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Microsoft Visual C++ only
|
// Microsoft Visual C++ only
|
||||||
@@ -38,11 +42,11 @@
|
|||||||
// Linux only....
|
// Linux only....
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#define DEFAULT_TYPE 0x8300
|
#define DEFAULT_GPT_TYPE 0x8300
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEFAULT_TYPE
|
#ifndef DEFAULT_GPT_TYPE
|
||||||
#define DEFAULT_TYPE 0x8300
|
#define DEFAULT_GPT_TYPE 0x8300
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set this as a default
|
// Set this as a default
|
||||||
|
|||||||
Reference in New Issue
Block a user