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

@@ -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();