| OLD | NEW |
| (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 file system types. | |
| 9 */ | |
| 10 #include "native_client/src/shared/platform/nacl_log.h" | |
| 11 | |
| 12 #include "native_client/src/trusted/service_runtime/include/machine/_types.h" | |
| 13 #include "native_client/src/trusted/service_runtime/fs/fs.h" | |
| 14 #include "native_client/src/trusted/service_runtime/fs/xdr.h" | |
| 15 | |
| 16 /* | |
| 17 * XDR externalization / internalization code for larger data types | |
| 18 * for which the encoder/decoder should not be inlined. | |
| 19 */ | |
| 20 | |
| 21 /* macro used in all externalization/internalization functions */ | |
| 22 #define Ext(T, mem) do { \ | |
| 23 bump += nacl_ext_ ## T(buf + bump, dp->mem); \ | |
| 24 } while (0) | |
| 25 | |
| 26 #define Int(T, mem) do { \ | |
| 27 bump += nacl_int_ ## T(buf + bump, &dp->mem); \ | |
| 28 } while (0) | |
| 29 | |
| 30 #define S(T, mem) do { bump += sizeof(T); } while (0) | |
| 31 | |
| 32 #define G(Tag, Macro) \ | |
| 33 size_t NaCl ## Macro ## Tag(char *buf, struct Tag *dp) { \ | |
| 34 size_t bump = 0; \ | |
| 35 Macro(dev_t, dev); \ | |
| 36 Macro(ino_t, ino); \ | |
| 37 Macro(mode_t, mode); \ | |
| 38 Macro(uid_t, uid); \ | |
| 39 Macro(gid_t, gid); \ | |
| 40 Macro(nlink_t, nlink); \ | |
| 41 Macro(off_t, size); \ | |
| 42 Macro(time_t, atime); \ | |
| 43 Macro(time_t, mtime); \ | |
| 44 Macro(time_t, ctime); \ | |
| 45 \ | |
| 46 return bump; \ | |
| 47 } | |
| 48 | |
| 49 #define F(StructTag) G(StructTag, Ext) G(StructTag, Int) | |
| 50 | |
| 51 F(NaClFileAttr) | |
| 52 | |
| 53 #undef F | |
| 54 #undef G | |
| OLD | NEW |