libsdbfs-kernel.h 1.08 KB
Newer Older
1 2 3 4 5 6 7 8 9
/*
 * This supports both the Linux kernel and barebox, that is similar
 * by design, and defines __KERNEL__ too.
 */
#ifdef __BAREBOX__
#  include <errno.h>
#else /* really linux */
#  include <linux/errno.h>
#endif
10 11 12 13 14 15 16 17 18 19 20 21

#include <linux/types.h>
#include <linux/string.h>
#include <asm/byteorder.h>

/*
 * The default installed /usr/include/linux stuff misses the __KERNEL__ parts.
 * For libsdbfs it means we won't get uint32_t and similar types.
 *
 * So, check if we got the information we need before strange errors happen.
 * The DECLARE_BITMAP macro is in <linux/types.h> since the epoch, but it
 * is not installed in /usr/include/linux/types.h, so use it to check.
22 23 24 25
 *
 * If building for barebox, we miss the macro, but we are sure that
 * we are picking the correct header, because the library is only built
 * within the barebox source tree.
26
 */
27
#if !defined(DECLARE_BITMAP) && !defined(__BAREBOX__)
28 29 30 31 32 33 34 35
#  error "Please point LINUX to a source tree if you define __KERNEL__"
#endif

#define SDB_KERNEL	1
#define SDB_USER	0
#define SDB_FREESTAND	0

#define sdb_print(format, ...) printk(format, __VA_ARGS__)