ust: add usterr.h
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Sat, 7 Feb 2009 17:55:46 +0000 (12:55 -0500)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Sat, 7 Feb 2009 17:55:46 +0000 (12:55 -0500)
libmarkers/kernelcompat.h [deleted file]
share/kernelcompat.h [new file with mode: 0644]
share/usterr.h [new file with mode: 0644]

diff --git a/libmarkers/kernelcompat.h b/libmarkers/kernelcompat.h
deleted file mode 100644 (file)
index b6615ee..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef KERNELCOMPAT_H
-#define KERNELCOMPAT_H
-
-#include <string.h>
-
-#define container_of(ptr, type, member) ({                      \
-        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-        (type *)( (char *)__mptr - offsetof(type,member) );})
-
-#define KERN_DEBUG
-#define KERN_NOTICE
-
-static inline void *ERR_PTR(long error)
-{
-        return (void *) error;
-}
-
-
-#include <stdint.h>
-
-typedef uint16_t u16;
-typedef uint32_t u32;
-
-
-#include <pthread.h>
-
-#define DEFINE_MUTEX(m) pthread_mutex_t (m) = PTHREAD_MUTEX_INITIALIZER;
-
-#define mutex_lock(m) pthread_mutex_lock(m)
-
-#define mutex_unlock(m) pthread_mutex_unlock(m)
-
-
-#include <stdlib.h>
-
-#define kmalloc(s, t) malloc(s)
-#define kzalloc(s, t) malloc(s)
-#define kfree(p) free((void *)p)
-#define kstrdup(s, t) strdup(s)
-
-
-#include <stdio.h>
-#define printk(fmt, args...) printf(fmt, ## args)
-
-
-
-#define smp_rmb()
-#define smp_wmb()
-
-
-#define read_barrier_depends()
-#define smp_read_barrier_depends()
-
-
-#define rcu_assign_pointer(a, b)
-#endif /* KERNELCOMPAT_H */
diff --git a/share/kernelcompat.h b/share/kernelcompat.h
new file mode 100644 (file)
index 0000000..b6615ee
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef KERNELCOMPAT_H
+#define KERNELCOMPAT_H
+
+#include <string.h>
+
+#define container_of(ptr, type, member) ({                      \
+        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
+        (type *)( (char *)__mptr - offsetof(type,member) );})
+
+#define KERN_DEBUG
+#define KERN_NOTICE
+
+static inline void *ERR_PTR(long error)
+{
+        return (void *) error;
+}
+
+
+#include <stdint.h>
+
+typedef uint16_t u16;
+typedef uint32_t u32;
+
+
+#include <pthread.h>
+
+#define DEFINE_MUTEX(m) pthread_mutex_t (m) = PTHREAD_MUTEX_INITIALIZER;
+
+#define mutex_lock(m) pthread_mutex_lock(m)
+
+#define mutex_unlock(m) pthread_mutex_unlock(m)
+
+
+#include <stdlib.h>
+
+#define kmalloc(s, t) malloc(s)
+#define kzalloc(s, t) malloc(s)
+#define kfree(p) free((void *)p)
+#define kstrdup(s, t) strdup(s)
+
+
+#include <stdio.h>
+#define printk(fmt, args...) printf(fmt, ## args)
+
+
+
+#define smp_rmb()
+#define smp_wmb()
+
+
+#define read_barrier_depends()
+#define smp_read_barrier_depends()
+
+
+#define rcu_assign_pointer(a, b)
+#endif /* KERNELCOMPAT_H */
diff --git a/share/usterr.h b/share/usterr.h
new file mode 100644 (file)
index 0000000..6b871ff
--- /dev/null
@@ -0,0 +1,8 @@
+#define DBG(fmt, args...) fprintf(stderr, fmt "\n", ## args)
+#define WARN(fmt, args...) fprintf(stderr, "usertrace: WARNING: " fmt "\n", ## args)
+#define ERR(fmt, args...) fprintf(stderr, "usertrace: ERROR: " fmt "\n", ## args)
+#define PERROR(call) perror("usertrace: ERROR: " call)
+
+#define BUG_ON(condition) do { if (unlikely(condition)) ERR("condition not respected (BUG)"); } while(0)
+#define WARN_ON(condition) do { if (unlikely(condition)) WARN("condition not respected"); } while(0)
+
This page took 0.024665 seconds and 4 git commands to generate.