Skip to contentSkip to conversation

Jan Kiszka : rttest: Resolved test device conflicts via separate name spaces

Xenomai-core Gilles Chanteperdrix 2 participants 2 messages Apr 16, 2010 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 91 lines · GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: dede8fde31b175ddccaee610b7b0ff21560872a5
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=dede8fde31b175ddccaee610b7b0ff21560872a5
Author: Jan Kiszka <[email protected]>
Date:   Sun Apr 11 17:35:51 2010 +0200

rttest: Resolved test device conflicts via separate name spaces

Usually, all devices of some RTDM class use the same naming scheme. But as test devices are different as they do not provide compatible APIs, let's give them separate name space for their device names. That finally resolves all the detection troubles that showed up once more than one test device was registered.

---

 include/rtdm/rttesting.h              |   10 ++++--
 ksrc/drivers/testing/irqbench.c       |    4 +-
 ksrc/drivers/testing/switchtest.c     |    4 +-
 ksrc/drivers/testing/timerbench.c     |    4 +-
 src/testsuite/irqbench/irqloop.c      |    3 +-
 src/testsuite/latency/latency.c       |    2 +-
 src/testsuite/switchtest/switchtest.c |   50 +++++++-------------------------
 7 files changed, 27 insertions(+), 50 deletions(-)
include/rtdm/rttesting.h +7 -3
index ce0418e..56df43b 100644
@@ -29,13 +29,14 @@
  * Feel free to comment on this profile via the Xenomai mailing list
  * ([email protected]) or directly to the author ([email protected]).
  *
- * @b Profile @b Revision: 1
+ * @b Profile @b Revision: 2
  * @n
  * @n
  * @par Device Characteristics
  * @ref rtdm_device.device_flags "Device Flags": @c RTDM_NAMED_DEVICE @n
  * @n
- * @ref rtdm_device.device_name "Device Name": @c "rttest<N>", N >= 0 @n
+ * @ref rtdm_device.device_name "Device Name": @c "rttest[-<subclass>]<N>",
+ * N >= 0, optional subclass name to simplify device discovery @n
  * @n
  * @ref rtdm_device.device_class "Device Class": @c RTDM_CLASS_TESTING @n
  * @n
@@ -61,7 +62,7 @@
 
 #include <rtdm/rtdm.h>
 
