Module: xenomai-forge
Branch: next
Commit: 5612f7418311192ed945b6049d883b6045e91e5e
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=5612f7418311192ed945b6049d883b6045e91e5e

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Aug  8 09:36:38 2013 +0200

copperplate: move init settings to copperplate/init.h

---

 include/copperplate/init.h        |   14 ++++++++++++++
 lib/copperplate/heapobj-pshared.c |    1 +
 lib/copperplate/heapobj-tlsf.c    |    1 +
 lib/copperplate/init.c            |   16 ++++++++++++++--
 lib/copperplate/internal.c        |   13 +------------
 lib/copperplate/internal.h        |   14 --------------
 lib/copperplate/registry.c        |    1 +
 lib/copperplate/traceobj.c        |    1 +
 8 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/include/copperplate/init.h b/include/copperplate/init.h
index 03e9231..69e5672 100644
--- a/include/copperplate/init.h
+++ b/include/copperplate/init.h
@@ -20,9 +20,21 @@
 #define _COPPERPLATE_INIT_H
 
 #include <stdarg.h>
+#include <sched.h>
 #include <copperplate/trace.h>
 #include <copperplate/list.h>
 
+struct coppernode {
+       unsigned int mem_pool;
+       const char *session_label;
+       const char *registry_root;
+       cpu_set_t cpu_affinity;
+       int no_mlock;
+       int no_registry;
+       int reset_session;
+       int silent_mode;
+};
+
 struct option;
 
 struct copperskin {
@@ -56,4 +68,6 @@ const char *symerror(int errnum);
 }
 #endif
 
+extern struct coppernode __node_info;
+
 #endif /* _COPPERPLATE_INIT_H */
diff --git a/lib/copperplate/heapobj-pshared.c 
b/lib/copperplate/heapobj-pshared.c
index b8308e0..d283bdc 100644
--- a/lib/copperplate/heapobj-pshared.c
+++ b/lib/copperplate/heapobj-pshared.c
@@ -39,6 +39,7 @@
 #include "copperplate/hash.h"
 #include "copperplate/heapobj.h"
 #include "copperplate/debug.h"
+#include "copperplate/init.h"
 #include "internal.h"
 
 #define HOBJ_PAGE_SHIFT        9       /* 2^9 => 512 bytes */
diff --git a/lib/copperplate/heapobj-tlsf.c b/lib/copperplate/heapobj-tlsf.c
index d824a81..e4ae0dd 100644
--- a/lib/copperplate/heapobj-tlsf.c
+++ b/lib/copperplate/heapobj-tlsf.c
@@ -21,6 +21,7 @@
 #include <stdint.h>
 #include "copperplate/heapobj.h"
 #include "copperplate/debug.h"
+#include "copperplate/init.h"
 #include "tlsf/tlsf.h"
 #include "internal.h"
 
diff --git a/lib/copperplate/init.c b/lib/copperplate/init.c
index 98139f2..de17f47 100644
--- a/lib/copperplate/init.c
+++ b/lib/copperplate/init.c
@@ -39,6 +39,18 @@
 #include "copperplate/debug.h"
 #include "internal.h"
 
+struct coppernode __node_info = {
+       .mem_pool = 1024 * 1024, /* Default, 1Mb. */
+       .session_label = "anon",
+       .registry_root = "/mnt/xenomai",
+       .no_mlock = 0,
+       .no_registry = 0,
+       .reset_session = 0,
+       .silent_mode = 0,
+};
+
+pid_t __node_id;
+
 struct timespec __init_date;
 
 static DEFINE_PRIVATE_LIST(skins);
@@ -182,8 +194,8 @@ static int collect_cpu_affinity(const char *cpu_list)
        ret = sched_setaffinity(0, sizeof(__node_info.cpu_affinity),
                                &__node_info.cpu_affinity);
        if (ret) {
-               warning("no valid CPU in affinity list '%s'", cpu_list);
-               return __bt(-ret);
+               warning("invalid CPU in affinity list '%s'", cpu_list);
+               return __bt(-errno);
        }
 
        return 0;
diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index 865ba85..12daf45 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -28,20 +28,9 @@
 #include <linux/unistd.h>
 #include <copperplate/clockobj.h>
 #include <copperplate/threadobj.h>
+#include <copperplate/init.h>
 #include "internal.h"
 
-struct coppernode __node_info = {
-       .mem_pool = 1024 * 1024, /* Default, 1Mb. */
-       .session_label = "anon",
-       .registry_root = "/mnt/xenomai",
-       .no_mlock = 0,
-       .no_registry = 0,
-       .reset_session = 0,
-       .silent_mode = 0,
-};
-
-pid_t __node_id;
-
 pthread_mutex_t __printlock;
 
 pid_t copperplate_get_tid(void)
diff --git a/lib/copperplate/internal.h b/lib/copperplate/internal.h
index 72e8982..5a63b10 100644
--- a/lib/copperplate/internal.h
+++ b/lib/copperplate/internal.h
@@ -28,18 +28,6 @@
 #include <copperplate/list.h>
 #include <copperplate/heapobj.h>
 
-struct coppernode {
-       unsigned int mem_pool;
-       const char *session_label;
-       const char *registry_root;
-       cpu_set_t cpu_affinity;
-       /* No bitfield below, we have to take address of thoses. */
-       int no_mlock;
-       int no_registry;
-       int reset_session;
-       int silent_mode;
-};
-
 #define HOBJ_MINLOG2    3
 #define HOBJ_MAXLOG2    22     /* Must hold pagemap::bcount objects */
 #define HOBJ_NBUCKETS   (HOBJ_MAXLOG2 - HOBJ_MINLOG2 + 2)
@@ -75,8 +63,6 @@ struct corethread_attributes {
 
 extern pid_t __node_id;
 
-extern struct coppernode __node_info;
-
 extern struct timespec __init_date;
 
 extern const char *dashes;
diff --git a/lib/copperplate/registry.c b/lib/copperplate/registry.c
index 68882e3..3b0d7f6 100644
--- a/lib/copperplate/registry.c
+++ b/lib/copperplate/registry.c
@@ -42,6 +42,7 @@
 #include "copperplate/lock.h"
 #include "copperplate/hash.h"
 #include "copperplate/debug.h"
+#include "copperplate/init.h"
 #include "internal.h"
 
 /*
diff --git a/lib/copperplate/traceobj.c b/lib/copperplate/traceobj.c
index a6b9d9b..355071f 100644
--- a/lib/copperplate/traceobj.c
+++ b/lib/copperplate/traceobj.c
@@ -4,6 +4,7 @@
 #include "copperplate/traceobj.h"
 #include "copperplate/threadobj.h"
 #include "copperplate/heapobj.h"
+#include "copperplate/init.h"
 #include "internal.h"
 
 struct tracemark {


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to