mirror of
https://github.com/ksherlock/profuse.git
synced 2024-10-31 17:04:27 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@316 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
345927d4b2
commit
1894a178d1
@ -25,6 +25,10 @@
|
||||
#include <sys/disk.h>
|
||||
#endif
|
||||
|
||||
#ifdef __minix
|
||||
#include <minix/partition.h>
|
||||
#endif
|
||||
|
||||
#include <Device/RawDevice.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
@ -105,7 +109,7 @@ void RawDevice::devSize(int fd)
|
||||
#undef __METHOD__
|
||||
#define __METHOD__ "RawDevice::devSize"
|
||||
|
||||
unisgned blockSize;
|
||||
unsigned blockSize;
|
||||
off_t mediaSize;
|
||||
|
||||
if (::ioctl(fd, DIOCGSECTORSIZE, &blockSize)
|
||||
@ -116,7 +120,29 @@ void RawDevice::devSize(int fd)
|
||||
|
||||
_blockSize = blockSize;
|
||||
_size = mediaSize;
|
||||
_blocks = mediaSize / blockSize;
|
||||
_blocks = mediaSize / 512;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __minix
|
||||
|
||||
void RawDevice::devSize(int fd)
|
||||
{
|
||||
#undef __METHOD__
|
||||
#define __METHOD__ "RawDevice::devSize"
|
||||
|
||||
struct partition entry;
|
||||
|
||||
|
||||
if (::ioctl(fd, DIOCGETP, &entry) < 0)
|
||||
throw POSIXException(__METHOD__ ": Unable to determine device size.", errno);
|
||||
|
||||
_size = entry.size
|
||||
_blockSize = 512; // not really but whatever.
|
||||
_blocks = _size / 512;
|
||||
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,10 @@ private:
|
||||
File _file;
|
||||
bool _readOnly;
|
||||
|
||||
uint64_t _size;
|
||||
unsigned _blocks;
|
||||
uint64_t _size; // size of device in bytes.
|
||||
unsigned _blocks; // # of 512k blocks i.e. _size / 512
|
||||
|
||||
unsigned _blockSize;
|
||||
unsigned _blockSize; // native block size.
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user