[Xenomai-git] Philippe Gerum : cobalt/uapi: allow up to 128 distinct clock identifiers

2015-02-12 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: d99d0235cf8de888ce3199c2a44cc9bea482d3c9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d99d0235cf8de888ce3199c2a44cc9bea482d3c9

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Nov  5 11:47:44 2014 +0100

cobalt/uapi: allow up to 128 distinct clock identifiers

As more POSIX clocks are being defined by the regular kernel, we need
to reserve a larger namespace (32) for their identifiers. At this
chance, the Cobalt namespace for static and dynamic clocks is extended
too (32 and 64 ids respectively).

As a consequence of this change, we limit the pshared attribute to a
plain boolean value to get additional encoding space in some base type
(i.e. condvar attribute).

---

 include/cobalt/uapi/thread.h |7 ---
 include/cobalt/uapi/time.h   |   19 +++
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/include/cobalt/uapi/thread.h b/include/cobalt/uapi/thread.h
index 714af43..28fc681 100644
--- a/include/cobalt/uapi/thread.h
+++ b/include/cobalt/uapi/thread.h
@@ -28,12 +28,13 @@
 struct cobalt_mutexattr {
int type : 3;
int protocol : 3;
-   int pshared : 2;
+   int pshared : 1;
+   int __pad : 1;
 };
 
 struct cobalt_condattr {
-   int clock : 6;
-   int pshared : 2;
+   int clock : 7;
+   int pshared : 1;
 };
 
 struct cobalt_threadstat {
diff --git a/include/cobalt/uapi/time.h b/include/cobalt/uapi/time.h
index 10ad8ce..4a3679b 100644
--- a/include/cobalt/uapi/time.h
+++ b/include/cobalt/uapi/time.h
@@ -27,19 +27,22 @@
  * of the POSIX and Linux kernel definitions so that no ambiguities
  * arise when porting applications in both directions.
  *
- * 0  .. 7   regular POSIX/linux clock ids.
- * 8  .. 31  statically reserved Cobalt clocks
- * 32 .. 63  dynamically registered Cobalt clocks (external)
+ * 0  .. 31   regular POSIX/linux clock ids.
+ * 32 .. 63   statically reserved Cobalt clocks
+ * 64 .. 127  dynamically registered Cobalt clocks (external)
+ *
+ * CAUTION: clock ids must fit within a 7bit value, see
+ * include/cobalt/uapi/thread.h (e.g. cobalt_condattr).
  */
-#define __COBALT_CLOCK_STATIC(nr)  ((clockid_t)(nr + 8))
+#define __COBALT_CLOCK_STATIC(nr)  ((clockid_t)(nr + 32))
 
 #define CLOCK_HOST_REALTIME  __COBALT_CLOCK_STATIC(0)
 
-#define COBALT_MAX_EXTCLOCKS  32
+#define COBALT_MAX_EXTCLOCKS  64
 
-#define __COBALT_CLOCK_EXT(nr) ((clockid_t)(nr) | (1  5))
-#define __COBALT_CLOCK_EXT_P(id)   ((int)(id)  (1  5))
-#define __COBALT_CLOCK_EXT_INDEX(id)   ((int)(id)  ~(1  5))
+#define __COBALT_CLOCK_EXT(nr) ((clockid_t)(nr) | (1  6))
+#define __COBALT_CLOCK_EXT_P(id)   ((int)(id)  (1  6))
+#define __COBALT_CLOCK_EXT_INDEX(id)   ((int)(id)  ~(1  6))
 
 /*
  * Additional timerfd defines


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


[Xenomai-git] Philippe Gerum : cobalt/uapi: allow up to 128 distinct clock identifiers

2014-11-05 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d99d0235cf8de888ce3199c2a44cc9bea482d3c9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d99d0235cf8de888ce3199c2a44cc9bea482d3c9

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Nov  5 11:47:44 2014 +0100

cobalt/uapi: allow up to 128 distinct clock identifiers

As more POSIX clocks are being defined by the regular kernel, we need
to reserve a larger namespace (32) for their identifiers. At this
chance, the Cobalt namespace for static and dynamic clocks is extended
too (32 and 64 ids respectively).

As a consequence of this change, we limit the pshared attribute to a
plain boolean value to get additional encoding space in some base type
(i.e. condvar attribute).

---

 include/cobalt/uapi/thread.h |7 ---
 include/cobalt/uapi/time.h   |   19 +++
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/include/cobalt/uapi/thread.h b/include/cobalt/uapi/thread.h
index 714af43..28fc681 100644
--- a/include/cobalt/uapi/thread.h
+++ b/include/cobalt/uapi/thread.h
@@ -28,12 +28,13 @@
 struct cobalt_mutexattr {
int type : 3;
int protocol : 3;
-   int pshared : 2;
+   int pshared : 1;
+   int __pad : 1;
 };
 
 struct cobalt_condattr {
-   int clock : 6;
-   int pshared : 2;
+   int clock : 7;
+   int pshared : 1;
 };
 
 struct cobalt_threadstat {
diff --git a/include/cobalt/uapi/time.h b/include/cobalt/uapi/time.h
index 10ad8ce..4a3679b 100644
--- a/include/cobalt/uapi/time.h
+++ b/include/cobalt/uapi/time.h
@@ -27,19 +27,22 @@
  * of the POSIX and Linux kernel definitions so that no ambiguities
  * arise when porting applications in both directions.
  *
- * 0  .. 7   regular POSIX/linux clock ids.
- * 8  .. 31  statically reserved Cobalt clocks
- * 32 .. 63  dynamically registered Cobalt clocks (external)
+ * 0  .. 31   regular POSIX/linux clock ids.
+ * 32 .. 63   statically reserved Cobalt clocks
+ * 64 .. 127  dynamically registered Cobalt clocks (external)
+ *
+ * CAUTION: clock ids must fit within a 7bit value, see
+ * include/cobalt/uapi/thread.h (e.g. cobalt_condattr).
  */
-#define __COBALT_CLOCK_STATIC(nr)  ((clockid_t)(nr + 8))
+#define __COBALT_CLOCK_STATIC(nr)  ((clockid_t)(nr + 32))
 
 #define CLOCK_HOST_REALTIME  __COBALT_CLOCK_STATIC(0)
 
-#define COBALT_MAX_EXTCLOCKS  32
+#define COBALT_MAX_EXTCLOCKS  64
 
-#define __COBALT_CLOCK_EXT(nr) ((clockid_t)(nr) | (1  5))
-#define __COBALT_CLOCK_EXT_P(id)   ((int)(id)  (1  5))
-#define __COBALT_CLOCK_EXT_INDEX(id)   ((int)(id)  ~(1  5))
+#define __COBALT_CLOCK_EXT(nr) ((clockid_t)(nr) | (1  6))
+#define __COBALT_CLOCK_EXT_P(id)   ((int)(id)  (1  6))
+#define __COBALT_CLOCK_EXT_INDEX(id)   ((int)(id)  ~(1  6))
 
 /*
  * Additional timerfd defines


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