Rev 4559 | Rev 5178 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4559 | Rev 5056 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | #define LLONG_MAX ((long long)(~0ULL>>1)) |
29 | #define LLONG_MAX ((long long)(~0ULL>>1)) |
30 | #define LLONG_MIN (-LLONG_MAX - 1) |
30 | #define LLONG_MIN (-LLONG_MAX - 1) |
31 | #define ULLONG_MAX (~0ULL) |
31 | #define ULLONG_MAX (~0ULL) |
32 | #define SIZE_MAX (~(size_t)0) |
32 | #define SIZE_MAX (~(size_t)0) |
Line -... | Line 33... | ||
- | 33 | ||
- | 34 | #define U8_MAX ((u8)~0U) |
|
- | 35 | #define S8_MAX ((s8)(U8_MAX>>1)) |
|
- | 36 | #define S8_MIN ((s8)(-S8_MAX - 1)) |
|
- | 37 | #define U16_MAX ((u16)~0U) |
|
- | 38 | #define S16_MAX ((s16)(U16_MAX>>1)) |
|
- | 39 | #define S16_MIN ((s16)(-S16_MAX - 1)) |
|
- | 40 | #define U32_MAX ((u32)~0U) |
|
- | 41 | #define S32_MAX ((s32)(U32_MAX>>1)) |
|
- | 42 | #define S32_MIN ((s32)(-S32_MAX - 1)) |
|
- | 43 | #define U64_MAX ((u64)~0ULL) |
|
- | 44 | #define S64_MAX ((s64)(U64_MAX>>1)) |
|
- | 45 | #define S64_MIN ((s64)(-S64_MAX - 1)) |
|
33 | 46 | ||
34 | #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) |
47 | #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) |
35 | #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) |
48 | #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) |
36 | #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) |
49 | #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) |
Line 124... | Line 137... | ||
124 | * lower_32_bits - return bits 0-31 of a number |
137 | * lower_32_bits - return bits 0-31 of a number |
125 | * @n: the number we're accessing |
138 | * @n: the number we're accessing |
126 | */ |
139 | */ |
127 | #define lower_32_bits(n) ((u32)(n)) |
140 | #define lower_32_bits(n) ((u32)(n)) |
Line -... | Line 141... | ||
- | 141 | ||
- | 142 | ||
- | 143 | ||
- | 144 | #define abs64(x) ({ \ |
|
- | 145 | s64 __x = (x); \ |
|
- | 146 | (__x < 0) ? -__x : __x; \ |
|
- | 147 | }) |
|
128 | 148 | ||
129 | #define KERN_EMERG "<0>" /* system is unusable */ |
149 | #define KERN_EMERG "<0>" /* system is unusable */ |
130 | #define KERN_ALERT "<1>" /* action must be taken immediately */ |
150 | #define KERN_ALERT "<1>" /* action must be taken immediately */ |
131 | #define KERN_CRIT "<2>" /* critical conditions */ |
151 | #define KERN_CRIT "<2>" /* critical conditions */ |
132 | #define KERN_ERR "<3>" /* error conditions */ |
152 | #define KERN_ERR "<3>" /* error conditions */ |
Line 157... | Line 177... | ||
157 | 177 | ||
Line 158... | Line 178... | ||
158 | //int printk(const char *fmt, ...); |
178 | //int printk(const char *fmt, ...); |
Line -... | Line 179... | ||
- | 179 | ||
- | 180 | #define printk(fmt, arg...) dbgprintf(fmt , ##arg) |
|
- | 181 | ||
Line 159... | Line 182... | ||
159 | 182 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); |
|
160 | #define printk(fmt, arg...) dbgprintf(fmt , ##arg) |
183 | extern __printf(2, 3) |
161 | 184 | char *kasprintf(gfp_t gfp, const char *fmt, ...); |
|
162 | 185 | ||
Line 491... | Line 514... | ||
491 | func(info); \ |
514 | func(info); \ |
492 | 0; \ |
515 | 0; \ |
493 | }) |
516 | }) |
Line -... | Line 517... | ||
- | 517 | ||
- | 518 | ||
- | 519 | static inline __must_check long __copy_to_user(void __user *to, |
|
- | 520 | const void *from, unsigned long n) |
|
- | 521 | { |
|
- | 522 | if (__builtin_constant_p(n)) { |
|
- | 523 | switch(n) { |
|
- | 524 | case 1: |
|
- | 525 | *(u8 __force *)to = *(u8 *)from; |
|
- | 526 | return 0; |
|
- | 527 | case 2: |
|
- | 528 | *(u16 __force *)to = *(u16 *)from; |
|
- | 529 | return 0; |
|
- | 530 | case 4: |
|
- | 531 | *(u32 __force *)to = *(u32 *)from; |
|
- | 532 | return 0; |
|
- | 533 | #ifdef CONFIG_64BIT |
|
- | 534 | case 8: |
|
- | 535 | *(u64 __force *)to = *(u64 *)from; |
|
- | 536 | return 0; |
|
- | 537 | #endif |
|
- | 538 | default: |
|
- | 539 | break; |
|
- | 540 | } |
|
- | 541 | } |
|
- | 542 | ||
- | 543 | memcpy((void __force *)to, from, n); |
|
- | 544 | return 0; |
|
- | 545 | } |
|
- | 546 | ||
494 | 547 | struct seq_file; |