Skip to contentSkip to conversation

lib: rename TEST_MODULE to TEST_LKM

PATCH In review Valentin Rothberg 4 participants 10 messages Sep 23, 2014 – Sep 29, 2014 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: rename TEST_MODULE to TEST_LKM

The "_MODULE" suffix is reserved for tristates compiled as loadable kernel modules (LKM). The "TEST_MODULE" feature thereby violates this convention. The feature is used to compile the lib/test_module.c kernel module.

This patch renames the feature and its reference in a Makefile to "TEST_LKM", which still expresses the test of a LKM.

---
 lib/Kconfig.debug | 2 +-
 lib/Makefile      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +1 -1
index 07c2832..db91c97 100644
@@ -1627,7 +1627,7 @@ config DMA_API_DEBUG
 
 	  If unsure, say N.
 
-config TEST_MODULE
+config TEST_LKM
 	tristate "Test module loading with 'hello world' module"
 	default n
 	depends on m
lib/Makefile +1 -1
index d6b4bc4..382437a 100644
@@ -31,7 +31,7 @@ obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
 obj-y += kstrtox.o
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
-obj-$(CONFIG_TEST_MODULE) += test_module.o
+obj-$(CONFIG_TEST_LKM) += test_module.o
 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
 obj-$(CONFIG_TEST_BPF) += test_bpf.o
 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Valentin Rothberg

The "_MODULE" suffix is reserved for tristates compiled as loadable kernel modules (LKM). The "TEST_MODULE" feature thereby

Is that documented anywhere?

Was this causing some kind of problem or error? Please tell us what that was if so.

Quoted 39 lines

violates this convention. The feature is used to compile the lib/test_module.c kernel module.

This patch renames the feature and its reference in a Makefile to "TEST_LKM", which still expresses the test of a LKM.

---
 lib/Kconfig.debug | 2 +-
 lib/Makefile      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +1 -1
index 07c2832..db91c97 100644
@@ -1627,7 +1627,7 @@ config DMA_API_DEBUG
 
 	  If unsure, say N.
 
-config TEST_MODULE
+config TEST_LKM
 	tristate "Test module loading with 'hello world' module"
 	default n
 	depends on m
lib/Makefile +1 -1
index d6b4bc4..382437a 100644
@@ -31,7 +31,7 @@ obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
 obj-y += kstrtox.o
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
-obj-$(CONFIG_TEST_MODULE) += test_module.o
+obj-$(CONFIG_TEST_LKM) += test_module.o
 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
 obj-$(CONFIG_TEST_BPF) += test_bpf.o
 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
Signature · 1 line
~Randy
#2 lore raw
Quoted 5 lines · Randy Dunlap
Quoted 2 lines · Valentin Rothberg

The "_MODULE" suffix is reserved for tristates compiled as loadable kernel modules (LKM). The "TEST_MODULE" feature thereby

Is that documented anywhere?

Sadly this is not made explicit, but the Kconfig code documents it. The following code (./scripts/kconfig/confdata.c) is used to generate the autoconf.h header file during the build process. When a feature is selected as a kernel module ('m'), it is suffixed with "_MODULE" to indicate it.

