patch-2.4.10 linux/include/linux/kernel.h
Next file: linux/include/linux/list.h
Previous file: linux/include/linux/kbd_kern.h
Back to the patch index
Back to the overall index
- Lines: 70
- Date:
Sun Sep 23 10:31:01 2001
- Orig file:
v2.4.9/linux/include/linux/kernel.h
- Orig date:
Mon Aug 27 12:41:48 2001
diff -u --recursive --new-file v2.4.9/linux/include/linux/kernel.h linux/include/linux/kernel.h
@@ -10,6 +10,7 @@
#include <stdarg.h>
#include <linux/linkage.h>
#include <linux/stddef.h>
+#include <linux/types.h>
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
@@ -61,6 +62,13 @@
extern long long simple_strtoll(const char *,char **,unsigned int);
extern int sprintf(char * buf, const char * fmt, ...);
extern int vsprintf(char *buf, const char *, va_list);
+extern int snprintf(char * buf, size_t size, const char *fmt, ...);
+extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
+
+extern int sscanf(const char *, const char *, ...)
+ __attribute__ ((format (scanf,2,3)));
+extern int vsscanf(const char *, const char *, va_list);
+
extern int get_option(char **str, int *pint);
extern char *get_options(char *str, int nints, int *ints);
extern unsigned long long memparse(char *ptr, char **retptr);
@@ -85,6 +93,9 @@
console_loglevel = 15;
}
+extern void bust_spinlocks(int yes);
+extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
+
#if DEBUG
#define pr_debug(fmt,arg...) \
printk(KERN_DEBUG fmt,##arg)
@@ -112,10 +123,33 @@
((unsigned char *)&addr)[1], \
((unsigned char *)&addr)[0]
-#define min(type,x,y) \
- ({ type __x = (x), __y = (y); __x < __y ? __x: __y; })
-#define max(type,x,y) \
- ({ type __x = (x), __y = (y); __x > __y ? __x: __y; })
+/*
+ * min()/max() macros that also do
+ * strict type-checking.. See the
+ * "unnecessary" pointer comparison.
+ */
+#define min(x,y) ({ \
+ const typeof(x) _x = (x); \
+ const typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x < _y ? _x : _y; })
+
+#define max(x,y) ({ \
+ const typeof(x) _x = (x); \
+ const typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x > _y ? _x : _y; })
+
+/*
+ * ..and if you can't take the strict
+ * types, you can specify one yourself.
+ *
+ * Or not use min/max at all, of course.
+ */
+#define min_t(type,x,y) \
+ ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
+#define max_t(type,x,y) \
+ ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
#endif /* __KERNEL__ */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)