-#define RTTST_PROFILE_VER		1
+#define RTTST_PROFILE_VER		2
 
 typedef struct rttst_bench_res {
 	long long avg;
@@ -145,8 +146,11 @@ struct rttst_swtest_error {
 /*!
  * @name Sub-Classes of RTDM_CLASS_TESTING
  * @{ */
+/** subclass name: "tmbench" */
 #define RTDM_SUBCLASS_TIMERBENCH	0
+/** subclass name: "irqbench" */
 #define RTDM_SUBCLASS_IRQBENCH		1
+/** subclass name: "switchtst" */
 #define RTDM_SUBCLASS_SWITCHTEST	2
 /** @} */
 
ksrc/drivers/testing/irqbench.c +2 -2
index 3dfb646..db520cb 100644
@@ -515,8 +515,8 @@ static int __init __irqbench_init(void)
 	int err;
 
 	do {
-		snprintf(device.device_name, RTDM_MAX_DEVNAME_LEN, "rttest%d",
-			 start_index);
+		snprintf(device.device_name, RTDM_MAX_DEVNAME_LEN,
+			 "rttest-irqbench%d", start_index);
 		err = rtdm_dev_register(&device);
 
 		start_index++;
ksrc/drivers/testing/switchtest.c +0 -0
index 057094b..47702fc 100644

ksrc/drivers/testing/switchtest.c int __init __switchtest_init(void) · line 754

Quoted 7 lines
ksrc/drivers/testing/switchtest.c +2 -2
@@ -750,8 +750,8 @@ int __init __switchtest_init(void)
 	int err;
 
 	do {
-		snprintf(device.device_name, RTDM_MAX_DEVNAME_LEN, "rttest%d",
-			 start_index);
+		snprintf(device.device_name, RTDM_MAX_DEVNAME_LEN,
+			 "rttest-switchtst%d", start_index);

Why not rttest-switchtest ?

Signature · 1 line
					    Gilles.
#2 lore raw
Quoted 94 lines · Gilles Chanteperdrix
Quoted 93 lines · GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: dede8fde31b175ddccaee610b7b0ff21560872a5
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=dede8fde31b175ddccaee610b7b0ff21560872a5
Author: Jan Kiszka <[email protected]>
Date:   Sun Apr 11 17:35:51 2010 +0200

rttest: Resolved test device conflicts via separate name spaces

Usually, all devices of some RTDM class use the same naming scheme. But as test devices are different as they do not provide compatible APIs, let's give them separate name space for their device names. That finally resolves all the detection troubles that showed up once more than one test device was registered.

---

 include/rtdm/rttesting.h              |   10 ++++--
 ksrc/drivers/testing/irqbench.c       |    4 +-
 ksrc/drivers/testing/switchtest.c     |    4 +-
 ksrc/drivers/testing/timerbench.c     |    4 +-
 src/testsuite/irqbench/irqloop.c      |    3 +-
 src/testsuite/latency/latency.c       |    2 +-
 src/testsuite/switchtest/switchtest.c |   50 +++++++-------------------------
 7 files changed, 27 insertions(+), 50 deletions(-)
include/rtdm/rttesting.h +7 -3
index ce0418e..56df43b 100644
@@ -29,13 +29,14 @@
  * Feel free to comment on this profile via the Xenomai mailing list
  * ([email protected]) or directly to the author ([email protected]).
  *
- * @b Profile @b Revision: 1
+ * @b Profile @b Revision: 2
  * @n
  * @n
  * @par Device Characteristics
  * @ref rtdm_device.device_flags "Device Flags": @c RTDM_NAMED_DEVICE @n
  * @n
- * @ref rtdm_device.device_name "Device Name": @c "rttest<N>", N >= 0 @n
+ * @ref rtdm_device.device_name "Device Name": @c "rttest[-<subclass>]<N>",
+ * N >= 0, optional subclass name to simplify device discovery @n
  * @n
  * @ref rtdm_device.device_class "Device Class": @c RTDM_CLASS_TESTING @n
  * @n
@@ -61,7 +62,7 @@
 
 #include <rtdm/rtdm.h>
 
-#define RTTST_PROFILE_VER		1
+#define RTTST_PROFILE_VER		2
 
 typedef struct rttst_bench_res {
 	long long avg;
@@ -145,8 +146,11 @@ struct rttst_swtest_error {
 /*!
  * @name Sub-Classes of RTDM_CLASS_TESTING
  * @{ */
+/** subclass name: "tmbench" */
 #define RTDM_SUBCLASS_TIMERBENCH	0
+/** subclass name: "irqbench" */
 #define RTDM_SUBCLASS_IRQBENCH		1
+/** subclass name: "switchtst" */
 #define RTDM_SUBCLASS_SWITCHTEST	2
 /** @} */
 
ksrc/drivers/testing/irqbench.c +2 -2
index 3dfb646..db520cb 100644
@@ -515,8 +515,8 @@ static int __init __irqbench_init(void)
 	int err;
 
 	do {
-		snprintf(device.device_name, RTDM_MAX_DEVNAME_LEN, "rttest%d",
-			 start_index);
+		snprintf(device.device_name, RTDM_MAX_DEVNAME_LEN,
+			 "rttest-irqbench%d", start_index);
 		err = rtdm_dev_register(&device);
 
 		start_index++;
ksrc/drivers/testing/switchtest.c +0 -0
index 057094b..47702fc 100644
@@ -750,8 +750,8 @@ int __init __switchtest_init(void)
 	int err;
 
Quoted 7 lines

ksrc/drivers/testing/switchtest.c int __init __switchtest_init(void) · line 754

Quoted 5 lines
ksrc/drivers/testing/switchtest.c +2 -2
 	do {
-		snprintf(device.device_name, RTDM_MAX_DEVNAME_LEN, "rttest%d",
-			 start_index);
+		snprintf(device.device_name, RTDM_MAX_DEVNAME_LEN,
+			 "rttest-switchtst%d", start_index);

Why not rttest-switchtest ?

Probably an attempt to keep the name shorter. I can post a version with the 'e' included if you prefer.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux