Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: src/public/nacl_file_info.h

Issue 261683002: Make a NaClDesc ctor for creating descs from NaClFileInfo. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: review Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/trusted/desc/build.scons » ('j') | src/trusted/desc/nacl_desc_wrapper.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/public/nacl_file_info.h
diff --git a/src/public/nacl_file_info.h b/src/public/nacl_file_info.h
new file mode 100644
index 0000000000000000000000000000000000000000..b43d3ee54232444f6d6d979391c8c0a1d40e19e0
--- /dev/null
+++ b/src/public/nacl_file_info.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2013 The Native Client 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 NATIVE_CLIENT_SRC_PUBLIC_NACL_FILE_INFO_H_
+#define NATIVE_CLIENT_SRC_PUBLIC_NACL_FILE_INFO_H_
+
+#include "native_client/src/include/nacl_base.h"
+#include "native_client/src/include/portability.h"
+
+EXTERN_C_BEGIN
+
+struct NaClDesc;
+
+/*
+ * NaClFileToken is a single-use nonce that the NaCl process can use to query
+ * the browser process for trusted information about a file. This helps
+ * establish that the file is known by the browser to be immutable and
+ * suitable for file-identity-based validation caching.
+ * lo == 0 && hi == 0 indicates the token is invalid and no additional
+ * information is available (see NaClFileTokenIsValid()).
+ */
+struct NaClFileToken {
+ uint64_t lo;
+ uint64_t hi;
+};
+
+static INLINE int NaClFileTokenIsValid(struct NaClFileToken *file_token) {
+ return !(file_token->lo == 0 && file_token->hi == 0);
+}
+
+struct NaClFileInfo {
+ /* desc is either a Unix file descriptor or a Windows file handle. */
+ 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
+ struct NaClFileToken file_token;
+};
+
+/*
+ * Creates a NaClDesc from the file descriptor/file handle and metadata
+ * in |info|, and associates that desc with the metadata.
+ */
+struct NaClDesc *NaClDescIoFromFileInfo(struct NaClFileInfo info,
+ int mode);
+
+
+EXTERN_C_END
+
+#endif /* NATIVE_CLIENT_SRC_PUBLIC_NACL_FILE_INFO_H_ */
« no previous file with comments | « no previous file | src/trusted/desc/build.scons » ('j') | src/trusted/desc/nacl_desc_wrapper.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698