| OLD | NEW |
| (Empty) |
| 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 * Use of this source code is governed by a BSD-style license that can be | |
| 3 * found in the LICENSE file. | |
| 4 */ | |
| 5 #ifndef LIBRARIES_NACL_MOUNTS_NACL_MOUNTS_H_ | |
| 6 #define LIBRARIES_NACL_MOUNTS_NACL_MOUNTS_H_ | |
| 7 | |
| 8 #include <ppapi/c/pp_instance.h> | |
| 9 #include <ppapi/c/ppb.h> | |
| 10 | |
| 11 #include "nacl_mounts/kernel_wrap.h" | |
| 12 #include "utils/macros.h" | |
| 13 | |
| 14 EXTERN_C_BEGIN | |
| 15 | |
| 16 | |
| 17 /** Initialize nacl_mounts. | |
| 18 * | |
| 19 * NOTE: If you initialize nacl_mounts with this constructor, you cannot | |
| 20 * use any mounts that require PPAPI; e.g. persistent storage, etc. | |
| 21 */ | |
| 22 void nacl_mounts_init(); | |
| 23 | |
| 24 /** Initialize nacl_mounts with PPAPI support. | |
| 25 * | |
| 26 * Usage: | |
| 27 * PP_Instance instance; | |
| 28 * PPB_GetInterface get_interface; | |
| 29 * nacl_mounts_init(instance, get_interface); | |
| 30 * | |
| 31 * If you are using the PPAPI C interface: | |
| 32 * |instance| is passed to your instance in the DidCreate function. | |
| 33 * |get_interface| is passed to your module in the PPP_InitializeModule | |
| 34 * function. | |
| 35 * | |
| 36 * If you are using the PPAPI C++ interface: | |
| 37 * |instance| can be retrieved via the pp::Instance::pp_instance() method. | |
| 38 * |get_interface| can be retrieved via | |
| 39 * pp::Module::Get()->get_browser_interface() | |
| 40 */ | |
| 41 void nacl_mounts_init_ppapi(PP_Instance instance, | |
| 42 PPB_GetInterface get_interface); | |
| 43 | |
| 44 | |
| 45 /** Mount a new filesystem type. | |
| 46 * | |
| 47 * Some parameters are dependent on the filesystem type being mounted. | |
| 48 * | |
| 49 * The |data| parameter, if used, is always parsed as a string of comma | |
| 50 * separated key-value pairs: | |
| 51 * e.g. "key1=param1,key2=param2" | |
| 52 * | |
| 53 * | |
| 54 * filesystem types: | |
| 55 * "memfs": An in-memory filesystem. | |
| 56 * source: Unused. | |
| 57 * data: Unused. | |
| 58 * | |
| 59 * "dev": A filesystem with various utility nodes. Some examples: | |
| 60 * "null": equivalent to /dev/null. | |
| 61 * "zero": equivalent to /dev/zero. | |
| 62 * "urandom": equivalent to /dev/urandom. | |
| 63 * "console[0-3]": logs to the JavaScript console with varying log | |
| 64 * levels. | |
| 65 * "tty": Posts a message to JavaScript, which will send a "message" | |
| 66 * event from this module's embed element. | |
| 67 * source: Unused. | |
| 68 * data: Unused. | |
| 69 * | |
| 70 * "html5fs": A filesystem that uses PPAPI FileSystem interface, which can be | |
| 71 * read in JavaScript via the HTML5 FileSystem API. This mount | |
| 72 * provides the use of persistent storage. Please read the | |
| 73 * documentation in ppapi/c/ppb_file_system.h for more information. | |
| 74 * source: Unused. | |
| 75 * data: A string of parameters: | |
| 76 * "type": Which type of filesystem to mount. Valid values are | |
| 77 * "PERSISTENT" and "TEMPORARY". The default is "PERSISTENT". | |
| 78 * "expected_size": The expected file-system size. Note that this does | |
| 79 * not request quota -- you must do that from JavaScript. | |
| 80 * | |
| 81 * "httpfs": A filesystem that reads from a URL via HTTP. | |
| 82 * source: The root URL to read from. All paths read from this filesystem | |
| 83 * will be appended to this root. | |
| 84 * e.g. If source == "http://example.com/path", reading from | |
| 85 * "foo/bar.txt" will attempt to read from the URL | |
| 86 * "http://example.com/path/foo/bar.txt". | |
| 87 * data: A string of parameters: | |
| 88 * "allow_cross_origin_request": If "true", then reads from this | |
| 89 * filesystem will follow the CORS standard for cross-origin requests. | |
| 90 * See http://www.w3.org/TR/access-control. | |
| 91 * "allow_credentials": If "true", credentials are sent with cross-origin | |
| 92 * requests. If false, no credentials are sent with the request and | |
| 93 * cookies are ignored in the response. | |
| 94 * All other key/value pairs are assumed to be headers to use with | |
| 95 * HTTP requests. | |
| 96 * | |
| 97 * | |
| 98 * @param[in] source Depends on the filesystem type. See above. | |
| 99 * @param[in] target The absolute path to mount the filesystem. | |
| 100 * @param[in] filesystemtype The name of the filesystem type to mount. See | |
| 101 * above for examples. | |
| 102 * @param[in] mountflags Unused. | |
| 103 * @param[in] data Depends on the filesystem type. See above. | |
| 104 * @return 0 on success, -1 on failure (with errno set). | |
| 105 */ | |
| 106 int mount(const char* source, const char* target, const char* filesystemtype, | |
| 107 unsigned long mountflags, const void *data) NOTHROW; | |
| 108 | |
| 109 EXTERN_C_END | |
| 110 | |
| 111 #endif // LIBRARIES_NACL_MOUNTS_NACL_MOUNTS_H_ | |
| OLD | NEW |