mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
In particular, the libxg wrapper for unxz.c uses char for bool_t which is a major antipattern. Luckily the code doesn't suffer from truncated values. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
46 lines
855 B
C
46 lines
855 B
C
#include <stdio.h>
|
|
#include INCLUDE_ENDIAN_H
|
|
#include <stdlib.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <inttypes.h>
|
|
|
|
#include "xg_private.h"
|
|
#include "xg_dom_decompress_unsafe.h"
|
|
|
|
// TODO
|
|
#define XZ_DEC_X86
|
|
|
|
typedef uint8_t u8;
|
|
typedef uint16_t u16;
|
|
typedef uint32_t u32;
|
|
typedef uint32_t __le32;
|
|
|
|
static inline u32 cpu_to_le32(const u32 v)
|
|
{
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
return (((v & 0x000000ffUL) << 24) |
|
|
((v & 0x0000ff00UL) << 8) |
|
|
((v & 0x00ff0000UL) >> 8) |
|
|
((v & 0xff000000UL) >> 24));
|
|
#else
|
|
return v;
|
|
#endif
|
|
}
|
|
|
|
static inline u32 le32_to_cpup(const u32 *p)
|
|
{
|
|
return cpu_to_le32(*p);
|
|
}
|
|
|
|
#define __force
|
|
#define always_inline
|
|
|
|
#include "../../xen/common/unxz.c"
|
|
|
|
int xc_try_xz_decode(
|
|
struct xc_dom_image *dom, void **blob, size_t *size)
|
|
{
|
|
return xc_dom_decompress_unsafe(unxz, dom, blob, size);
|
|
}
|