All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] device-drivers/block/block_dev_kernel: Delete test_genhd.c
@ 2025-07-23  1:18 Tiezhu Yang
  2025-07-23 19:09 ` Petr Vorel
  0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2025-07-23  1:18 UTC (permalink / raw)
  To: Linux Test Project

test_genhd.c is not used any more, just delete it. While at it,
update README to reflect the reality.

Suggested-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 testcases/kernel/device-drivers/block/README  | 17 +-----
 .../block/block_dev_kernel/test_genhd.c       | 53 -------------------
 2 files changed, 2 insertions(+), 68 deletions(-)
 delete mode 100644 testcases/kernel/device-drivers/block/block_dev_kernel/test_genhd.c

diff --git a/testcases/kernel/device-drivers/block/README b/testcases/kernel/device-drivers/block/README
index 812436bb8..1490fd295 100644
--- a/testcases/kernel/device-drivers/block/README
+++ b/testcases/kernel/device-drivers/block/README
@@ -5,19 +5,6 @@ Module under test: linux/block/genhd.c
  -----------------------------+---------------+---------------
   register_blkdev()           | linux/fs.h    | ltp_block_dev.c
   unregister_blkdev()         | linux/fs.h    | ltp_block_dev.c
-  blk_register_region()       | linux/genhd.h |
-  blk_unregister_region()     | linux/genhd.h |
-  add_disk()                  | linux/genhd.h |
-  del_gendisk()               | linux/genhd.h | test_genhd.c
-  blk_lookup_devt()           | linux/genhd.h |
-  alloc_disk()                | linux/genhd.h | test_genhd.c
-  alloc_disk_node()           | linux/genhd.h |
-  get_disk()                  | linux/genhd.h |
-  put_disk()                  | linux/genhd.h |
-  set_device_ro()             | linux/genhd.h |
-  set_disk_ro()               | linux/genhd.h |
-  bdev_read_only()            | linux/fs.h    |
-  invalidate_partition()      | linux/fs.h    |
 
-For possible test results please see "A POSIX conforming test framework" at
-http://www.gnu.org/software/dejagnu/manual/x47.html#posix
+For possible test results please see "A POSIX compliant test framework" at
+https://www.gnu.org/software/dejagnu/manual/A-POSIX-Conforming-Test-Framework.html
diff --git a/testcases/kernel/device-drivers/block/block_dev_kernel/test_genhd.c b/testcases/kernel/device-drivers/block/block_dev_kernel/test_genhd.c
deleted file mode 100644
index d34a236b4..000000000
--- a/testcases/kernel/device-drivers/block/block_dev_kernel/test_genhd.c
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/*
- * Module under test: linux/block/genhd.c
- *
- * Only those functions are tested here which are declared in <linux/genhd.h>
- *
- * Usage:
- *   1. make
- *   2. su
- *   3. insmod ./test_genhd.ko
- *   4. Check the test results in "dmesg"
- *   5. rmmod test_genhd
- */
-
-#include <linux/module.h>
-#include <linux/genhd.h>
-
-MODULE_AUTHOR("Márton Németh <nm127@freemail.hu>");
-MODULE_DESCRIPTION("Test block drivers");
-MODULE_LICENSE("GPL");
-
-#define BLK_DEV_NAME		"test_block"
-#define MAX_MAJOR		255
-
-static void tc20(void)
-{
-	struct gendisk *gd_ptr;
-
-	gd_ptr = alloc_disk(1);
-	if (!gd_ptr) {
-		return;
-	}
-	printk(KERN_DEBUG "gd_ptr after alloc=%p\n", gd_ptr);
-
-	del_gendisk(gd_ptr);
-}
-
-static int test_init_module(void)
-{
-	printk(KERN_INFO "Starting test_genhd module\n");
-
-	tc20();
-
-	return 0;
-}
-
-static void test_exit_module(void)
-{
-	printk(KERN_DEBUG "Unloading test_genhd module\n");
-}
-
-module_init(test_init_module);
-module_exit(test_exit_module);
-- 
2.42.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH] device-drivers/block/block_dev_kernel: Delete test_genhd.c
  2025-07-23  1:18 [LTP] [PATCH] device-drivers/block/block_dev_kernel: Delete test_genhd.c Tiezhu Yang
@ 2025-07-23 19:09 ` Petr Vorel
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2025-07-23 19:09 UTC (permalink / raw)
  To: Tiezhu Yang; +Cc: Linux Test Project

Hi Tiezhu,

> test_genhd.c is not used any more, just delete it. While at it,

Thanks for your work, merged.

> update README to reflect the reality.

See below...

> Suggested-by: Petr Vorel <pvorel@suse.cz>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  testcases/kernel/device-drivers/block/README  | 17 +-----
>  .../block/block_dev_kernel/test_genhd.c       | 53 -------------------
>  2 files changed, 2 insertions(+), 68 deletions(-)
>  delete mode 100644 testcases/kernel/device-drivers/block/block_dev_kernel/test_genhd.c

> diff --git a/testcases/kernel/device-drivers/block/README b/testcases/kernel/device-drivers/block/README
> index 812436bb8..1490fd295 100644
> --- a/testcases/kernel/device-drivers/block/README
> +++ b/testcases/kernel/device-drivers/block/README
> @@ -5,19 +5,6 @@ Module under test: linux/block/genhd.c
>   -----------------------------+---------------+---------------
>    register_blkdev()           | linux/fs.h    | ltp_block_dev.c
>    unregister_blkdev()         | linux/fs.h    | ltp_block_dev.c
> -  blk_register_region()       | linux/genhd.h |
> -  blk_unregister_region()     | linux/genhd.h |
> -  add_disk()                  | linux/genhd.h |

Internal kernel header <linux/genhd.h> was merged into in <linux/blkdev.h> in
v5.18-rc1. That means that functions was moved there. Also, some functions was
renamed, although I did not investigate whether before this change (i.e. renamed
in <linux/genhd.h>) or after in <linux/blkdev.h>. I suppose both.

Also at least add_disk() and del_gendisk() is in <linux/blkdev.h> and it's being
tested in other LTP modules:

$ git grep -l add_disk
testcases/kernel/device-drivers/include/includeTest.c
testcases/kernel/device-drivers/nls/nlsTest.c
testcases/kernel/device-drivers/tbio/tbio_kernel/ltp_tbio.c

$ git grep -l del_gendisk
testcases/kernel/device-drivers/include/includeTest.c
testcases/kernel/device-drivers/nls/nlsTest.c
testcases/kernel/device-drivers/tbio/tbio_kernel/ltp_tbio.c

These are outside of testcases/kernel/device-drivers/block/. I wonder if this
README makes sense when there are other kernel modules using block driver
related functions. But anyway, outdated README is just expected in these old
modules with questionable usability (sometimes I think we should just delete
them all and let kernel internals being tested in Kunit).

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-23 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-23  1:18 [LTP] [PATCH] device-drivers/block/block_dev_kernel: Delete test_genhd.c Tiezhu Yang
2025-07-23 19:09 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.