The LKDTM modules keep expanding, and it's getting weird to have each file
get a prefix. Instead, move to a subdirectory for cleaner handling.

Signed-off-by: Kees Cook <keesc...@chromium.org>
---
 MAINTAINERS                                         |  2 +-
 drivers/misc/Makefile                               | 20 +-------------------
 drivers/misc/lkdtm/Makefile                         | 20 ++++++++++++++++++++
 drivers/misc/{lkdtm_bugs.c => lkdtm/bugs.c}         |  0
 drivers/misc/{lkdtm_core.c => lkdtm/core.c}         |  0
 drivers/misc/{lkdtm_heap.c => lkdtm/heap.c}         |  0
 drivers/misc/{ => lkdtm}/lkdtm.h                    |  0
 drivers/misc/{lkdtm_perms.c => lkdtm/perms.c}       |  0
 drivers/misc/{lkdtm_refcount.c => lkdtm/refcount.c} |  0
 drivers/misc/{lkdtm_rodata.c => lkdtm/rodata.c}     |  0
 drivers/misc/{lkdtm_usercopy.c => lkdtm/usercopy.c} |  0
 11 files changed, 22 insertions(+), 20 deletions(-)
 create mode 100644 drivers/misc/lkdtm/Makefile
 rename drivers/misc/{lkdtm_bugs.c => lkdtm/bugs.c} (100%)
 rename drivers/misc/{lkdtm_core.c => lkdtm/core.c} (100%)
 rename drivers/misc/{lkdtm_heap.c => lkdtm/heap.c} (100%)
 rename drivers/misc/{ => lkdtm}/lkdtm.h (100%)
 rename drivers/misc/{lkdtm_perms.c => lkdtm/perms.c} (100%)
 rename drivers/misc/{lkdtm_refcount.c => lkdtm/refcount.c} (100%)
 rename drivers/misc/{lkdtm_rodata.c => lkdtm/rodata.c} (100%)
 rename drivers/misc/{lkdtm_usercopy.c => lkdtm/usercopy.c} (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9a7f76eadae9..942df9264d2e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8146,7 +8146,7 @@ F:        drivers/*/*/*pasemi*
 LINUX KERNEL DUMP TEST MODULE (LKDTM)
 M:     Kees Cook <keesc...@chromium.org>
 S:     Maintained
-F:     drivers/misc/lkdtm*
+F:     drivers/misc/lkdtm/*
 
 LINUX SECURITY MODULE (LSM) FRAMEWORK
 M:     Chris Wright <chr...@sous-sol.org>
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c3c8624f4d95..20be70c3f118 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -12,7 +12,7 @@ obj-$(CONFIG_ATMEL_SSC)               += atmel-ssc.o
 obj-$(CONFIG_ATMEL_TCLIB)      += atmel_tclib.o
 obj-$(CONFIG_DUMMY_IRQ)                += dummy-irq.o
 obj-$(CONFIG_ICS932S401)       += ics932s401.o
-obj-$(CONFIG_LKDTM)            += lkdtm.o
+obj-$(CONFIG_LKDTM)            += lkdtm/
 obj-$(CONFIG_TIFM_CORE)        += tifm_core.o
 obj-$(CONFIG_TIFM_7XX1)        += tifm_7xx1.o
 obj-$(CONFIG_PHANTOM)          += phantom.o
@@ -57,21 +57,3 @@ obj-$(CONFIG_ASPEED_LPC_SNOOP)       += aspeed-lpc-snoop.o
 obj-$(CONFIG_PCI_ENDPOINT_TEST)        += pci_endpoint_test.o
 obj-$(CONFIG_OCXL)             += ocxl/
 obj-$(CONFIG_MISC_RTSX)                += cardreader/
-
-lkdtm-$(CONFIG_LKDTM)          += lkdtm_core.o
-lkdtm-$(CONFIG_LKDTM)          += lkdtm_bugs.o
-lkdtm-$(CONFIG_LKDTM)          += lkdtm_heap.o
-lkdtm-$(CONFIG_LKDTM)          += lkdtm_perms.o
-lkdtm-$(CONFIG_LKDTM)          += lkdtm_refcount.o
-lkdtm-$(CONFIG_LKDTM)          += lkdtm_rodata_objcopy.o
-lkdtm-$(CONFIG_LKDTM)          += lkdtm_usercopy.o
-
-KCOV_INSTRUMENT_lkdtm_rodata.o := n
-
-OBJCOPYFLAGS :=
-OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \
-                       --set-section-flags .text=alloc,readonly \
-                       --rename-section .text=.rodata
-targets += lkdtm_rodata.o lkdtm_rodata_objcopy.o
-$(obj)/lkdtm_rodata_objcopy.o: $(obj)/lkdtm_rodata.o FORCE
-       $(call if_changed,objcopy)
diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
new file mode 100644
index 000000000000..3370a4138e94
--- /dev/null
+++ b/drivers/misc/lkdtm/Makefile
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_LKDTM)            += lkdtm.o
+
+lkdtm-$(CONFIG_LKDTM)          += core.o
+lkdtm-$(CONFIG_LKDTM)          += bugs.o
+lkdtm-$(CONFIG_LKDTM)          += heap.o
+lkdtm-$(CONFIG_LKDTM)          += perms.o
+lkdtm-$(CONFIG_LKDTM)          += refcount.o
+lkdtm-$(CONFIG_LKDTM)          += rodata_objcopy.o
+lkdtm-$(CONFIG_LKDTM)          += usercopy.o
+
+KCOV_INSTRUMENT_rodata.o       := n
+
+OBJCOPYFLAGS :=
+OBJCOPYFLAGS_rodata_objcopy.o  := \
+                       --set-section-flags .text=alloc,readonly \
+                       --rename-section .text=.rodata
+targets += rodata.o rodata_objcopy.o
+$(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
+       $(call if_changed,objcopy)
diff --git a/drivers/misc/lkdtm_bugs.c b/drivers/misc/lkdtm/bugs.c
similarity index 100%
rename from drivers/misc/lkdtm_bugs.c
rename to drivers/misc/lkdtm/bugs.c
diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm/core.c
similarity index 100%
rename from drivers/misc/lkdtm_core.c
rename to drivers/misc/lkdtm/core.c
diff --git a/drivers/misc/lkdtm_heap.c b/drivers/misc/lkdtm/heap.c
similarity index 100%
rename from drivers/misc/lkdtm_heap.c
rename to drivers/misc/lkdtm/heap.c
diff --git a/drivers/misc/lkdtm.h b/drivers/misc/lkdtm/lkdtm.h
similarity index 100%
rename from drivers/misc/lkdtm.h
rename to drivers/misc/lkdtm/lkdtm.h
diff --git a/drivers/misc/lkdtm_perms.c b/drivers/misc/lkdtm/perms.c
similarity index 100%
rename from drivers/misc/lkdtm_perms.c
rename to drivers/misc/lkdtm/perms.c
diff --git a/drivers/misc/lkdtm_refcount.c b/drivers/misc/lkdtm/refcount.c
similarity index 100%
rename from drivers/misc/lkdtm_refcount.c
rename to drivers/misc/lkdtm/refcount.c
diff --git a/drivers/misc/lkdtm_rodata.c b/drivers/misc/lkdtm/rodata.c
similarity index 100%
rename from drivers/misc/lkdtm_rodata.c
rename to drivers/misc/lkdtm/rodata.c
diff --git a/drivers/misc/lkdtm_usercopy.c b/drivers/misc/lkdtm/usercopy.c
similarity index 100%
rename from drivers/misc/lkdtm_usercopy.c
rename to drivers/misc/lkdtm/usercopy.c
-- 
2.7.4

Reply via email to