src/file/SDL_rwops.c
changeset 8833 ae720d61d14d
parent 8761 bce4122e6e87
child 8850 7e248a233387
--- a/src/file/SDL_rwops.c	Thu Jun 05 15:37:33 2014 -0700
+++ b/src/file/SDL_rwops.c	Fri Jun 06 15:45:59 2014 -0300
@@ -43,6 +43,10 @@
 #include "SDL_system.h"
 #endif
 
+#if __NACL__
+#include "nacl_io/nacl_io.h"
+#endif
+
 #ifdef __WIN32__
 
 /* Functions to read/write Win32 API file pointers */
@@ -762,4 +766,28 @@
     return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
 }
 
+
+/* SDL_RWops on NACL are implemented using nacl_io, and require mount points
+ * to be established before actual file operations are performed
+ * 
+ * Ref: https://developers.google.com/native-client/dev/devguide/coding/nacl_io?hl=es
+ */
+
+int 
+SDL_RWMount(const char* source, const char* target, const char* filesystemtype, 
+          unsigned long mountflags, const void *data) {
+#if __NACL__
+    return mount(source, target, filesystemtype, mountflags, data);
+#endif /* __NACL__ */
+    return SDL_SetError ("Mount not supported on this platform");
+}
+
+int 
+SDL_RWUmount(const char *target) {
+#if __NACL__
+    return umount(target);
+#endif /* __NACL__ */
+    return SDL_SetError ("Umount not supported on this platform");
+}
+
 /* vi: set ts=4 sw=4 expandtab: */