Revert 239280 "Move more file_util functions to base namespace."

dbus_unittests started fialing on Linux Tests (dbg)(2) and Linux Tests (dbg)(2)(32).
This CL is the only in the intersection of CLs in the first failing build on
the two builders, so giving a speculative revert a try (rlarocque already
tried a clobber, it didn't help).

http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29/builds/41806
http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29%2832%29/builds/8544


> Move more file_util functions to base namespace.
> 
> TBR=sky
> 
> Review URL: https://codereview.chromium.org/109043002

TBR=brettw@chromium.org

Review URL: https://codereview.chromium.org/105823009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239400 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: a4f7378f973b38400f133958842eb36db0b61dcb
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index ddcd5dd..fdf196e 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -689,27 +689,6 @@
   return true;
 }
 
-FILE* OpenFile(const FilePath& filename, const char* mode) {
-  ThreadRestrictions::AssertIOAllowed();
-  FILE* result = NULL;
-  do {
-    result = fopen(filename.value().c_str(), mode);
-  } while (!result && errno == EINTR);
-  return result;
-}
-
-int ReadFile(const FilePath& filename, char* data, int size) {
-  ThreadRestrictions::AssertIOAllowed();
-  int fd = HANDLE_EINTR(open(filename.value().c_str(), O_RDONLY));
-  if (fd < 0)
-    return -1;
-
-  ssize_t bytes_read = HANDLE_EINTR(read(fd, data, size));
-  if (int ret = IGNORE_EINTR(close(fd)) < 0)
-    return ret;
-  return bytes_read;
-}
-
 }  // namespace base
 
 // -----------------------------------------------------------------------------
@@ -744,10 +723,42 @@
   return base::FilePath();
 }
 
+bool GetInode(const FilePath& path, ino_t* inode) {
+  base::ThreadRestrictions::AssertIOAllowed();  // For call to stat().
+  struct stat buffer;
+  int result = stat(path.value().c_str(), &buffer);
+  if (result < 0)
+    return false;
+
+  *inode = buffer.st_ino;
+  return true;
+}
+
 FILE* OpenFile(const std::string& filename, const char* mode) {
   return OpenFile(FilePath(filename), mode);
 }
 
+FILE* OpenFile(const FilePath& filename, const char* mode) {
+  base::ThreadRestrictions::AssertIOAllowed();
+  FILE* result = NULL;
+  do {
+    result = fopen(filename.value().c_str(), mode);
+  } while (!result && errno == EINTR);
+  return result;
+}
+
+int ReadFile(const FilePath& filename, char* data, int size) {
+  base::ThreadRestrictions::AssertIOAllowed();
+  int fd = HANDLE_EINTR(open(filename.value().c_str(), O_RDONLY));
+  if (fd < 0)
+    return -1;
+
+  ssize_t bytes_read = HANDLE_EINTR(read(fd, data, size));
+  if (int ret = IGNORE_EINTR(close(fd)) < 0)
+    return ret;
+  return bytes_read;
+}
+
 int WriteFile(const FilePath& filename, const char* data, int size) {
   base::ThreadRestrictions::AssertIOAllowed();
   int fd = HANDLE_EINTR(creat(filename.value().c_str(), 0666));