Loading libutils/FileMap.cpp +26 −35 Original line number Diff line number Diff line Loading @@ -40,19 +40,14 @@ using namespace android; /*static*/ long FileMap::mPageSize = -1; /* * Constructor. Create an empty object. */ // Constructor. Create an empty object. FileMap::FileMap(void) : mRefCount(1), mFileName(NULL), mBasePtr(NULL), mBaseLength(0), mDataPtr(NULL), mDataLength(0) { } /* * Destructor. */ // Destructor. FileMap::~FileMap(void) { assert(mRefCount == 0); Loading Loading @@ -81,14 +76,12 @@ FileMap::~FileMap(void) } /* * Create a new mapping on an open file. * * Closing the file descriptor does not unmap the pages, so we don't * claim ownership of the fd. * * Returns "false" on failure. */ // Create a new mapping on an open file. // // Closing the file descriptor does not unmap the pages, so we don't // claim ownership of the fd. // // Returns "false" on failure. bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t length, bool readOnly) { Loading Loading @@ -143,7 +136,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le assert(offset >= 0); assert(length > 0); /* init on first use */ // init on first use if (mPageSize == -1) { #if NOT_USING_KLIBC mPageSize = sysconf(_SC_PAGESIZE); Loading @@ -152,7 +145,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le return false; } #else /* this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM */ // this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM mPageSize = 4096; #endif } Loading Loading @@ -181,7 +174,7 @@ try_again: return false; } mBasePtr = ptr; #endif /* HAVE_POSIX_FILEMAP */ #endif // HAVE_POSIX_FILEMAP mFileName = origFileName != NULL ? strdup(origFileName) : NULL; mBaseLength = adjLength; Loading @@ -197,9 +190,7 @@ try_again: return true; } /* * Provide guidance to the system. */ // Provide guidance to the system. int FileMap::advise(MapAdvice advice) { #if HAVE_MADVISE Loading Loading
libutils/FileMap.cpp +26 −35 Original line number Diff line number Diff line Loading @@ -40,19 +40,14 @@ using namespace android; /*static*/ long FileMap::mPageSize = -1; /* * Constructor. Create an empty object. */ // Constructor. Create an empty object. FileMap::FileMap(void) : mRefCount(1), mFileName(NULL), mBasePtr(NULL), mBaseLength(0), mDataPtr(NULL), mDataLength(0) { } /* * Destructor. */ // Destructor. FileMap::~FileMap(void) { assert(mRefCount == 0); Loading Loading @@ -81,14 +76,12 @@ FileMap::~FileMap(void) } /* * Create a new mapping on an open file. * * Closing the file descriptor does not unmap the pages, so we don't * claim ownership of the fd. * * Returns "false" on failure. */ // Create a new mapping on an open file. // // Closing the file descriptor does not unmap the pages, so we don't // claim ownership of the fd. // // Returns "false" on failure. bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t length, bool readOnly) { Loading Loading @@ -143,7 +136,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le assert(offset >= 0); assert(length > 0); /* init on first use */ // init on first use if (mPageSize == -1) { #if NOT_USING_KLIBC mPageSize = sysconf(_SC_PAGESIZE); Loading @@ -152,7 +145,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le return false; } #else /* this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM */ // this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM mPageSize = 4096; #endif } Loading Loading @@ -181,7 +174,7 @@ try_again: return false; } mBasePtr = ptr; #endif /* HAVE_POSIX_FILEMAP */ #endif // HAVE_POSIX_FILEMAP mFileName = origFileName != NULL ? strdup(origFileName) : NULL; mBaseLength = adjLength; Loading @@ -197,9 +190,7 @@ try_again: return true; } /* * Provide guidance to the system. */ // Provide guidance to the system. int FileMap::advise(MapAdvice advice) { #if HAVE_MADVISE Loading