Move //services/files/c -> //mojo/services/files/public/c.

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/1133933002
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn
index 7ca98c5..aaf72c3 100644
--- a/mojo/BUILD.gn
+++ b/mojo/BUILD.gn
@@ -63,7 +63,7 @@
     "//services/clipboard:apptests",
     "//services/dart/dart_apptests",
     "//services/files:apptests",
-    "//services/files/c:apptests",
+    "//mojo/services/files/public/c:apptests",
     "//services/http_server:apptests",
     "//services/reaper:tests",
     "//services/url_response_disk_cache:tests",
diff --git a/services/files/c/BUILD.gn b/mojo/services/files/public/c/BUILD.gn
similarity index 61%
rename from services/files/c/BUILD.gn
rename to mojo/services/files/public/c/BUILD.gn
index cedc2a7..9cd687b 100644
--- a/services/files/c/BUILD.gn
+++ b/mojo/services/files/public/c/BUILD.gn
@@ -2,9 +2,17 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//mojo/public/mojo_application.gni")
+import("//build/module_args/mojo.gni")
+import("$mojo_sdk_root/mojo/public/mojo_application.gni")
+import("$mojo_sdk_root/mojo/public/mojo_sdk.gni")
 
-source_set("mojio") {
+mojo_sdk_source_set("mojio") {
+  # TODO(vtl): This is needed because mojo_sdk.gni doesn't understand relative
+  # dependencies (so without this we can't depend on our interfaces!).
+  restrict_external_deps = false
+
+  public_configs = [ "../../../public/build/config:mojo_services" ]
+
   sources = [
     "lib/directory_wrapper.cc",
     "lib/directory_wrapper.h",
@@ -34,13 +42,18 @@
   ]
 
   deps = [
-    "//mojo/public/cpp/bindings",
-    "//mojo/public/cpp/environment",
-    "//mojo/public/cpp/system",
-    "//mojo/services/files/public/interfaces",
+    "../interfaces",
+  ]
+
+  mojo_sdk_deps = [
+    "mojo/public/cpp/bindings",
+    "mojo/public/cpp/environment",
+    "mojo/public/cpp/system",
   ]
 }
 
+# NOTE(vtl): Some of the tests actually depend on a reasonable implementation of
+# the files service (e.g., //services/files).
 mojo_native_application("apptests") {
   output_name = "mojio_apptests"
 
@@ -68,14 +81,12 @@
 
   deps = [
     ":mojio",
-    "//mojo/public/cpp/application:standalone",
-    "//mojo/public/cpp/application:test_support_standalone",
-    "//mojo/public/cpp/bindings",
-    "//mojo/public/cpp/environment",
-    "//mojo/public/cpp/system",
-    "//mojo/services/files/public/interfaces",
+    "../interfaces",
+    "$mojo_sdk_root/mojo/public/cpp/application:standalone",
+    "$mojo_sdk_root/mojo/public/cpp/application:test_support_standalone",
+    "$mojo_sdk_root/mojo/public/cpp/bindings",
+    "$mojo_sdk_root/mojo/public/cpp/environment",
+    "$mojo_sdk_root/mojo/public/cpp/system",
     "//testing/gtest",
   ]
-
-  data_deps = [ "..:files" ]
 }
diff --git a/services/files/c/lib/directory_wrapper.cc b/mojo/services/files/public/c/lib/directory_wrapper.cc
similarity index 89%
rename from services/files/c/lib/directory_wrapper.cc
rename to mojo/services/files/public/c/lib/directory_wrapper.cc
index da21b69..cf1be69 100644
--- a/services/files/c/lib/directory_wrapper.cc
+++ b/mojo/services/files/public/c/lib/directory_wrapper.cc
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/directory_wrapper.h"
+#include "files/public/c/lib/directory_wrapper.h"
 
 #include <errno.h>
 
+#include "files/public/c/lib/errno_impl.h"
+#include "files/public/c/lib/file_fd_impl.h"
+#include "files/public/c/lib/template_util.h"
+#include "files/public/c/lib/util.h"
+#include "files/public/c/mojio_fcntl.h"
+#include "files/public/interfaces/file.mojom.h"
+#include "files/public/interfaces/types.mojom.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/public/cpp/environment/logging.h"
-#include "mojo/services/files/public/interfaces/file.mojom.h"
-#include "mojo/services/files/public/interfaces/types.mojom.h"
-#include "services/files/c/lib/errno_impl.h"
-#include "services/files/c/lib/file_fd_impl.h"
-#include "services/files/c/lib/template_util.h"
-#include "services/files/c/lib/util.h"
-#include "services/files/c/mojio_fcntl.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/directory_wrapper.h b/mojo/services/files/public/c/lib/directory_wrapper.h
similarity index 90%
rename from services/files/c/lib/directory_wrapper.h
rename to mojo/services/files/public/c/lib/directory_wrapper.h
index 812b0e7..90df8c0 100644
--- a/services/files/c/lib/directory_wrapper.h
+++ b/mojo/services/files/public/c/lib/directory_wrapper.h
@@ -7,9 +7,9 @@
 
 #include <memory>
 
+#include "files/public/c/mojio_sys_types.h"
+#include "files/public/interfaces/directory.mojom.h"
 #include "mojo/public/c/system/macros.h"
-#include "mojo/services/files/public/interfaces/directory.mojom.h"
-#include "services/files/c/mojio_sys_types.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/errno_impl.h b/mojo/services/files/public/c/lib/errno_impl.h
similarity index 100%
rename from services/files/c/lib/errno_impl.h
rename to mojo/services/files/public/c/lib/errno_impl.h
diff --git a/services/files/c/lib/fd_impl.h b/mojo/services/files/public/c/lib/fd_impl.h
similarity index 94%
rename from services/files/c/lib/fd_impl.h
rename to mojo/services/files/public/c/lib/fd_impl.h
index a71bf87..3884eee 100644
--- a/services/files/c/lib/fd_impl.h
+++ b/mojo/services/files/public/c/lib/fd_impl.h
@@ -7,9 +7,9 @@
 
 #include <memory>
 
+#include "files/public/c/mojio_sys_stat.h"
+#include "files/public/c/mojio_sys_types.h"
 #include "mojo/public/cpp/system/macros.h"
-#include "services/files/c/mojio_sys_stat.h"
-#include "services/files/c/mojio_sys_types.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/fd_table.cc b/mojo/services/files/public/c/lib/fd_table.cc
similarity index 94%
rename from services/files/c/lib/fd_table.cc
rename to mojo/services/files/public/c/lib/fd_table.cc
index b0241ec..9a7986e 100644
--- a/services/files/c/lib/fd_table.cc
+++ b/mojo/services/files/public/c/lib/fd_table.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/fd_table.h"
+#include "files/public/c/lib/fd_table.h"
 
 #include <errno.h>
 
 #include <limits>
 #include <utility>
 
+#include "files/public/c/lib/errno_impl.h"
 #include "mojo/public/cpp/environment/logging.h"
-#include "services/files/c/lib/errno_impl.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/fd_table.h b/mojo/services/files/public/c/lib/fd_table.h
similarity index 97%
rename from services/files/c/lib/fd_table.h
rename to mojo/services/files/public/c/lib/fd_table.h
index e5dcef9..f007320 100644
--- a/services/files/c/lib/fd_table.h
+++ b/mojo/services/files/public/c/lib/fd_table.h
@@ -10,8 +10,8 @@
 #include <memory>
 #include <vector>
 
+#include "files/public/c/lib/fd_impl.h"
 #include "mojo/public/cpp/system/macros.h"
-#include "services/files/c/lib/fd_impl.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/file_fd_impl.cc b/mojo/services/files/public/c/lib/file_fd_impl.cc
similarity index 96%
rename from services/files/c/lib/file_fd_impl.cc
rename to mojo/services/files/public/c/lib/file_fd_impl.cc
index 0e37da1..58d957c 100644
--- a/services/files/c/lib/file_fd_impl.cc
+++ b/mojo/services/files/public/c/lib/file_fd_impl.cc
@@ -2,20 +2,20 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/file_fd_impl.h"
+#include "files/public/c/lib/file_fd_impl.h"
 
 #include <errno.h>
 #include <string.h>
 
 #include <limits>
 
+#include "files/public/c/lib/errno_impl.h"
+#include "files/public/c/lib/template_util.h"
+#include "files/public/c/lib/util.h"
+#include "files/public/c/mojio_unistd.h"
+#include "files/public/interfaces/types.mojom.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/public/cpp/environment/logging.h"
-#include "mojo/services/files/public/interfaces/types.mojom.h"
-#include "services/files/c/lib/errno_impl.h"
-#include "services/files/c/lib/template_util.h"
-#include "services/files/c/lib/util.h"
-#include "services/files/c/mojio_unistd.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/file_fd_impl.h b/mojo/services/files/public/c/lib/file_fd_impl.h
similarity index 86%
rename from services/files/c/lib/file_fd_impl.h
rename to mojo/services/files/public/c/lib/file_fd_impl.h
index 3d8cf38..2a9a7d1 100644
--- a/services/files/c/lib/file_fd_impl.h
+++ b/mojo/services/files/public/c/lib/file_fd_impl.h
@@ -5,10 +5,10 @@
 #ifndef SERVICES_FILES_C_LIB_FILE_FD_IMPL_H_
 #define SERVICES_FILES_C_LIB_FILE_FD_IMPL_H_
 
+#include "files/public/c/lib/fd_impl.h"
+#include "files/public/c/mojio_sys_types.h"
+#include "files/public/interfaces/file.mojom.h"
 #include "mojo/public/c/system/macros.h"
-#include "mojo/services/files/public/interfaces/file.mojom.h"
-#include "services/files/c/lib/fd_impl.h"
-#include "services/files/c/mojio_sys_types.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/mojio_fcntl.cc b/mojo/services/files/public/c/lib/mojio_fcntl.cc
similarity index 82%
rename from services/files/c/lib/mojio_fcntl.cc
rename to mojo/services/files/public/c/lib/mojio_fcntl.cc
index 260432b..30715db 100644
--- a/services/files/c/lib/mojio_fcntl.cc
+++ b/mojo/services/files/public/c/lib/mojio_fcntl.cc
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/mojio_fcntl.h"
+#include "files/public/c/mojio_fcntl.h"
 
 #include <stdarg.h>
 
 #include <memory>
 #include <utility>
 
-#include "services/files/c/lib/directory_wrapper.h"
-#include "services/files/c/lib/fd_impl.h"
-#include "services/files/c/lib/fd_table.h"
-#include "services/files/c/lib/singletons.h"
+#include "files/public/c/lib/directory_wrapper.h"
+#include "files/public/c/lib/fd_impl.h"
+#include "files/public/c/lib/fd_table.h"
+#include "files/public/c/lib/singletons.h"
 
 namespace mojio {
 namespace {
diff --git a/services/files/c/lib/mojio_sys_stat.cc b/mojo/services/files/public/c/lib/mojio_sys_stat.cc
similarity index 75%
rename from services/files/c/lib/mojio_sys_stat.cc
rename to mojo/services/files/public/c/lib/mojio_sys_stat.cc
index 526872e..d03de5a 100644
--- a/services/files/c/lib/mojio_sys_stat.cc
+++ b/mojo/services/files/public/c/lib/mojio_sys_stat.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/mojio_sys_stat.h"
+#include "files/public/c/mojio_sys_stat.h"
 
-#include "services/files/c/lib/fd_impl.h"
-#include "services/files/c/lib/fd_table.h"
-#include "services/files/c/lib/singletons.h"
+#include "files/public/c/lib/fd_impl.h"
+#include "files/public/c/lib/fd_table.h"
+#include "files/public/c/lib/singletons.h"
 
 namespace mojio {
 namespace {
diff --git a/services/files/c/lib/mojio_unistd.cc b/mojo/services/files/public/c/lib/mojio_unistd.cc
similarity index 90%
rename from services/files/c/lib/mojio_unistd.cc
rename to mojo/services/files/public/c/lib/mojio_unistd.cc
index f31897a..f2f7f9c 100644
--- a/services/files/c/lib/mojio_unistd.cc
+++ b/mojo/services/files/public/c/lib/mojio_unistd.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/mojio_unistd.h"
+#include "files/public/c/mojio_unistd.h"
 
 #include <memory>
 #include <utility>
 
-#include "services/files/c/lib/directory_wrapper.h"
-#include "services/files/c/lib/fd_impl.h"
-#include "services/files/c/lib/fd_table.h"
-#include "services/files/c/lib/singletons.h"
+#include "files/public/c/lib/directory_wrapper.h"
+#include "files/public/c/lib/fd_impl.h"
+#include "files/public/c/lib/fd_table.h"
+#include "files/public/c/lib/singletons.h"
 
 namespace mojio {
 namespace {
diff --git a/services/files/c/lib/real_errno_impl.cc b/mojo/services/files/public/c/lib/real_errno_impl.cc
similarity index 86%
rename from services/files/c/lib/real_errno_impl.cc
rename to mojo/services/files/public/c/lib/real_errno_impl.cc
index f130d60..9dd4087 100644
--- a/services/files/c/lib/real_errno_impl.cc
+++ b/mojo/services/files/public/c/lib/real_errno_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/real_errno_impl.h"
+#include "files/public/c/lib/real_errno_impl.h"
 
 #include <errno.h>
 
diff --git a/services/files/c/lib/real_errno_impl.h b/mojo/services/files/public/c/lib/real_errno_impl.h
similarity index 94%
rename from services/files/c/lib/real_errno_impl.h
rename to mojo/services/files/public/c/lib/real_errno_impl.h
index b32e143..32f3c9b 100644
--- a/services/files/c/lib/real_errno_impl.h
+++ b/mojo/services/files/public/c/lib/real_errno_impl.h
@@ -5,8 +5,8 @@
 #ifndef SERVICES_FILES_C_LIB_REAL_ERRNO_IMPL_H_
 #define SERVICES_FILES_C_LIB_REAL_ERRNO_IMPL_H_
 
+#include "files/public/c/lib/errno_impl.h"
 #include "mojo/public/cpp/system/macros.h"
-#include "services/files/c/lib/errno_impl.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/singletons.cc b/mojo/services/files/public/c/lib/singletons.cc
similarity index 88%
rename from services/files/c/lib/singletons.cc
rename to mojo/services/files/public/c/lib/singletons.cc
index 21e3765..58d23c1 100644
--- a/services/files/c/lib/singletons.cc
+++ b/mojo/services/files/public/c/lib/singletons.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/singletons.h"
+#include "files/public/c/lib/singletons.h"
 
 #include <errno.h>
 
+#include "files/public/c/lib/directory_wrapper.h"
+#include "files/public/c/lib/fd_table.h"
+#include "files/public/c/lib/real_errno_impl.h"
+#include "files/public/c/mojio_config.h"
 #include "mojo/public/cpp/environment/logging.h"
-#include "services/files/c/lib/directory_wrapper.h"
-#include "services/files/c/lib/fd_table.h"
-#include "services/files/c/lib/real_errno_impl.h"
-#include "services/files/c/mojio_config.h"
 
 namespace mojio {
 namespace singletons {
diff --git a/services/files/c/lib/singletons.h b/mojo/services/files/public/c/lib/singletons.h
similarity index 95%
rename from services/files/c/lib/singletons.h
rename to mojo/services/files/public/c/lib/singletons.h
index 6286a4e..5c99803 100644
--- a/services/files/c/lib/singletons.h
+++ b/mojo/services/files/public/c/lib/singletons.h
@@ -5,7 +5,7 @@
 #ifndef SERVICES_FILES_C_LIB_SINGLETONS_H_
 #define SERVICES_FILES_C_LIB_SINGLETONS_H_
 
-#include "mojo/services/files/public/interfaces/directory.mojom.h"
+#include "files/public/interfaces/directory.mojom.h"
 
 namespace mojio {
 
diff --git a/services/files/c/lib/template_util.h b/mojo/services/files/public/c/lib/template_util.h
similarity index 100%
rename from services/files/c/lib/template_util.h
rename to mojo/services/files/public/c/lib/template_util.h
diff --git a/services/files/c/lib/util.cc b/mojo/services/files/public/c/lib/util.cc
similarity index 96%
rename from services/files/c/lib/util.cc
rename to mojo/services/files/public/c/lib/util.cc
index e5cbb0c..13c2438 100644
--- a/services/files/c/lib/util.cc
+++ b/mojo/services/files/public/c/lib/util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/util.h"
+#include "files/public/c/lib/util.h"
 
 #include <assert.h>
 #include <errno.h>
diff --git a/services/files/c/lib/util.h b/mojo/services/files/public/c/lib/util.h
similarity index 89%
rename from services/files/c/lib/util.h
rename to mojo/services/files/public/c/lib/util.h
index e8741bd..871be91 100644
--- a/services/files/c/lib/util.h
+++ b/mojo/services/files/public/c/lib/util.h
@@ -5,8 +5,8 @@
 #ifndef SERVICES_FILES_C_LIB_UTIL_H_
 #define SERVICES_FILES_C_LIB_UTIL_H_
 
+#include "files/public/interfaces/types.mojom.h"
 #include "mojo/public/cpp/system/macros.h"
-#include "mojo/services/files/public/interfaces/types.mojom.h"
 
 namespace mojio {
 
diff --git a/services/files/c/mojio_config.h b/mojo/services/files/public/c/mojio_config.h
similarity index 89%
rename from services/files/c/mojio_config.h
rename to mojo/services/files/public/c/mojio_config.h
index b05f6d8..9dcc58b 100644
--- a/services/files/c/mojio_config.h
+++ b/mojo/services/files/public/c/mojio_config.h
@@ -8,8 +8,8 @@
 // types for typedefs) as necessary/appropriate, but they should not be used
 // directly by application code.
 
-#ifndef SERVICES_FILES_C_MOJIO_CONFIG_H_
-#define SERVICES_FILES_C_MOJIO_CONFIG_H_
+#ifndef MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_CONFIG_H_
+#define MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_CONFIG_H_
 
 // Macros ----------------------------------------------------------------------
 
@@ -35,4 +35,4 @@
 typedef long long mojio_config_int64;
 typedef unsigned long long mojio_config_uint64;
 
-#endif  // SERVICES_FILES_C_MOJIO_CONFIG_H_
+#endif  // MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_CONFIG_H_
diff --git a/services/files/c/mojio_fcntl.h b/mojo/services/files/public/c/mojio_fcntl.h
similarity index 89%
rename from services/files/c/mojio_fcntl.h
rename to mojo/services/files/public/c/mojio_fcntl.h
index f6394c2..bb5520e 100644
--- a/services/files/c/mojio_fcntl.h
+++ b/mojo/services/files/public/c/mojio_fcntl.h
@@ -8,12 +8,12 @@
 // In general, functions/types/macros are given "mojio_"/"MOJIO_"/etc. prefixes.
 // There are a handful of exceptions (noted below).
 
-#ifndef SERVICES_FILES_C_MOJIO_FCNTL_H_
-#define SERVICES_FILES_C_MOJIO_FCNTL_H_
+#ifndef MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_FCNTL_H_
+#define MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_FCNTL_H_
 
 // Includes --------------------------------------------------------------------
 
-#include "services/files/c/mojio_sys_types.h"
+#include "files/public/c/mojio_sys_types.h"
 
 // Macros ----------------------------------------------------------------------
 
@@ -63,4 +63,4 @@
 }  // extern "C"
 #endif
 
-#endif  // SERVICES_FILES_C_MOJIO_FCNTL_H_
+#endif  // MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_FCNTL_H_
diff --git a/services/files/c/mojio_stdio.h b/mojo/services/files/public/c/mojio_stdio.h
similarity index 96%
rename from services/files/c/mojio_stdio.h
rename to mojo/services/files/public/c/mojio_stdio.h
index 2ccfe98..3caad09 100644
--- a/services/files/c/mojio_stdio.h
+++ b/mojo/services/files/public/c/mojio_stdio.h
@@ -17,8 +17,8 @@
 // mysterious to me, but it's consistent with glibc. I don't know what the
 // standard specifies.
 
-#ifndef SERVICES_FILES_C_MOJIO_STDIO_H_
-#define SERVICES_FILES_C_MOJIO_STDIO_H_
+#ifndef MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_STDIO_H_
+#define MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_STDIO_H_
 
 // Includes --------------------------------------------------------------------
 
@@ -30,7 +30,7 @@
 // <stddef.h>.
 #include <stddef.h>
 
-#include "services/files/c/mojio_config.h"
+#include "files/public/c/mojio_config.h"
 
 // Macros ----------------------------------------------------------------------
 
@@ -200,4 +200,4 @@
 }  // extern "C"
 #endif
 
-#endif  // SERVICES_FILES_C_MOJIO_STDIO_H_
+#endif  // MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_STDIO_H_
diff --git a/services/files/c/mojio_sys_stat.h b/mojo/services/files/public/c/mojio_sys_stat.h
similarity index 94%
rename from services/files/c/mojio_sys_stat.h
rename to mojo/services/files/public/c/mojio_sys_stat.h
index 2498afc..17e976b 100644
--- a/services/files/c/mojio_sys_stat.h
+++ b/mojo/services/files/public/c/mojio_sys_stat.h
@@ -8,17 +8,17 @@
 // In general, functions/types/macros are given "mojio_"/"MOJIO_"/etc. prefixes.
 // There are a handful of exceptions (noted below).
 
-#ifndef SERVICES_FILES_C_MOJIO_SYS_STAT_H_
-#define SERVICES_FILES_C_MOJIO_SYS_STAT_H_
+#ifndef MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_SYS_STAT_H_
+#define MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_SYS_STAT_H_
 
 // Includes --------------------------------------------------------------------
 
 // <sys/stat.h> is required to define a large number of types defined in
 // <sys/types.h>, so we just include our equivalent of the latter.
-#include "services/files/c/mojio_sys_types.h"
+#include "files/public/c/mojio_sys_types.h"
 
 // We need our |struct timespec| equivalent.
-#include "services/files/c/mojio_time.h"
+#include "files/public/c/mojio_time.h"
 
 // Macros ----------------------------------------------------------------------
 
@@ -125,4 +125,4 @@
 }  // extern "C"
 #endif
 
-#endif  // SERVICES_FILES_C_MOJIO_SYS_STAT_H_
+#endif  // MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_SYS_STAT_H_
diff --git a/services/files/c/mojio_sys_types.h b/mojo/services/files/public/c/mojio_sys_types.h
similarity index 86%
rename from services/files/c/mojio_sys_types.h
rename to mojo/services/files/public/c/mojio_sys_types.h
index b5cc572..e4fafdc 100644
--- a/services/files/c/mojio_sys_types.h
+++ b/mojo/services/files/public/c/mojio_sys_types.h
@@ -8,8 +8,8 @@
 // In general, functions/types/macros are given "mojio_"/"MOJIO_"/etc. prefixes.
 // There are a handful of exceptions (noted below).
 
-#ifndef SERVICES_FILES_C_MOJIO_SYS_TYPES_H_
-#define SERVICES_FILES_C_MOJIO_SYS_TYPES_H_
+#ifndef MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_SYS_TYPES_H_
+#define MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_SYS_TYPES_H_
 
 // Includes --------------------------------------------------------------------
 
@@ -17,11 +17,11 @@
 // prefix), and just use the standard one from <stddef.h>.
 #include <stddef.h>
 
-#include "services/files/c/mojio_config.h"
+#include "files/public/c/mojio_config.h"
 
 // <sys/types.h> is required to define |time_t| (which we have our own version
 // of, because the one in the C standard <time.h> is defined to be opaque).
-#include "services/files/c/mojio_time.h"
+#include "files/public/c/mojio_time.h"
 
 // Types -----------------------------------------------------------------------
 
@@ -51,4 +51,4 @@
 
 typedef mojio_config_uint32 mojio_uid_t;
 
-#endif  // SERVICES_FILES_C_MOJIO_SYS_TYPES_H_
+#endif  // MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_SYS_TYPES_H_
diff --git a/services/files/c/mojio_time.h b/mojo/services/files/public/c/mojio_time.h
similarity index 82%
rename from services/files/c/mojio_time.h
rename to mojo/services/files/public/c/mojio_time.h
index dee878a..70083a9 100644
--- a/services/files/c/mojio_time.h
+++ b/mojo/services/files/public/c/mojio_time.h
@@ -12,12 +12,12 @@
 // the C standard), but |time_t| is opaque. Thus we need to define our own
 // equivalent. On top of that, we need to define a |struct timespec| equivalent.
 
-#ifndef SERVICES_FILES_C_MOJIO_TIME_H_
-#define SERVICES_FILES_C_MOJIO_TIME_H_
+#ifndef MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_TIME_H_
+#define MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_TIME_H_
 
 // Includes --------------------------------------------------------------------
 
-#include "services/files/c/mojio_config.h"
+#include "files/public/c/mojio_config.h"
 
 // Types -----------------------------------------------------------------------
 
@@ -28,4 +28,4 @@
   long tv_nsec;
 };
 
-#endif  // SERVICES_FILES_C_MOJIO_TIME_H_
+#endif  // MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_TIME_H_
diff --git a/services/files/c/mojio_unistd.h b/mojo/services/files/public/c/mojio_unistd.h
similarity index 95%
rename from services/files/c/mojio_unistd.h
rename to mojo/services/files/public/c/mojio_unistd.h
index a04091e..4b6ea90 100644
--- a/services/files/c/mojio_unistd.h
+++ b/mojo/services/files/public/c/mojio_unistd.h
@@ -8,8 +8,8 @@
 // In general, functions/types/macros are given "mojio_"/"MOJIO_"/etc. prefixes.
 // There are a handful of exceptions (noted below).
 
-#ifndef SERVICES_FILES_C_MOJIO_UNISTD_H_
-#define SERVICES_FILES_C_MOJIO_UNISTD_H_
+#ifndef MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_UNISTD_H_
+#define MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_UNISTD_H_
 
 // Includes --------------------------------------------------------------------
 
@@ -21,7 +21,7 @@
 // <unistd.h> is required to |ssize_t|, |uid_t|, |gid_t|, |off_t|, |pid_t|, and
 // |useconds_t| from <sys/types.h>, so we may as well define our versions by
 // inclusion.
-#include "services/files/c/mojio_sys_types.h"
+#include "files/public/c/mojio_sys_types.h"
 
 // Macros ----------------------------------------------------------------------
 
@@ -152,4 +152,4 @@
 }  // extern "C"
 #endif
 
-#endif  // SERVICES_FILES_C_MOJIO_UNISTD_H_
+#endif  // MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_UNISTD_H_
diff --git a/services/files/c/tests/directory_wrapper_unittest.cc b/mojo/services/files/public/c/tests/directory_wrapper_unittest.cc
similarity index 95%
rename from services/files/c/tests/directory_wrapper_unittest.cc
rename to mojo/services/files/public/c/tests/directory_wrapper_unittest.cc
index ea2762e..c2502f1 100644
--- a/services/files/c/tests/directory_wrapper_unittest.cc
+++ b/mojo/services/files/public/c/tests/directory_wrapper_unittest.cc
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/directory_wrapper.h"
+#include "files/public/c/lib/directory_wrapper.h"
 
 #include <errno.h>
 
 #include <memory>
 
-#include "services/files/c/lib/fd_impl.h"
-#include "services/files/c/mojio_fcntl.h"
-#include "services/files/c/mojio_sys_stat.h"
-#include "services/files/c/tests/mock_errno_impl.h"
-#include "services/files/c/tests/mojio_impl_test_base.h"
-#include "services/files/c/tests/test_utils.h"
+#include "files/public/c/lib/fd_impl.h"
+#include "files/public/c/mojio_fcntl.h"
+#include "files/public/c/mojio_sys_stat.h"
+#include "files/public/c/tests/mock_errno_impl.h"
+#include "files/public/c/tests/mojio_impl_test_base.h"
+#include "files/public/c/tests/test_utils.h"
 
 namespace mojio {
 namespace {
diff --git a/services/files/c/tests/errno_impl_unittest.cc b/mojo/services/files/public/c/tests/errno_impl_unittest.cc
similarity index 93%
rename from services/files/c/tests/errno_impl_unittest.cc
rename to mojo/services/files/public/c/tests/errno_impl_unittest.cc
index 03ec0db..458f619 100644
--- a/services/files/c/tests/errno_impl_unittest.cc
+++ b/mojo/services/files/public/c/tests/errno_impl_unittest.cc
@@ -5,9 +5,9 @@
 // This basically tests |ErrnoImpl::Setter|, since |ErrnoImpl| itself is just a
 // simple interface.
 
-#include "services/files/c/lib/errno_impl.h"
+#include "files/public/c/lib/errno_impl.h"
 
-#include "services/files/c/tests/mock_errno_impl.h"
+#include "files/public/c/tests/mock_errno_impl.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace mojio {
diff --git a/services/files/c/tests/fd_table_unittest.cc b/mojo/services/files/public/c/tests/fd_table_unittest.cc
similarity index 97%
rename from services/files/c/tests/fd_table_unittest.cc
rename to mojo/services/files/public/c/tests/fd_table_unittest.cc
index 1e4a090..809635e 100644
--- a/services/files/c/tests/fd_table_unittest.cc
+++ b/mojo/services/files/public/c/tests/fd_table_unittest.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/fd_table.h"
+#include "files/public/c/lib/fd_table.h"
 
 #include <errno.h>
 
 #include <memory>
 
-#include "services/files/c/lib/fd_impl.h"
-#include "services/files/c/tests/mock_errno_impl.h"
+#include "files/public/c/lib/fd_impl.h"
+#include "files/public/c/tests/mock_errno_impl.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace mojio {
diff --git a/services/files/c/tests/file_fd_impl_unittest.cc b/mojo/services/files/public/c/tests/file_fd_impl_unittest.cc
similarity index 95%
rename from services/files/c/tests/file_fd_impl_unittest.cc
rename to mojo/services/files/public/c/tests/file_fd_impl_unittest.cc
index 6ed6145..2f91e39 100644
--- a/services/files/c/tests/file_fd_impl_unittest.cc
+++ b/mojo/services/files/public/c/tests/file_fd_impl_unittest.cc
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/file_fd_impl.h"
+#include "files/public/c/lib/file_fd_impl.h"
 
 #include <errno.h>
 
 #include <string>
 
-#include "mojo/services/files/public/interfaces/files.mojom.h"
-#include "mojo/services/files/public/interfaces/types.mojom.h"
-#include "services/files/c/mojio_sys_stat.h"
-#include "services/files/c/mojio_unistd.h"
-#include "services/files/c/tests/mock_errno_impl.h"
-#include "services/files/c/tests/mojio_impl_test_base.h"
-#include "services/files/c/tests/test_utils.h"
+#include "files/public/c/mojio_sys_stat.h"
+#include "files/public/c/mojio_unistd.h"
+#include "files/public/c/tests/mock_errno_impl.h"
+#include "files/public/c/tests/mojio_impl_test_base.h"
+#include "files/public/c/tests/test_utils.h"
+#include "files/public/interfaces/files.mojom.h"
+#include "files/public/interfaces/types.mojom.h"
 
 namespace mojio {
 namespace {
diff --git a/services/files/c/tests/mock_errno_impl.cc b/mojo/services/files/public/c/tests/mock_errno_impl.cc
similarity index 87%
rename from services/files/c/tests/mock_errno_impl.cc
rename to mojo/services/files/public/c/tests/mock_errno_impl.cc
index 09bd4dc..dc67464 100644
--- a/services/files/c/tests/mock_errno_impl.cc
+++ b/mojo/services/files/public/c/tests/mock_errno_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/tests/mock_errno_impl.h"
+#include "files/public/c/tests/mock_errno_impl.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/mock_errno_impl.h b/mojo/services/files/public/c/tests/mock_errno_impl.h
similarity index 95%
rename from services/files/c/tests/mock_errno_impl.h
rename to mojo/services/files/public/c/tests/mock_errno_impl.h
index 89a08f8..b8bff2f 100644
--- a/services/files/c/tests/mock_errno_impl.h
+++ b/mojo/services/files/public/c/tests/mock_errno_impl.h
@@ -5,8 +5,8 @@
 #ifndef SERVICES_FILES_C_TESTS_MOCK_ERRNO_IMPL_H_
 #define SERVICES_FILES_C_TESTS_MOCK_ERRNO_IMPL_H_
 
+#include "files/public/c/lib/errno_impl.h"
 #include "mojo/public/cpp/system/macros.h"
-#include "services/files/c/lib/errno_impl.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/mojio_impl_test_base.cc b/mojo/services/files/public/c/tests/mojio_impl_test_base.cc
similarity index 84%
rename from services/files/c/tests/mojio_impl_test_base.cc
rename to mojo/services/files/public/c/tests/mojio_impl_test_base.cc
index e71c778..d5f1aea 100644
--- a/services/files/c/tests/mojio_impl_test_base.cc
+++ b/mojo/services/files/public/c/tests/mojio_impl_test_base.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/tests/mojio_impl_test_base.h"
+#include "files/public/c/tests/mojio_impl_test_base.h"
 
+#include "files/public/c/lib/template_util.h"
+#include "files/public/interfaces/files.mojom.h"
 #include "mojo/public/cpp/application/application_impl.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/public/cpp/environment/logging.h"
-#include "mojo/services/files/public/interfaces/files.mojom.h"
-#include "services/files/c/lib/template_util.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/mojio_impl_test_base.h b/mojo/services/files/public/c/tests/mojio_impl_test_base.h
similarity index 93%
rename from services/files/c/tests/mojio_impl_test_base.h
rename to mojo/services/files/public/c/tests/mojio_impl_test_base.h
index 46d283f..f5f5fa5 100644
--- a/services/files/c/tests/mojio_impl_test_base.h
+++ b/mojo/services/files/public/c/tests/mojio_impl_test_base.h
@@ -5,9 +5,9 @@
 #ifndef SERVICES_FILES_C_TESTS_MOJIO_IMPL_TEST_BASE_H_
 #define SERVICES_FILES_C_TESTS_MOJIO_IMPL_TEST_BASE_H_
 
+#include "files/public/interfaces/directory.mojom.h"
 #include "mojo/public/cpp/application/application_test_base.h"
 #include "mojo/public/cpp/system/macros.h"
-#include "mojo/services/files/public/interfaces/directory.mojom.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/mojio_sys_stat_unittest.cc b/mojo/services/files/public/c/tests/mojio_sys_stat_unittest.cc
similarity index 91%
rename from services/files/c/tests/mojio_sys_stat_unittest.cc
rename to mojo/services/files/public/c/tests/mojio_sys_stat_unittest.cc
index c057354..f170326 100644
--- a/services/files/c/tests/mojio_sys_stat_unittest.cc
+++ b/mojo/services/files/public/c/tests/mojio_sys_stat_unittest.cc
@@ -8,10 +8,10 @@
 #include <errno.h>
 #include <string.h>
 
-#include "services/files/c/mojio_fcntl.h"
-#include "services/files/c/mojio_sys_stat.h"
-#include "services/files/c/mojio_unistd.h"
-#include "services/files/c/tests/mojio_test_base.h"
+#include "files/public/c/mojio_fcntl.h"
+#include "files/public/c/mojio_sys_stat.h"
+#include "files/public/c/mojio_unistd.h"
+#include "files/public/c/tests/mojio_test_base.h"
 
 namespace {
 
diff --git a/services/files/c/tests/mojio_test_base.cc b/mojo/services/files/public/c/tests/mojio_test_base.cc
similarity index 89%
rename from services/files/c/tests/mojio_test_base.cc
rename to mojo/services/files/public/c/tests/mojio_test_base.cc
index 6451607..1cae74f 100644
--- a/services/files/c/tests/mojio_test_base.cc
+++ b/mojo/services/files/public/c/tests/mojio_test_base.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/tests/mojio_test_base.h"
+#include "files/public/c/tests/mojio_test_base.h"
 
+#include "files/public/c/lib/singletons.h"
 #include "mojo/public/cpp/environment/logging.h"
-#include "services/files/c/lib/singletons.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/mojio_test_base.h b/mojo/services/files/public/c/tests/mojio_test_base.h
similarity index 92%
rename from services/files/c/tests/mojio_test_base.h
rename to mojo/services/files/public/c/tests/mojio_test_base.h
index a63e9e3..6cf64c2 100644
--- a/services/files/c/tests/mojio_test_base.h
+++ b/mojo/services/files/public/c/tests/mojio_test_base.h
@@ -5,7 +5,7 @@
 #ifndef SERVICES_FILES_C_TESTS_MOJIO_TEST_BASE_H_
 #define SERVICES_FILES_C_TESTS_MOJIO_TEST_BASE_H_
 
-#include "services/files/c/tests/mojio_impl_test_base.h"
+#include "files/public/c/tests/mojio_impl_test_base.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/mojio_unistd_unittest.cc b/mojo/services/files/public/c/tests/mojio_unistd_unittest.cc
similarity index 95%
rename from services/files/c/tests/mojio_unistd_unittest.cc
rename to mojo/services/files/public/c/tests/mojio_unistd_unittest.cc
index a30d504..bb6af7f 100644
--- a/services/files/c/tests/mojio_unistd_unittest.cc
+++ b/mojo/services/files/public/c/tests/mojio_unistd_unittest.cc
@@ -9,10 +9,10 @@
 #include <errno.h>
 #include <string.h>
 
-#include "services/files/c/mojio_fcntl.h"
-#include "services/files/c/mojio_sys_stat.h"
-#include "services/files/c/mojio_unistd.h"
-#include "services/files/c/tests/mojio_test_base.h"
+#include "files/public/c/mojio_fcntl.h"
+#include "files/public/c/mojio_sys_stat.h"
+#include "files/public/c/mojio_unistd.h"
+#include "files/public/c/tests/mojio_test_base.h"
 
 namespace {
 
diff --git a/services/files/c/tests/real_errno_impl_unittest.cc b/mojo/services/files/public/c/tests/real_errno_impl_unittest.cc
similarity index 90%
rename from services/files/c/tests/real_errno_impl_unittest.cc
rename to mojo/services/files/public/c/tests/real_errno_impl_unittest.cc
index 51072fe..e8bd650 100644
--- a/services/files/c/tests/real_errno_impl_unittest.cc
+++ b/mojo/services/files/public/c/tests/real_errno_impl_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/real_errno_impl.h"
+#include "files/public/c/lib/real_errno_impl.h"
 
 #include <errno.h>
 
diff --git a/services/files/c/tests/test_utils.cc b/mojo/services/files/public/c/tests/test_utils.cc
similarity index 93%
rename from services/files/c/tests/test_utils.cc
rename to mojo/services/files/public/c/tests/test_utils.cc
index 47a0884..5ef9e9a 100644
--- a/services/files/c/tests/test_utils.cc
+++ b/mojo/services/files/public/c/tests/test_utils.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/tests/test_utils.h"
+#include "files/public/c/tests/test_utils.h"
 
+#include "files/public/c/lib/template_util.h"
+#include "files/public/interfaces/file.mojom.h"
+#include "files/public/interfaces/types.mojom.h"
 #include "mojo/public/cpp/environment/logging.h"
-#include "mojo/services/files/public/interfaces/file.mojom.h"
-#include "mojo/services/files/public/interfaces/types.mojom.h"
-#include "services/files/c/lib/template_util.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/test_utils.h b/mojo/services/files/public/c/tests/test_utils.h
similarity index 93%
rename from services/files/c/tests/test_utils.h
rename to mojo/services/files/public/c/tests/test_utils.h
index cd3c876..4d3174f 100644
--- a/services/files/c/tests/test_utils.h
+++ b/mojo/services/files/public/c/tests/test_utils.h
@@ -10,8 +10,8 @@
 
 #include <string>
 
-#include "mojo/services/files/public/interfaces/directory.mojom.h"
-#include "mojo/services/files/public/interfaces/file.mojom.h"
+#include "files/public/interfaces/directory.mojom.h"
+#include "files/public/interfaces/file.mojom.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/test_utils_unittest.cc b/mojo/services/files/public/c/tests/test_utils_unittest.cc
similarity index 91%
rename from services/files/c/tests/test_utils_unittest.cc
rename to mojo/services/files/public/c/tests/test_utils_unittest.cc
index 51cba81..f407cd1 100644
--- a/services/files/c/tests/test_utils_unittest.cc
+++ b/mojo/services/files/public/c/tests/test_utils_unittest.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/tests/test_utils.h"
+#include "files/public/c/tests/test_utils.h"
 
 #include <errno.h>
 
-#include "services/files/c/tests/mock_errno_impl.h"
-#include "services/files/c/tests/mojio_impl_test_base.h"
-#include "services/files/c/tests/test_utils.h"
+#include "files/public/c/tests/mock_errno_impl.h"
+#include "files/public/c/tests/mojio_impl_test_base.h"
+#include "files/public/c/tests/test_utils.h"
 
 namespace mojio {
 namespace test {
diff --git a/services/files/c/tests/util_unittest.cc b/mojo/services/files/public/c/tests/util_unittest.cc
similarity index 91%
rename from services/files/c/tests/util_unittest.cc
rename to mojo/services/files/public/c/tests/util_unittest.cc
index 680ff4a..3196d2d 100644
--- a/services/files/c/tests/util_unittest.cc
+++ b/mojo/services/files/public/c/tests/util_unittest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/files/c/lib/util.h"
+#include "files/public/c/lib/util.h"
 
+#include "files/public/interfaces/types.mojom.h"
 #include "mojo/public/cpp/system/macros.h"
-#include "mojo/services/files/public/interfaces/types.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace mojio {