diff options
Diffstat (limited to 'vendor/github.com/edsrzf/mmap-go/mmap.go')
-rw-r--r-- | vendor/github.com/edsrzf/mmap-go/mmap.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/vendor/github.com/edsrzf/mmap-go/mmap.go b/vendor/github.com/edsrzf/mmap-go/mmap.go index 14fb22580a..29655bd222 100644 --- a/vendor/github.com/edsrzf/mmap-go/mmap.go +++ b/vendor/github.com/edsrzf/mmap-go/mmap.go @@ -81,25 +81,27 @@ func (m *MMap) header() *reflect.SliceHeader { return (*reflect.SliceHeader)(unsafe.Pointer(m)) } +func (m *MMap) addrLen() (uintptr, uintptr) { + header := m.header() + return header.Data, uintptr(header.Len) +} + // Lock keeps the mapped region in physical memory, ensuring that it will not be // swapped out. func (m MMap) Lock() error { - dh := m.header() - return lock(dh.Data, uintptr(dh.Len)) + return m.lock() } // Unlock reverses the effect of Lock, allowing the mapped region to potentially // be swapped out. // If m is already unlocked, aan error will result. func (m MMap) Unlock() error { - dh := m.header() - return unlock(dh.Data, uintptr(dh.Len)) + return m.unlock() } // Flush synchronizes the mapping's contents to the file's contents on disk. func (m MMap) Flush() error { - dh := m.header() - return flush(dh.Data, uintptr(dh.Len)) + return m.flush() } // Unmap deletes the memory mapped region, flushes any remaining changes, and sets @@ -109,8 +111,7 @@ func (m MMap) Flush() error { // Unmap should only be called on the slice value that was originally returned from // a call to Map. Calling Unmap on a derived slice may cause errors. func (m *MMap) Unmap() error { - dh := m.header() - err := unmap(dh.Data, uintptr(dh.Len)) + err := m.unmap() *m = nil return err } |