diff mbox series

[RFC,04/22] ublk: move ublk into one standalone directory

Message ID 20250107120417.1237392-5-tom.leiming@gmail.com (mailing list archive)
State RFC
Headers show
Series ublk: support bpf | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch, async

Commit Message

Ming Lei Jan. 7, 2025, 12:03 p.m. UTC
Prepare for supporting ublk-bpf, which has to add more source files, so
create ublk/ for avoiding to pollute drivers/block/

Meantime rename the source file as ublk/main.c

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 MAINTAINERS                               |  2 +-
 drivers/block/Kconfig                     | 32 +-------------------
 drivers/block/Makefile                    |  2 +-
 drivers/block/ublk/Kconfig                | 36 +++++++++++++++++++++++
 drivers/block/ublk/Makefile               |  7 +++++
 drivers/block/{ublk_drv.c => ublk/main.c} |  0
 6 files changed, 46 insertions(+), 33 deletions(-)
 create mode 100644 drivers/block/ublk/Kconfig
 create mode 100644 drivers/block/ublk/Makefile
 rename drivers/block/{ublk_drv.c => ublk/main.c} (100%)
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index c575de4903db..890f6195d03f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -23982,7 +23982,7 @@  M:	Ming Lei <ming.lei@redhat.com>
 L:	linux-block@vger.kernel.org
 S:	Maintained
 F:	Documentation/block/ublk.rst
-F:	drivers/block/ublk_drv.c
+F:	drivers/block/ublk/
 F:	include/uapi/linux/ublk_cmd.h
 
 UBSAN
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index a97f2c40c640..4e5144183ade 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -379,37 +379,7 @@  config BLK_DEV_RBD
 
 	  If unsure, say N.
 
-config BLK_DEV_UBLK
-	tristate "Userspace block driver (Experimental)"
-	select IO_URING
-	help
-	  io_uring based userspace block driver. Together with ublk server, ublk
-	  has been working well, but interface with userspace or command data
-	  definition isn't finalized yet, and might change according to future
-	  requirement, so mark is as experimental now.
-
-	  Say Y if you want to get better performance because task_work_add()
-	  can be used in IO path for replacing io_uring cmd, which will become
-	  shared between IO tasks and ubq daemon, meantime task_work_add() can
-	  can handle batch more effectively, but task_work_add() isn't exported
-	  for module, so ublk has to be built to kernel.
-
-config BLKDEV_UBLK_LEGACY_OPCODES
-	bool "Support legacy command opcode"
-	depends on BLK_DEV_UBLK
-	default y
-	help
-	  ublk driver started to take plain command encoding, which turns out
-	  one bad way. The traditional ioctl command opcode encodes more
-	  info and basically defines each code uniquely, so opcode conflict
-	  is avoided, and driver can handle wrong command easily, meantime it
-	  may help security subsystem to audit io_uring command.
-
-	  Say Y if your application still uses legacy command opcode.
-
-	  Say N if you don't want to support legacy command opcode. It is
-	  suggested to enable N if your application(ublk server) switches to
-	  ioctl command encoding.
+source "drivers/block/ublk/Kconfig"
 
 source "drivers/block/rnbd/Kconfig"
 
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index 1105a2d4fdcb..a6fdc62b817c 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -40,6 +40,6 @@  obj-$(CONFIG_BLK_DEV_RNBD)	+= rnbd/
 
 obj-$(CONFIG_BLK_DEV_NULL_BLK)	+= null_blk/
 
-obj-$(CONFIG_BLK_DEV_UBLK)			+= ublk_drv.o
+obj-$(CONFIG_BLK_DEV_UBLK)			+= ublk/
 
 swim_mod-y	:= swim.o swim_asm.o
diff --git a/drivers/block/ublk/Kconfig b/drivers/block/ublk/Kconfig
new file mode 100644
index 000000000000..b06e3df09779
--- /dev/null
+++ b/drivers/block/ublk/Kconfig
@@ -0,0 +1,36 @@ 
+# SPDX-License-Identifier: GPL-2.0
+#
+# ublkl block device driver configuration
+#
+
+config BLK_DEV_UBLK
+	tristate "Userspace block driver (Experimental)"
+	select IO_URING
+	help
+	  io_uring based userspace block driver. Together with ublk server, ublk
+	  has been working well, but interface with userspace or command data
+	  definition isn't finalized yet, and might change according to future
+	  requirement, so mark is as experimental now.
+
+	  Say Y if you want to get better performance because task_work_add()
+	  can be used in IO path for replacing io_uring cmd, which will become
+	  shared between IO tasks and ubq daemon, meantime task_work_add() can
+	  can handle batch more effectively, but task_work_add() isn't exported
+	  for module, so ublk has to be built to kernel.
+
+config BLKDEV_UBLK_LEGACY_OPCODES
+	bool "Support legacy command opcode"
+	depends on BLK_DEV_UBLK
+	default y
+	help
+	  ublk driver started to take plain command encoding, which turns out
+	  one bad way. The traditional ioctl command opcode encodes more
+	  info and basically defines each code uniquely, so opcode conflict
+	  is avoided, and driver can handle wrong command easily, meantime it
+	  may help security subsystem to audit io_uring command.
+
+	  Say Y if your application still uses legacy command opcode.
+
+	  Say N if you don't want to support legacy command opcode. It is
+	  suggested to enable N if your application(ublk server) switches to
+	  ioctl command encoding.
diff --git a/drivers/block/ublk/Makefile b/drivers/block/ublk/Makefile
new file mode 100644
index 000000000000..30e06b74dd82
--- /dev/null
+++ b/drivers/block/ublk/Makefile
@@ -0,0 +1,7 @@ 
+# SPDX-License-Identifier: GPL-2.0
+
+# needed for trace events
+ccflags-y			+= -I$(src)
+
+ublk_drv-$(CONFIG_BLK_DEV_UBLK)	:= main.o
+obj-$(CONFIG_BLK_DEV_UBLK)	+= ublk_drv.o
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk/main.c
similarity index 100%
rename from drivers/block/ublk_drv.c
rename to drivers/block/ublk/main.c