RTEMS 6.1-rc1
kernel.h
1#ifndef __LINUX_KERNEL_H__
2#define __LINUX_KERNEL_H__
3
4#include <stdlib.h>
5#include <string.h>
6
7#include "kernel-rtems.h"
8
9#define jiffies ((unsigned long)rtems_clock_get_ticks_since_boot())
10
11#define ERR_PTR(err) ((void*)((intptr_t)(err)))
12#define PTR_ERR(err) ((unsigned long)(err))
13#define IS_ERR(err) ((unsigned long)err > (unsigned long)-1000L)
14static inline void *ERR_CAST(const void *ptr)
15{
16 return (void *) (uintptr_t) ptr;
17}
18
19#define CURRENT_TIME cyg_timestamp()
20
21#define KERN_EMERG "<0>"
22#define KERN_ALERT "<1>"
23#define KERN_CRIT "<2>"
24#define KERN_ERR "<3>"
25#define KERN_WARNING "<4>"
26#define KERN_NOTICE "<5>"
27#define KERN_INFO "<6>"
28#define KERN_DEBUG "<7>"
29#define KERN_CONT ""
30
31#ifndef pr_fmt
32#define pr_fmt(fmt) fmt
33#endif
34
35#define pr_emerg(fmt, ...) \
36 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
37#define pr_alert(fmt, ...) \
38 printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
39#define pr_crit(fmt, ...) \
40 printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
41#define pr_err(fmt, ...) \
42 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
43#define pr_warning(fmt, ...) \
44 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
45#define pr_warn pr_warning
46#define pr_notice(fmt, ...) \
47 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
48#define pr_info(fmt, ...) \
49 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
50#define pr_cont(fmt, ...) \
51 printk(KERN_CONT fmt, ##__VA_ARGS__)
52
53#ifdef DEBUG
54#define pr_debug(fmt, ...) \
55 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
56#else
57static inline int no_printk(const char *fmt, ...)
58{
59 (void) fmt;
60 return 0;
61}
62#define pr_debug(fmt, ...) \
63 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
64#endif
65
66#define min(x,y) (x<y?x:y)
67#define max(x,y) (x<y?y:x)
68#define min_t(t, x,y) ((t)x<(t)y?(t)x:(t)y)
69
70#define capable(x) 0
71
72#define kmemdup(x, y, z) do_kmemdup(x, y)
73
74#define from_kuid(x, y) (y)
75#define from_kgid(x, y) (y)
76#define i_uid_read(x) ((x)->i_uid)
77#define i_gid_read(x) ((x)->i_gid)
78#define i_uid_write(x, y) do { (x)->i_uid = (y); } while (0)
79#define i_gid_write(x, y) do { (x)->i_gid = (y); } while (0)
80#define truncate_setsize(x, y) do { (x)->i_size = (y); } while (0)
81
82#endif /* __LINUX_KERNEL_H__ */