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

Side by Side Diff: src/trusted/service_runtime/fs/xdr.h

Issue 10512008: Remove some unused code that fails to compile with -Wundef (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/trusted/service_runtime/fs/obj_proxy_test.c ('k') | src/trusted/service_runtime/fs/xdr.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2008 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file.
5 */
6
7 /*
8 * NaCl file system mini XDR-like serialization of basic types.
9 *
10 * NB: this code has not been integrated with the rest of NaCl, and is
11 * likely to change.
12 */
13
14 #ifndef NATIVE_CLIENT_SERVICE_RUNTIME_FS_XDR_H_
15 #define NATIVE_CLIENT_SERVICE_RUNTIME_FS_XDR_H_
16
17 #include <string.h>
18
19 #include "native_client/src/include/portability.h"
20 #include "native_client/src/trusted/service_runtime/include/machine/_types.h"
21
22 EXTERN_C_BEGIN
23
24 /*
25 * knowledge about sizes for types of various file system RPC message
26 * structures' members is not baked in here, but only in
27 * machine/_types.h
28 *
29 * memcpy is (typically) a compiler intrinsic, so we should get
30 * efficient code while maintaining type safety. there are no byte
31 * order issues when IMC can only communicate between processes on the
32 * system.
33 *
34 * we violate the convention for in/out arg order so that code for
35 * externalizatin/internalization of structures can be written more
36 * easily using macros.
37 */
38
39 #define D(T) \
40 static INLINE size_t nacl_ext_ ## T(char *buf, nacl_abi_ ## T datum) \
41 { \
42 memcpy((void *) buf, (void *) &datum, sizeof datum); \
43 return sizeof datum; \
44 } \
45 static INLINE size_t nacl_int_ ## T(char *buf, nacl_abi_ ## T *datum) \
46 { \
47 memcpy((void *) datum, (void *) buf, sizeof datum); \
48 return sizeof datum; \
49 }
50
51 D(dev_t)
52 D(ino_t)
53 D(mode_t)
54 D(uid_t)
55 D(gid_t)
56 D(nlink_t)
57 D(off_t)
58 D(time_t)
59 D(size_t)
60 D(ssize_t)
61
62 #undef D
63
64 #define D(T) \
65 static INLINE size_t nacl_ext_ ## T(char *buf, T datum) \
66 { \
67 memcpy((void *) buf, (void *) &datum, sizeof datum); \
68 return sizeof datum; \
69 } \
70 static INLINE size_t nacl_int_ ## T(char *buf, T *datum) \
71 { \
72 memcpy((void *) datum, (void *) buf, sizeof datum); \
73 return sizeof datum; \
74 }
75
76 D(int8_t)
77 D(int16_t)
78 D(int32_t)
79 D(int64_t)
80 D(uint8_t)
81 D(uint16_t)
82 D(uint32_t)
83 D(uint64_t)
84
85 #undef D
86
87 EXTERN_C_END
88
89 #endif /* NATIVE_CLIENT_SERVICE_RUNTIME_FS_XDR_H_ */
OLDNEW
« no previous file with comments | « src/trusted/service_runtime/fs/obj_proxy_test.c ('k') | src/trusted/service_runtime/fs/xdr.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698