diff options
author | Alexander Graf <agraf@suse.de> | 2012-01-31 19:44:41 +0100 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2012-04-06 18:49:58 +0300 |
commit | 6083abd9aa134c9b0804e584f8279f54e6c90a1c (patch) | |
tree | 8e142aa5564218708c8670513414c37b8694c473 /thunk.h | |
parent | 56e904ecb2018e30b10e9ec846635ff3b1e1d923 (diff) |
linux-user: add struct old_dev_t compat
The compat LOOP_SET_STATUS ioctl uses struct old_dev_t in its passed
struct. That variable type is vastly different between different
architectures. Implement wrapping around it so we can use it.
This fixes running arm kpartx on an x86_64 host for me.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'thunk.h')
-rw-r--r-- | thunk.h | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -37,6 +37,7 @@ typedef enum argtype { TYPE_PTR, TYPE_ARRAY, TYPE_STRUCT, + TYPE_OLDDEVT, } argtype; #define MK_PTR(type) TYPE_PTR, type @@ -104,6 +105,31 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host) return TARGET_ABI_BITS / 8; } break; + case TYPE_OLDDEVT: + if (is_host) { +#if defined(HOST_X86_64) + return 8; +#elif defined(HOST_ALPHA) || defined(HOST_IA64) || defined(HOST_MIPS) || \ + defined(HOST_PARISC) || defined(HOST_SPARC64) + return 4; +#elif defined(HOST_PPC) + return HOST_LONG_SIZE; +#else + return 2; +#endif + } else { +#if defined(TARGET_X86_64) + return 8; +#elif defined(TARGET_ALPHA) || defined(TARGET_IA64) || defined(TARGET_MIPS) || \ + defined(TARGET_PARISC) || defined(TARGET_SPARC64) + return 4; +#elif defined(TARGET_PPC) + return TARGET_ABI_BITS / 8; +#else + return 2; +#endif + } + break; case TYPE_ARRAY: size = type_ptr[1]; return size * thunk_type_size_array(type_ptr + 2, is_host); @@ -141,6 +167,8 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host) return TARGET_ABI_BITS / 8; } break; + case TYPE_OLDDEVT: + return thunk_type_size(type_ptr, is_host); case TYPE_ARRAY: return thunk_type_align_array(type_ptr + 2, is_host); case TYPE_STRUCT: |