Version 0.6.1; very minor changes from last commit

This commit is contained in:
srs5694
2010-01-20 16:56:30 -05:00
parent 519b5bb70a
commit 7dbb932233
6 changed files with 19 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
0.6.1 (1/??/2009):
0.6.1 (1/20/2009):
------------------
- Fixed bug that returned incorrect disk size on 32-bit versions of
@@ -7,7 +7,7 @@
- Fixed bug that prevented FreeBSD version from working on disk image
files.
- Fixed bug that caused BSD disklabel conversion to not work.
- Fixed bug that caused BSD disklabel conversion to fail.
0.6.0 (1/15/2009):
------------------

View File

@@ -539,7 +539,8 @@ tested, with the x86\-64 version having seen the most testing.
The FreeBSD version of the program can't write changes to the partition
table to a disk when existing partitions on that disk are mounted. (The
same problem exists with many other FreeBSD utilities, such as
\fBgpt\fR, \fBfdisk\fR, and \fBdd\fR.)
\fBgpt\fR, \fBfdisk\fR, and \fBdd\fR.) This limitation can be overcome
by typing \fBsysctl kern.geom.debugflags=16\fR at a shell prompt.
.TP
.B *

8
gpt.cc
View File

@@ -542,8 +542,14 @@ int GPTData::LoadPartitions(char* deviceFilename) {
fd = OpenForWrite(deviceFilename);
if ((fd == -1) && (!justLooking)) {
printf("\aNOTE: Write test failed with error number %d. It will be "
"impossible to save\nchanges to this disk's partition table!\n\n",
"impossible to save\nchanges to this disk's partition table!\n",
errno);
#ifdef __FreeBSD__
printf("You may be able to enable writes by exiting this program, typing\n"
"'sysctl kern.geom.debugflags=16' at a shell prompt, and re-running this\n"
"program.\n");
#endif
printf("\n");
justLooking = 1;
} // if
close(fd);

2
gpt.h
View File

@@ -16,7 +16,7 @@
#ifndef __GPTSTRUCTS
#define __GPTSTRUCTS
#define GPTFDISK_VERSION "0.6.1-pre3"
#define GPTFDISK_VERSION "0.6.1"
using namespace std;

View File

@@ -367,7 +367,8 @@ tested, with the x86\-64 version having seen the most testing.
The FreeBSD version of the program can't write changes to the partition
table to a disk when existing partitions on that disk are mounted. (The
same problem exists with many other FreeBSD utilities, such as
\fBgpt\fR, \fBfdisk\fR, and \fBdd\fR.)
\fBgpt\fR, \fBfdisk\fR, and \fBdd\fR.) This limitation can be overcome
by typing \fBsysctl kern.geom.debugflags=16\fR at a shell prompt.
.TP
.B *

View File

@@ -585,10 +585,10 @@ int myWrite(int fd, char* buffer, int numBytes) {
**************************************************************************************/
// The disksize function is taken from the Linux fdisk code and modified
// to work around a problem returning a uint64_t value on Mac OS.
// greatly since then to enable FreeBSD and MacOS support, as well as to
// return correct values for disk image files.
uint64_t disksize(int fd, int *err) {
long sz; // Do not delete; needed for Linux
off_t size = 0; // Do not delete; needed for FreeBSD
long long b; // Do not delete; needed for Linux
uint64_t sectors = 0; // size in sectors
off_t bytes = 0; // size in bytes
@@ -603,9 +603,9 @@ uint64_t disksize(int fd, int *err) {
*err = ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors);
#else
#ifdef __FreeBSD__
*err = ioctl(fd, DIOCGMEDIASIZE, &size);
*err = ioctl(fd, DIOCGMEDIASIZE, &bytes);
b = GetBlockSize(fd);
sectors = size / b;
sectors = bytes / b;
#else
*err = ioctl(fd, BLKGETSIZE, &sz);
if (*err) {
@@ -629,7 +629,7 @@ uint64_t disksize(int fd, int *err) {
// what have you) and see what stat() gives us....
if ((sectors == 0) || (*err == -1)) {
if (fstat64(fd, &st) == 0) {
bytes = (uint64_t) st.st_size;
bytes = (off_t) st.st_size;
if ((bytes % UINT64_C(512)) != 0)
fprintf(stderr, "Warning: File size is not a multiple of 512 bytes!"
" Misbehavior is likely!\n\a");