Re: [Xenomai-core] [PATCH v3 17/24] rttest: Resolved test device conflicts via separate name spaces

2010-04-18 Thread Jan Kiszka
Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> From: Jan Kiszka 
>>
>> 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.
>>
>> To allow addressing old drivers with new user space and vice versa, a
>> config switch is added to the former to select the naming scheme, and
>> the latter will try to open under both names.
>>
>> Signed-off-by: Jan Kiszka 
> 
> Could we please have the devices named after the same name as the driver?
> So switchtst -> switchtest
> tmbench->timerbench

We can (now that I know your preferences).

Jan



signature.asc
Description: OpenPGP digital signature
___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH v3 17/24] rttest: Resolved test device conflicts via separate name spaces

2010-04-18 Thread Gilles Chanteperdrix
Jan Kiszka wrote:
> From: Jan Kiszka 
> 
> 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.
> 
> To allow addressing old drivers with new user space and vice versa, a
> config switch is added to the former to select the naming scheme, and
> the latter will try to open under both names.
> 
> Signed-off-by: Jan Kiszka 

Could we please have the devices named after the same name as the driver?
So switchtst -> switchtest
tmbench->timerbench


-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


[Xenomai-core] [PATCH v3 17/24] rttest: Resolved test device conflicts via separate name spaces

2010-04-18 Thread Jan Kiszka
From: Jan Kiszka 

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.

To allow addressing old drivers with new user space and vice versa, a
config switch is added to the former to select the naming scheme, and
the latter will try to open under both names.

Signed-off-by: Jan Kiszka 
---
 include/rtdm/rttesting.h  |   10 +++---
 ksrc/drivers/testing/Config.in|2 ++
 ksrc/drivers/testing/Kconfig  |9 +
 ksrc/drivers/testing/irqbench.c   |9 +++--
 ksrc/drivers/testing/klat.c   |8 +++-
 ksrc/drivers/testing/switchtest.c |7 ++-
 ksrc/drivers/testing/timerbench.c |7 ++-
 src/testsuite/irqbench/irqloop.c  |   11 ++-
 src/testsuite/latency/latency.c   |   12 +++-
 src/testsuite/switchtest/switchtest.c |   13 -
 10 files changed, 77 insertions(+), 11 deletions(-)

diff --git a/include/rtdm/rttesting.h b/include/rtdm/rttesting.h
index ce0418e..56df43b 100644
--- a/include/rtdm/rttesting.h
+++ b/include/rtdm/rttesting.h
@@ -29,13 +29,14 @@
  * Feel free to comment on this profile via the Xenomai mailing list
  * (xenomai-core@gna.org) or directly to the author (jan.kis...@web.de).
  *
- * @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 >= 0 @n
+ * @ref rtdm_device.device_name "Device Name": @c "rttest[-]",
+ * 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 
 
-#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
 /** @} */
 
diff --git a/ksrc/drivers/testing/Config.in b/ksrc/drivers/testing/Config.in
index 07bd900..3552670 100644
--- a/ksrc/drivers/testing/Config.in
+++ b/ksrc/drivers/testing/Config.in
@@ -5,6 +5,8 @@
 mainmenu_option next_comment
 comment 'Testing drivers'
 
+bool 'Use legacy names for testing drivers' 
CONFIG_XENO_DRIVERS_TESTING_LEGACY_NAMES $CONFIG_XENO_SKIN_RTDM
+
 dep_tristate 'Timer benchmark driver' CONFIG_XENO_DRIVERS_TIMERBENCH 
$CONFIG_XENO_SKIN_RTDM
 
 dep_tristate 'IRQ benchmark driver' CONFIG_XENO_DRIVERS_IRQBENCH 
$CONFIG_XENO_SKIN_RTDM
diff --git a/ksrc/drivers/testing/Kconfig b/ksrc/drivers/testing/Kconfig
index 7ca2eb1..05d6a49 100644
--- a/ksrc/drivers/testing/Kconfig
+++ b/ksrc/drivers/testing/Kconfig
@@ -4,6 +4,15 @@ config XENO_TESTING_MODULE
 depends on MODULES
def_tristate m
 
+config XENO_DRIVERS_TESTING_LEGACY_NAMES
+   depends on XENO_SKIN_RTDM
+   bool "Use legacy names for testing drivers"
+   help
+   This lets the testing drivers register under legacy names
+   ("rttest") instead of the new scheme ("rttest-").
+   Only enable this if you plan to use old userspace tools with the
+   drivers.
+
 config XENO_DRIVERS_TIMERBENCH
depends on XENO_SKIN_RTDM
tristate "Timer benchmark driver"
diff --git a/ksrc/drivers/testing/irqbench.c b/ksrc/drivers/testing/irqbench.c
index 3dfb646..ab9686a 100644
--- a/ksrc/drivers/testing/irqbench.c
+++ b/ksrc/drivers/testing/irqbench.c
@@ -515,8 +515,13 @@ 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,
+#ifdef CONFIG_XENO_DRIVERS_TESTING_LEGACY_NAMES
+"rttest%d",
+#else
+"rttest-irqbench%d",
+#endif
+ start_index);
err = rtdm_dev_register(&device);
 
start_index++;
diff --git a/ksrc/drivers/testing/klat.c b/ksrc/drivers/testing/klat.c
index 6070c26..ac4d680 100644
--- a/ksrc/drivers/testing/klat.c
+++ b/ksrc/drivers/testing/klat.c
@@ -99,7 +99,13 @@ static int __init klat_mod_init(void)
pkt.config.freeze_max = freeze_max;
 
for (dev_nr = 0; dev_nr < DEV_NR_MAX; dev_nr++) {
-   snprintf(devname, sizeof(devname), "rttest%d", dev_nr);
+   snprintf(devname, sizeof(devname),
+#ifdef CONFIG_XENO_DRIVERS_TESTI