diff options
author | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-10 07:27:18 +0000 |
---|---|---|
committer | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-10 07:27:18 +0000 |
commit | fe35ae2ac2b4da2063dfa601a2cc2c40618ff128 (patch) | |
tree | 938abeef8997b792070feff2d8910de468d1c301 /native_client_sdk | |
parent | 11cdbfa3e43b67d5f4ad37701ce82bf71fd1616f (diff) | |
download | chromium_src-fe35ae2ac2b4da2063dfa601a2cc2c40618ff128.zip chromium_src-fe35ae2ac2b4da2063dfa601a2cc2c40618ff128.tar.gz chromium_src-fe35ae2ac2b4da2063dfa601a2cc2c40618ff128.tar.bz2 |
[NaCL SDK] Ship sys/mount.h for newlib/pnacl.
The primary motivation for this change was to remove the
unnecessary include of kernel_wrap.h from nacl_io.h.
In doing this is realised that we shouldn't be declaring
the mount(2) function in nacl_io.h but instread relying
on <sys/mount.h> for this.
The doxygen comment that was previously attached to
the mount(2) declaration was merged with nacl_io_init.
R=binji@chromium.org
Review URL: https://codereview.chromium.org/22642016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
9 files changed, 50 insertions, 15 deletions
diff --git a/native_client_sdk/src/build_tools/sdk_files.list b/native_client_sdk/src/build_tools/sdk_files.list index 73b075a..a210f4a 100644 --- a/native_client_sdk/src/build_tools/sdk_files.list +++ b/native_client_sdk/src/build_tools/sdk_files.list @@ -361,6 +361,7 @@ include/newlib/netinet/in.h include/newlib/netinet/tcp.h include/newlib/netinet6/in6.h include/newlib/poll.h +include/newlib/sys/mount.h include/newlib/sys/select.h include/newlib/sys/socket.h include/newlib/sys/termios.h @@ -371,6 +372,7 @@ include/pnacl/netinet/in.h include/pnacl/netinet/tcp.h include/pnacl/netinet6/in6.h include/pnacl/poll.h +include/pnacl/sys/mount.h include/pnacl/sys/select.h include/pnacl/sys/socket.h include/pnacl/sys/termios.h diff --git a/native_client_sdk/src/examples/demo/flock/flock.cc b/native_client_sdk/src/examples/demo/flock/flock.cc index de23691..94707a0 100644 --- a/native_client_sdk/src/examples/demo/flock/flock.cc +++ b/native_client_sdk/src/examples/demo/flock/flock.cc @@ -5,14 +5,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/mount.h> #include <algorithm> #include <sstream> #include <string> #include <vector> -#include "nacl_io/nacl_io.h" - #include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_size.h" diff --git a/native_client_sdk/src/examples/demo/nacl_io/nacl_io_demo.c b/native_client_sdk/src/examples/demo/nacl_io/nacl_io_demo.c index 9a1babd..c38fefc 100644 --- a/native_client_sdk/src/examples/demo/nacl_io/nacl_io_demo.c +++ b/native_client_sdk/src/examples/demo/nacl_io/nacl_io_demo.c @@ -9,6 +9,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/mount.h> #include <pthread.h> #include "ppapi/c/pp_errors.h" diff --git a/native_client_sdk/src/examples/tutorial/dlopen/dlopen.cc b/native_client_sdk/src/examples/tutorial/dlopen/dlopen.cc index 9291464..8b5df97 100644 --- a/native_client_sdk/src/examples/tutorial/dlopen/dlopen.cc +++ b/native_client_sdk/src/examples/tutorial/dlopen/dlopen.cc @@ -7,6 +7,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/mount.h> #include <ppapi/cpp/completion_callback.h> #include <ppapi/cpp/instance.h> diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/mount.h b/native_client_sdk/src/libraries/nacl_io/include/sys/mount.h new file mode 100644 index 0000000..dde0ab3 --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/include/sys/mount.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#ifndef LIBRARIES_NACL_IO_INCLUDE_SYS_MOUNT_H +#define LIBRARIES_NACL_IO_INCLUDE_SYS_MOUNT_H + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +int mount(const char* source, const char* target, const char* filesystemtype, + unsigned long mountflags, const void *data); + +int umount(const char *target); + +__END_DECLS + +#endif /* LIBRARIES_NACL_IO_INCLUDE_SYS_MOUNT_H */ diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h b/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h index 8eabbd9..a817565 100644 --- a/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h +++ b/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h @@ -2,8 +2,8 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#ifndef SYS_TERMIOS_H_ -#define SYS_TERMIOS_H_ +#ifndef LIBRARIES_NACL_IO_INCLUDE_SYS_TERMIOS_H_ +#define LIBRARIES_NACL_IO_INCLUDE_SYS_TERMIOS_H_ #define IGNBRK 0000001 #define BRKINT 0000002 @@ -126,4 +126,4 @@ int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); __END_DECLS -#endif /* SYS_TERMIOS_H_ */ +#endif /* LIBRARIES_NACL_IO_INCLUDE_SYS_TERMIOS_H_ */ diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h b/native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h index 2e3cd3d..2292915 100644 --- a/native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h +++ b/native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h @@ -2,8 +2,8 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#ifndef LIBRARIES_NACL_SYS_UTSNAME_H_ -#define LIBRARIES_NACL_SYS_UTSNAME_H_ +#ifndef LIBRARIES_NACL_IO_INCLUDE_SYS_UTSNAME_H_ +#define LIBRARIES_NACL_IO_INCLUDE_SYS_UTSNAME_H_ #define _UTSNAME_LENGTH 65 @@ -15,6 +15,12 @@ struct utsname { char machine[_UTSNAME_LENGTH]; }; +#include <sys/cdefs.h> + +__BEGIN_DECLS + int uname(struct utsname *buf); -#endif +__END_DECLS + +#endif /* LIBRARIES_NACL_IO_INCLUDE_SYS_UTSNAME_H_ */ diff --git a/native_client_sdk/src/libraries/nacl_io/library.dsc b/native_client_sdk/src/libraries/nacl_io/library.dsc index 41c999a..4d75b2c 100644 --- a/native_client_sdk/src/libraries/nacl_io/library.dsc +++ b/native_client_sdk/src/libraries/nacl_io/library.dsc @@ -149,6 +149,7 @@ "netinet/tcp.h", "netinet6/in6.h", "poll.h", + "sys/mount.h", "sys/select.h", "sys/socket.h", "sys/termios.h", @@ -164,6 +165,7 @@ "netinet/tcp.h", "netinet6/in6.h", "poll.h", + "sys/mount.h", "sys/select.h", "sys/socket.h", "sys/termios.h", diff --git a/native_client_sdk/src/libraries/nacl_io/nacl_io.h b/native_client_sdk/src/libraries/nacl_io/nacl_io.h index e72b5a5..058ba68 100644 --- a/native_client_sdk/src/libraries/nacl_io/nacl_io.h +++ b/native_client_sdk/src/libraries/nacl_io/nacl_io.h @@ -8,20 +8,20 @@ #include <ppapi/c/pp_instance.h> #include <ppapi/c/ppb.h> -#include "nacl_io/kernel_wrap.h" #include "sdk_util/macros.h" EXTERN_C_BEGIN - -/** Initialize nacl_io. +/** + * Initialize nacl_io. * * NOTE: If you initialize nacl_io with this constructor, you cannot * use any mounts that require PPAPI; e.g. persistent storage, etc. */ void nacl_io_init(); -/** Initialize nacl_io with PPAPI support. +/** + * Initialize nacl_io with PPAPI support. * * Usage: * PP_Instance instance; @@ -42,7 +42,11 @@ void nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface); -/** Mount a new filesystem type. +/** + * Mount a new filesystem type. + * + * This function is declared in <sys/mount.h>, but we document it here + * because nacl_io is controlled primarily through mount(2)/umount(2). * * Some parameters are dependent on the filesystem type being mounted. * @@ -108,9 +112,10 @@ void nacl_io_init_ppapi(PP_Instance instance, * @param[in] mountflags Unused. * @param[in] data Depends on the filesystem type. See above. * @return 0 on success, -1 on failure (with errno set). + * + * int mount(const char* source, const char* target, const char* filesystemtype, + * unsigned long mountflags, const void *data) NOTHROW; */ -int mount(const char* source, const char* target, const char* filesystemtype, - unsigned long mountflags, const void *data) NOTHROW; EXTERN_C_END |