Switch over to the google3 unix_file File*.
I also moved macros.h to base/macros.h to ease google3 porting, at
the expense of a larger than necessary change. (I learned my lesson,
though, and didn't make the equivalent base/logging.h change.)
I'm not sure whether we want to keep the unix_file MappedFile given
our existing MemMap, but it's easier to bring it over and then remove
it (and possibly revert the removal) than to bring it over later.
Change-Id: Id50a66faa5ab17b9bc936cc9043dbc26f791f0ca
diff --git a/src/os_linux.cc b/src/os_linux.cc
index b91f1ff..ceda7dd 100644
--- a/src/os_linux.cc
+++ b/src/os_linux.cc
@@ -21,7 +21,8 @@
#include <sys/stat.h>
#include <fcntl.h>
-#include "file_linux.h"
+#include "base/unix_file/fd_file.h"
+#include "UniquePtr.h"
namespace art {
@@ -35,15 +36,11 @@
} else {
flags |= O_RDONLY;
}
- int fd = open(name, flags, 0666);
- if (fd < 0) {
+ UniquePtr<File> file(new File);
+ if (!file->Open(name, flags, 0666)) {
return NULL;
}
- return new LinuxFile(name, fd, true);
-}
-
-File* OS::FileFromFd(const char* name, int fd) {
- return new LinuxFile(name, fd, false);
+ return file.release();
}
bool OS::FileExists(const char* name) {