Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can be | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 #ifndef NATIVE_CLIENT_SRC_PUBLIC_NACL_FILE_INFO_H_ | |
| 8 #define NATIVE_CLIENT_SRC_PUBLIC_NACL_FILE_INFO_H_ | |
| 9 | |
| 10 #include "native_client/src/include/nacl_base.h" | |
| 11 #include "native_client/src/include/portability.h" | |
| 12 | |
| 13 EXTERN_C_BEGIN | |
| 14 | |
| 15 struct NaClDesc; | |
| 16 | |
| 17 /* | |
| 18 * NaClFileToken is a single-use nonce that the NaCl process can use to query | |
| 19 * the browser process for trusted information about a file. This helps | |
| 20 * establish that the file is known by the browser to be immutable and | |
| 21 * suitable for file-identity-based validation caching. | |
| 22 * lo == 0 && hi == 0 indicates the token is invalid and no additional | |
| 23 * information is available (see NaClFileTokenIsValid()). | |
| 24 */ | |
| 25 struct NaClFileToken { | |
| 26 uint64_t lo; | |
| 27 uint64_t hi; | |
| 28 }; | |
| 29 | |
| 30 static INLINE int NaClFileTokenIsValid(struct NaClFileToken *file_token) { | |
| 31 return !(file_token->lo == 0 && file_token->hi == 0); | |
| 32 } | |
| 33 | |
| 34 struct NaClFileInfo { | |
| 35 /* desc is either a Unix file descriptor or a Windows file handle. */ | |
| 36 int32_t desc; | |
|
jvoung (off chromium)
2014/05/16 18:02:05
btw, Nick do you remember what the original intent
Mark Seaborn
2014/05/16 18:23:29
If this field contains a Windows handle, I think i
jvoung (off chromium)
2014/05/16 20:58:43
Okay, on further inspection, it looks like all the
| |
| 37 struct NaClFileToken file_token; | |
| 38 }; | |
| 39 | |
| 40 /* | |
| 41 * Creates a NaClDesc from the file descriptor/file handle and metadata | |
| 42 * in |info|, and associates that desc with the metadata. | |
| 43 */ | |
| 44 struct NaClDesc *NaClDescIoFromFileInfo(struct NaClFileInfo info, | |
| 45 int mode); | |
| 46 | |
| 47 | |
| 48 EXTERN_C_END | |
| 49 | |
| 50 #endif /* NATIVE_CLIENT_SRC_PUBLIC_NACL_FILE_INFO_H_ */ | |
| OLD | NEW |