source: GPL/trunk/include/linux/kernel.h@ 772

Last change on this file since 772 was 772, checked in by David Azarewicz, 4 months ago

Merge in changes from 6.6-LTS branch.
Fixed additional 25+ problems.

File size: 4.3 KB
Line 
1#ifndef _LINUX_KERNEL_H
2#define _LINUX_KERNEL_H
3
4/*
5 * 'kernel.h' contains some often-used function prototypes etc
6 */
7
8#ifdef __KERNEL__
9
10#include <stdlib.h>
11#include <stdarg.h>
12//#include <linux/linkage.h>
13#include <linux/bitops.h>
14#include <linux/gfp.h>
15#include <linux/types.h>
16#include <linux/log2.h>
17#include <linux/string.h>
18#include <linux/math.h>
19#include <linux/minmax.h>
20#include <linux/export.h>
21
22/* Optimization barrier */
23/* The "volatile" is due to gcc bugs */
24//#define barrier() __asm__ __volatile__("": : :"memory")
25#define barrier()
26
27#define STACK_MAGIC 0xdeadbeef
28
29#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
30
31#define KERN_EMERG "<0>" /* system is unusable */
32#define KERN_ALERT "<1>" /* action must be taken immediately */
33#define KERN_CRIT "<2>" /* critical conditions */
34#define KERN_ERR "<3>" /* error conditions */
35#define KERN_WARNING "<4>" /* warning conditions */
36#define KERN_NOTICE "<5>" /* normal but significant condition */
37#define KERN_INFO "<6>" /* informational */
38#define KERN_DEBUG "<7>" /* debug-level messages */
39
40# define NORET_TYPE /**/
41# define ATTRIB_NORET __attribute__((noreturn))
42# define NORET_AND noreturn,
43
44#ifdef __i386__
45#define FASTCALL(x) x __attribute__((regparm(3)))
46#else
47#define FASTCALL(x) x
48#endif
49
50extern void math_error(void);
51extern struct notifier_block *panic_notifier_list;
52NORET_TYPE void panic(const char * fmt, ...);
53
54NORET_TYPE void do_exit(long error_code);
55
56#define simple_strtoul strtoul
57extern long simple_strtol(const char *,char **,unsigned int);
58extern int sprintf(char * buf, const char * fmt, ...);
59extern int vsprintf(char *buf, const char *, va_list);
60extern int get_option(char **str, int *pint);
61extern char *get_options(char *str, int nints, int *ints);
62
63extern int session_of_pgrp(int pgrp);
64
65int cdecl printk(const char * fmt, ...);
66
67
68/*
69 * Display an IP address in readable format.
70 */
71
72#define NIPQUAD(addr) \
73 ((unsigned char *)&addr)[0], \
74 ((unsigned char *)&addr)[1], \
75 ((unsigned char *)&addr)[2], \
76 ((unsigned char *)&addr)[3]
77
78#endif /* __KERNEL__ */
79
80#define SI_LOAD_SHIFT 16
81struct sysinfo {
82 long uptime; /* Seconds since boot */
83 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
84 unsigned long totalram; /* Total usable main memory size */
85 unsigned long freeram; /* Available memory size */
86 unsigned long sharedram; /* Amount of shared memory */
87 unsigned long bufferram; /* Memory used by buffers */
88 unsigned long totalswap; /* Total swap space size */
89 unsigned long freeswap; /* swap space still available */
90 unsigned short procs; /* Number of current processes */
91 unsigned long totalhigh; /* Total high memory size */
92 unsigned long freehigh; /* Available high memory size */
93 unsigned int mem_unit; /* Memory unit size in bytes */
94 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
95};
96
97static void complete_and_exit(struct completion *, long);
98#define printk_ratelimit() 1
99#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
100#define dump_stack()
101#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
102#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
103int strict_strtoul(const char *, unsigned int, unsigned long *);
104
105#define BUG_ON(condition)
106#define WARN_ON(condition) (void)0
107#define WARN_ON_ONCE(condition) (void)0
108#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
109#define SIZE_MAX (~(size_t)0)
110_WCRTLINK extern int vsnprintf( char *__s, size_t __bufsize,
111 const char *__format, __va_list __arg );
112char *kasprintf(gfp_t gfp, const char *fmt, ...);
113
114char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
115extern int hex_to_bin(char ch);
116#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
117#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
118
119/**
120 * container_of - cast a member of a structure out to the containing structure
121 * @ptr: the pointer to the member.
122 * @type: the type of the container struct this is embedded in.
123 * @member: the name of the member within the struct.
124 *
125 */
126#define container_of(ptr, type, member) \
127( (type *)( (char *)ptr - offsetof(type,member) ) )
128
129_WCRTLINK extern int sscanf( const char *__s, const char *__format, ... );
130
131#endif
Note: See TracBrowser for help on using the repository browser.