mirror of
https://github.com/ksherlock/profuse.git
synced 2024-12-23 11:31:43 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@141 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
e3b89b2201
commit
15315bad17
@ -75,10 +75,12 @@ MappedFile::MappedFile(const char *name, size_t size)
|
||||
//_map = ::mmap(NULL, _size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, _fd, 0);
|
||||
|
||||
auto_map map(
|
||||
fd,
|
||||
NULL,
|
||||
_size,
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_FILE | MAP_SHARED
|
||||
MAP_FILE | MAP_SHARED,
|
||||
fd,
|
||||
0
|
||||
);
|
||||
|
||||
if (map == MAP_FAILED) throw POSIXException(__METHOD__ ": Unable to map file.", errno);
|
||||
@ -117,13 +119,22 @@ void MappedFile::init(int f, bool readOnly)
|
||||
_map = ::mmap(NULL, _size, readOnly ? PROT_READ : PROT_READ | PROT_WRITE,
|
||||
MAP_FILE | MAP_SHARED, fd, 0);
|
||||
*/
|
||||
::lseek(f, 0, SEEK_SET);
|
||||
|
||||
|
||||
auto_map map(
|
||||
f,
|
||||
NULL,
|
||||
_size,
|
||||
readOnly ? PROT_READ : PROT_READ | PROT_WRITE,
|
||||
readOnly ? MAP_FILE : MAP_FILE | MAP_SHARED
|
||||
MAP_FILE | MAP_SHARED, //readOnly ? MAP_FILE : MAP_FILE | MAP_SHARED,
|
||||
f,
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
_map = ::mmap(NULL, _size, readOnly ? PROT_READ : PROT_READ | PROT_WRITE,
|
||||
MAP_FILE | MAP_SHARED, f, 0);
|
||||
*/
|
||||
if (map == MAP_FAILED) throw POSIXException(__METHOD__ ": Unable to map file.", errno);
|
||||
|
||||
_fd = f;
|
||||
|
5
auto.h
5
auto.h
@ -73,9 +73,10 @@ private:
|
||||
class auto_map
|
||||
{
|
||||
public:
|
||||
auto_map(int fd, size_t size, int prot, int flags) :
|
||||
auto_map(void *addr, size_t size, int prot, int flags, int fd, off_t offset)
|
||||
:
|
||||
_size(size),
|
||||
_map(::mmap(NULL, size, prot, flags, fd, 0))
|
||||
_map(::mmap(addr, size, prot, flags, fd, offset))
|
||||
{ }
|
||||
|
||||
~auto_map()
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
virtual ~Entry();
|
||||
|
||||
unsigned blocks() const { return _firstBlock - _lastBlock; }
|
||||
unsigned blocks() const { return _lastBlock - _firstBlock; }
|
||||
|
||||
unsigned firstBlock() const { return _firstBlock; }
|
||||
unsigned lastBlock() const { return _lastBlock; }
|
||||
@ -75,6 +75,7 @@ public:
|
||||
|
||||
const char *name() const { return _fileName; }
|
||||
unsigned fileCount() const { return _fileCount; }
|
||||
unsigned volumeBlocks() const { return _lastVolumeBlock; }
|
||||
|
||||
Pascal::DateRec lastBoot() const { return _lastBoot; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user