»   »   switch (*value) {
»   »   case 'n':
»   »   »   break;
»   »   case 'm':
»   »   »   suffix = "_MODULE";
»   »   »   /* fall through */
Quoted 1 line

Was this causing some kind of problem or error? Please tell us what that was if so.

It causes problems for static code analysis, which assumes a consistent use of the "_MODULE" suffix.

Another possible change would be to rename the reference in the Makefile to "TEST_MODULE_MODULE". Personally, I prefer my proposed patch.

Quoted 43 lines
Quoted 41 lines

violates this convention. The feature is used to compile the lib/test_module.c kernel module.

This patch renames the feature and its reference in a Makefile to "TEST_LKM", which still expresses the test of a LKM.

---
 lib/Kconfig.debug | 2 +-
 lib/Makefile      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +1 -1
index 07c2832..db91c97 100644
@@ -1627,7 +1627,7 @@ config DMA_API_DEBUG
 
 	  If unsure, say N.
 
-config TEST_MODULE
+config TEST_LKM
 	tristate "Test module loading with 'hello world' module"
 	default n
 	depends on m
lib/Makefile +1 -1
index d6b4bc4..382437a 100644
@@ -31,7 +31,7 @@ obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
 obj-y += kstrtox.o
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
-obj-$(CONFIG_TEST_MODULE) += test_module.o
+obj-$(CONFIG_TEST_LKM) += test_module.o
 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
 obj-$(CONFIG_TEST_BPF) += test_bpf.o
 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
#3 lore raw
Quoted 20 lines · Valentin Rothberg
Quoted 5 lines · Randy Dunlap
Quoted 2 lines · Valentin Rothberg

The "_MODULE" suffix is reserved for tristates compiled as loadable kernel modules (LKM). The "TEST_MODULE" feature thereby

Is that documented anywhere?

Sadly this is not made explicit, but the Kconfig code documents it. The following code (./scripts/kconfig/confdata.c) is used to generate the autoconf.h header file during the build process. When a feature is selected as a kernel module ('m'), it is suffixed with "_MODULE" to indicate it.

»   »   switch (*value) {
»   »   case 'n':
»   »   »   break;
»   »   case 'm':
»   »   »   suffix = "_MODULE";
»   »   »   /* fall through */
Quoted 7 lines
Quoted 1 line

Was this causing some kind of problem or error? Please tell us what that was if so.

It causes problems for static code analysis, which assumes a consistent use of the "_MODULE" suffix.

Another possible change would be to rename the reference in the Makefile to "TEST_MODULE_MODULE". Personally, I prefer my proposed patch.

Sure, your patch is fine, but we need to know *why* the patch is needed.

Thanks.

Quoted 40 lines
Quoted 40 lines
Quoted 40 lines

violates this convention. The feature is used to compile the lib/test_module.c kernel module.

This patch renames the feature and its reference in a Makefile to "TEST_LKM", which still expresses the test of a LKM.

---
 lib/Kconfig.debug | 2 +-
 lib/Makefile      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +1 -1
index 07c2832..db91c97 100644
@@ -1627,7 +1627,7 @@ config DMA_API_DEBUG
 
 	  If unsure, say N.
 
-config TEST_MODULE
+config TEST_LKM
 	tristate "Test module loading with 'hello world' module"
 	default n
 	depends on m
lib/Makefile +1 -1
index d6b4bc4..382437a 100644
@@ -31,7 +31,7 @@ obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
 obj-y += kstrtox.o
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
-obj-$(CONFIG_TEST_MODULE) += test_module.o
+obj-$(CONFIG_TEST_LKM) += test_module.o
 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
 obj-$(CONFIG_TEST_BPF) += test_bpf.o
 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
Signature · 1 line
~Randy
#4 lore raw
Quoted 23 lines · Randy Dunlap
Quoted 22 lines · Valentin Rothberg
Quoted 5 lines · Randy Dunlap
Quoted 2 lines · Valentin Rothberg

The "_MODULE" suffix is reserved for tristates compiled as loadable kernel modules (LKM). The "TEST_MODULE" feature thereby

Is that documented anywhere?

Sadly this is not made explicit, but the Kconfig code documents it. The following code (./scripts/kconfig/confdata.c) is used to generate the autoconf.h header file during the build process. When a feature is selected as a kernel module ('m'), it is suffixed with "_MODULE" to indicate it.

»   »   switch (*value) {
»   »   case 'n':
»   »   »   break;
»   »   case 'm':
»   »   »   suffix = "_MODULE";
»   »   »   /* fall through */
Quoted 1 line

Was this causing some kind of problem or error? Please tell us what that was if so.

Quoted 7 lines
Quoted 5 lines

It causes problems for static code analysis, which assumes a consistent use of the "_MODULE" suffix.

Another possible change would be to rename the reference in the Makefile to "TEST_MODULE_MODULE". Personally, I prefer my proposed patch.

Sure, your patch is fine, but we need to know *why* the patch is needed.

Thank you for pointing that out. I will take care to give more information in future patches.

Thanks,
Valentin

Quoted 44 lines

Thanks.

Quoted 40 lines
Quoted 40 lines
Quoted 40 lines

violates this convention. The feature is used to compile the lib/test_module.c kernel module.

This patch renames the feature and its reference in a Makefile to "TEST_LKM", which still expresses the test of a LKM.

---
 lib/Kconfig.debug | 2 +-
 lib/Makefile      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +1 -1
index 07c2832..db91c97 100644
@@ -1627,7 +1627,7 @@ config DMA_API_DEBUG
 
 	  If unsure, say N.
 
-config TEST_MODULE
+config TEST_LKM
 	tristate "Test module loading with 'hello world' module"
 	default n
 	depends on m
lib/Makefile +1 -1
index d6b4bc4..382437a 100644
@@ -31,7 +31,7 @@ obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
 obj-y += kstrtox.o
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
-obj-$(CONFIG_TEST_MODULE) += test_module.o
+obj-$(CONFIG_TEST_LKM) += test_module.o
 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
 obj-$(CONFIG_TEST_BPF) += test_bpf.o
 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
#5 lore raw

[Perhaps Kees hasn't seen this yet.]

Quoted 30 lines · Valentin Rothberg
Quoted 29 lines · Randy Dunlap
Quoted 27 lines · Valentin Rothberg
Quoted 5 lines · Randy Dunlap
Quoted 2 lines · Valentin Rothberg

The "_MODULE" suffix is reserved for tristates compiled as loadable kernel modules (LKM). The "TEST_MODULE" feature thereby

Is that documented anywhere?

Sadly this is not made explicit, but the Kconfig code documents it. The following code (./scripts/kconfig/confdata.c) is used to generate the autoconf.h header file during the build process. When a feature is selected as a kernel module ('m'), it is suffixed with "_MODULE" to indicate it.

»   »   switch (*value) {
»   »   case 'n':
»   »   »   break;
»   »   case 'm':
»   »   »   suffix = "_MODULE";
»   »   »   /* fall through */
Quoted 1 line

Was this causing some kind of problem or error? Please tell us what that was if so.

It causes problems for static code analysis, which assumes a consistent use of the "_MODULE" suffix.

Another possible change would be to rename the reference in the Makefile to "TEST_MODULE_MODULE". Personally, I prefer my proposed patch.

Quoted 17 lines
Quoted 1 line

Sure, your patch is fine, but we need to know *why* the patch is needed.

Thank you for pointing that out. I will take care to give more information in future patches.

Thanks,
Valentin

Quoted 9 lines

Thanks.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

violates this convention. The feature is used to compile the lib/test_module.c kernel module.

This patch renames the feature and its reference in a Makefile to "TEST_LKM", which still expresses the test of a LKM.

Maybe something like "TEST_MODULE_LOAD"?

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
---
 lib/Kconfig.debug | 2 +-
 lib/Makefile      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +0 -0
index 07c2832..db91c97 100644
@@ -1627,7 +1627,7 @@ config DMA_API_DEBUG
 
 	  If unsure, say N.
 
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
lib/Kconfig.debug +1 -1
-config TEST_MODULE
+config TEST_LKM
 	tristate "Test module loading with 'hello world' module"
 	default n
 	depends on m
lib/Makefile +0 -0
index d6b4bc4..382437a 100644
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

lib/Makefile obj-y += string_helpers.o · line 34

Quoted 8 lines
lib/Makefile +1 -1
@@ -31,7 +31,7 @@ obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
 obj-y += kstrtox.o
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
-obj-$(CONFIG_TEST_MODULE) += test_module.o
+obj-$(CONFIG_TEST_LKM) += test_module.o

Perhaps we should rename that file likewise?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

lib/Makefile obj-y += string_helpers.o · line 37

Quoted 3 lines
lib/Makefile +0 -0
 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
 obj-$(CONFIG_TEST_BPF) += test_bpf.o
 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o

If something like this gets applied a follow up patch to make the kbuild system reject Kconfig symbols ending in _MODULE might be nice.

Paul Bolle

#6 lore raw
Quoted 45 lines · Paul Bolle

[Perhaps Kees hasn't seen this yet.]

Quoted 42 lines · Valentin Rothberg
Quoted 23 lines · Randy Dunlap
Quoted 22 lines · Valentin Rothberg
Quoted 5 lines · Randy Dunlap
Quoted 2 lines · Valentin Rothberg

The "_MODULE" suffix is reserved for tristates compiled as loadable kernel modules (LKM). The "TEST_MODULE" feature thereby

Is that documented anywhere?

Sadly this is not made explicit, but the Kconfig code documents it. The following code (./scripts/kconfig/confdata.c) is used to generate the autoconf.h header file during the build process. When a feature is selected as a kernel module ('m'), it is suffixed with "_MODULE" to indicate it.

»   »   switch (*value) {
»   »   case 'n':
»   »   »   break;
»   »   case 'm':
»   »   »   suffix = "_MODULE";
»   »   »   /* fall through */
Quoted 1 line

Was this causing some kind of problem or error? Please tell us what that was if so.

Quoted 7 lines
Quoted 5 lines

It causes problems for static code analysis, which assumes a consistent use of the "_MODULE" suffix.

Another possible change would be to rename the reference in the Makefile to "TEST_MODULE_MODULE". Personally, I prefer my proposed patch.

Sure, your patch is fine, but we need to know *why* the patch is needed.

Thank you for pointing that out. I will take care to give more information in future patches.

Thanks,
Valentin

Quoted 4 lines

Thanks.

Quoted 2 lines
Quoted 2 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

violates this convention. The feature is used to compile the lib/test_module.c kernel module.

This patch renames the feature and its reference in a Makefile to "TEST_LKM", which still expresses the test of a LKM.

Maybe something like "TEST_MODULE_LOAD"?

It has been merged already, see [1]. Sorry, I did not check if you were in the CC to let you know.

[1] http://ozlabs.org/~akpm/mmotm/broken-out/lib-rename-test_module-to-test_lkm.patch

Quoted 33 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
---
 lib/Kconfig.debug | 2 +-
 lib/Makefile      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +0 -0
index 07c2832..db91c97 100644
@@ -1627,7 +1627,7 @@ config DMA_API_DEBUG
 
          If unsure, say N.
 
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
lib/Kconfig.debug +1 -1
-config TEST_MODULE
+config TEST_LKM
        tristate "Test module loading with 'hello world' module"
        default n
        depends on m
lib/Makefile +0 -0
index d6b4bc4..382437a 100644
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

lib/Makefile obj-y += string_helpers.o · line 34

Quoted 8 lines
lib/Makefile +1 -1
@@ -31,7 +31,7 @@ obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
 obj-y += kstrtox.o
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
-obj-$(CONFIG_TEST_MODULE) += test_module.o
+obj-$(CONFIG_TEST_LKM) += test_module.o

Perhaps we should rename that file likewise?

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

lib/Makefile obj-y += string_helpers.o · line 37

Quoted 3 lines
lib/Makefile +0 -0
 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
 obj-$(CONFIG_TEST_BPF) += test_bpf.o
 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o

If something like this gets applied a follow up patch to make the kbuild system reject Kconfig symbols ending in _MODULE might be nice.

That is a very nice idea. Please CC me if you come up with a path.

Thanks,
Valentin

Quoted 4 lines

Paul Bolle

#7 lore raw
Quoted 7 lines · Valentin Rothberg
Quoted 1 line · Paul Bolle

Maybe something like "TEST_MODULE_LOAD"?

It has been merged already, see [1]. Sorry, I did not check if you were in the CC to let you know.

[1] http://ozlabs.org/~akpm/mmotm/broken-out/lib-rename-test_module-to-test_lkm.patch

That didn't hit lkml, did it? Don't know whether mmotm is set in stone nor whether Kees has strong feelings about the name of this feature. (I suspect I'm wandering into bicycle shed territory here...).

Quoted 2 lines
Quoted 2 lines

If something like this gets applied a follow up patch to make the kbuild system reject Kconfig symbols ending in _MODULE might be nice.

Will do. But you're free to beat me to it.

Thanks,

Paul Bolle

#8 lore raw
Quoted 4 lines · Paul Bolle
Quoted 3 lines · Valentin Rothberg
Quoted 1 line · Paul Bolle

Maybe something like "TEST_MODULE_LOAD"?

Quoted 8 lines
Quoted 4 lines

It has been merged already, see [1]. Sorry, I did not check if you were in the CC to let you know.

[1] http://ozlabs.org/~akpm/mmotm/broken-out/lib-rename-test_module-to-test_lkm.patch

That didn't hit lkml, did it? Don't know whether mmotm is set in stone nor whether Kees has strong feelings about the name of this feature. (I suspect I'm wandering into bicycle shed territory here...).

Oooh! Nope, I hadn't seen this thread. Thanks for CCing me!

I have no problem at all with changing the Kconfig name. I prefer TEST_LKM over TEST_MODULE_MODULE, FWIW. :)

Thanks,

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
#9 lore raw
In reply to Valentin Rothberg
Quoted 2 lines · Valentin Rothberg

It has been merged already, see [1]. Sorry, I did not check if you were in the CC to let you know.

If it helps, I tend to use scripts/get_maintainer.pl when sending patches. It's a nice way to see who touched the same areas your patch touches, as well as doing all the filename and patch matching from the items listed in MAINTAINERS.

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security