source: trunk/packages/xen-3.1/xen-3.1/xen/common/libelf/libelf-private.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 1.6 KB
Line 
1#ifndef __LIBELF_PRIVATE_H__
2#define __LIBELF_PRIVATE_H_
3
4#ifdef __XEN__
5
6#include <xen/config.h>
7#include <xen/types.h>
8#include <xen/string.h>
9#include <xen/lib.h>
10#include <asm/byteorder.h>
11#include <public/elfnote.h>
12#include <public/libelf.h>
13
14#define elf_msg(elf, fmt, args ... ) \
15   if (elf->verbose) printk(fmt, ## args )
16#define elf_err(elf, fmt, args ... ) \
17   printk(fmt, ## args )
18
19#define strtoull(str, end, base) simple_strtoull(str, end, base)
20#define bswap_16(x) swab16(x)
21#define bswap_32(x) swab32(x)
22#define bswap_64(x) swab64(x)
23
24#else /* !__XEN__ */
25
26#include <stdio.h>
27#include <stdlib.h>
28#include <string.h>
29#include <stddef.h>
30#include <inttypes.h>
31#ifdef __sun__
32#include <sys/byteorder.h>
33#define bswap_16(x) BSWAP_16(x)
34#define bswap_32(x) BSWAP_32(x)
35#define bswap_64(x) BSWAP_64(x)
36#else
37#include <byteswap.h>
38#endif
39#include <xen/elfnote.h>
40#include <xen/libelf.h>
41
42#include "xenctrl.h"
43#include "xc_private.h"
44
45#define elf_msg(elf, fmt, args ... ) \
46    if (elf->log && elf->verbose) fprintf(elf->log, fmt , ## args )
47#define elf_err(elf, fmt, args ... ) do {               \
48    if (elf->log)                                       \
49        fprintf(elf->log, fmt , ## args );              \
50    xc_set_error(XC_INVALID_KERNEL, fmt , ## args );    \
51} while (0)
52
53#define safe_strcpy(d,s)                        \
54do { strncpy((d),(s),sizeof((d))-1);            \
55     (d)[sizeof((d))-1] = '\0';                 \
56} while (0)
57
58#endif
59
60#endif /* __LIBELF_PRIVATE_H_ */
61
62/*
63 * Local variables:
64 * mode: C
65 * c-set-style: "BSD"
66 * c-basic-offset: 4
67 * tab-width: 4
68 * indent-tabs-mode: nil
69 * End:
70 */
Note: See TracBrowser for help on using the repository browser.