From 68c7bb9bc75173344186b31c5601a1a0f141acbd Mon Sep 17 00:00:00 2001
Date: Sat, 26 Nov 2016 12:46:41 +0900
Subject: [PATCH] sys/dev/disk/dm: Remove dm/targets/ directory and move its
 entries to dm/

Device mapper targets' path
sys/dev/disk/dm/targets/<name>/dm_target_<name>.c
are too deep for no reason.

This commit removes targets/ directory which isn't necessary at all,
assuming userspace has no dependencies on this (and it shouldn't either).

Neither NetBSD (sys/dev/dm/dm_target_*.c) nor Linux kernel (drivers/md/dm*.c)
has a directory tree like this, which is better.
---
 sys/conf/files                                              | 10 +++++-----
 sys/dev/disk/dm/Makefile                                    |  2 +-
 sys/dev/disk/dm/{targets => }/crypt/Makefile                |  0
 sys/dev/disk/dm/{targets => }/crypt/dm_target_crypt.c       |  0
 sys/dev/disk/dm/{targets => }/delay/Makefile                |  0
 sys/dev/disk/dm/{targets => }/delay/dm_target_delay.c       |  0
 sys/dev/disk/dm/{targets => }/dmirror/Makefile              |  0
 sys/dev/disk/dm/{targets => }/dmirror/dm_target_dmirror.c   |  0
 sys/dev/disk/dm/{targets => }/dmirror/dmirror_notes.txt     |  0
 sys/dev/disk/dm/{targets => }/flakey/Makefile               |  0
 sys/dev/disk/dm/{targets => }/flakey/dm_target_flakey.c     |  0
 sys/dev/disk/dm/{targets => }/linear/Makefile               |  0
 sys/dev/disk/dm/{targets => }/linear/dm_target_linear.c     |  0
 sys/dev/disk/dm/{targets => }/mirror/dm_target_mirror.c     |  0
 sys/dev/disk/dm/{targets => }/snapshot/dm_target_snapshot.c |  0
 sys/dev/disk/dm/{targets => }/striped/Makefile              |  0
 sys/dev/disk/dm/{targets => }/striped/dm_target_striped.c   |  0
 sys/dev/disk/dm/targets/Makefile                            |  3 ---
 18 files changed, 6 insertions(+), 9 deletions(-)
 rename sys/dev/disk/dm/{targets => }/crypt/Makefile (100%)
 rename sys/dev/disk/dm/{targets => }/crypt/dm_target_crypt.c (100%)
 rename sys/dev/disk/dm/{targets => }/delay/Makefile (100%)
 rename sys/dev/disk/dm/{targets => }/delay/dm_target_delay.c (100%)
 rename sys/dev/disk/dm/{targets => }/dmirror/Makefile (100%)
 rename sys/dev/disk/dm/{targets => }/dmirror/dm_target_dmirror.c (100%)
 rename sys/dev/disk/dm/{targets => }/dmirror/dmirror_notes.txt (100%)
 rename sys/dev/disk/dm/{targets => }/flakey/Makefile (100%)
 rename sys/dev/disk/dm/{targets => }/flakey/dm_target_flakey.c (100%)
 rename sys/dev/disk/dm/{targets => }/linear/Makefile (100%)
 rename sys/dev/disk/dm/{targets => }/linear/dm_target_linear.c (100%)
 rename sys/dev/disk/dm/{targets => }/mirror/dm_target_mirror.c (100%)
 rename sys/dev/disk/dm/{targets => }/snapshot/dm_target_snapshot.c (100%)
 rename sys/dev/disk/dm/{targets => }/striped/Makefile (100%)
 rename sys/dev/disk/dm/{targets => }/striped/dm_target_striped.c (100%)
 delete mode 100644 sys/dev/disk/dm/targets/Makefile

diff --git a/sys/conf/files b/sys/conf/files
index 23b3908..5816f26 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -85,11 +85,11 @@ dev/disk/dm/dm_table.c			optional dm
 dev/disk/dm/dm_target.c			optional dm
 dev/disk/dm/dm_target_error.c		optional dm
 dev/disk/dm/dm_target_zero.c		optional dm
-dev/disk/dm/targets/crypt/dm_target_crypt.c	optional dm_target_crypt
-dev/disk/dm/targets/linear/dm_target_linear.c	optional dm_target_linear
-dev/disk/dm/targets/striped/dm_target_striped.c	optional dm_target_striped
-dev/disk/dm/targets/delay/dm_target_delay.c	optional dm_target_delay
-dev/disk/dm/targets/flakey/dm_target_flakey.c	optional dm_target_flakey
+dev/disk/dm/crypt/dm_target_crypt.c	optional dm_target_crypt
+dev/disk/dm/linear/dm_target_linear.c	optional dm_target_linear
+dev/disk/dm/striped/dm_target_striped.c	optional dm_target_striped
+dev/disk/dm/delay/dm_target_delay.c	optional dm_target_delay
+dev/disk/dm/flakey/dm_target_flakey.c	optional dm_target_flakey
 
 dev/disk/iscsi/initiator/isc_cam.c	optional iscsi_initiator scbus
 dev/disk/iscsi/initiator/isc_sm.c	optional iscsi_initiator scbus
diff --git a/sys/dev/disk/dm/Makefile b/sys/dev/disk/dm/Makefile
index 7195e84..af5b333 100644
--- a/sys/dev/disk/dm/Makefile
+++ b/sys/dev/disk/dm/Makefile
@@ -4,6 +4,6 @@ SRCS=   device-mapper.c dm_dev.c dm_ioctl.c dm_pdev.c dm_table.c \
 
 SRCS+=	dm_target_error.c dm_target_zero.c
 
-SUBDIR=	targets
+SUBDIR= linear striped crypt delay flakey
 
 .include <bsd.kmod.mk>
diff --git a/sys/dev/disk/dm/targets/crypt/Makefile b/sys/dev/disk/dm/crypt/Makefile
similarity index 100%
rename from sys/dev/disk/dm/targets/crypt/Makefile
rename to sys/dev/disk/dm/crypt/Makefile
diff --git a/sys/dev/disk/dm/targets/crypt/dm_target_crypt.c b/sys/dev/disk/dm/crypt/dm_target_crypt.c
similarity index 100%
rename from sys/dev/disk/dm/targets/crypt/dm_target_crypt.c
rename to sys/dev/disk/dm/crypt/dm_target_crypt.c
diff --git a/sys/dev/disk/dm/targets/delay/Makefile b/sys/dev/disk/dm/delay/Makefile
similarity index 100%
rename from sys/dev/disk/dm/targets/delay/Makefile
rename to sys/dev/disk/dm/delay/Makefile
diff --git a/sys/dev/disk/dm/targets/delay/dm_target_delay.c b/sys/dev/disk/dm/delay/dm_target_delay.c
similarity index 100%
rename from sys/dev/disk/dm/targets/delay/dm_target_delay.c
rename to sys/dev/disk/dm/delay/dm_target_delay.c
diff --git a/sys/dev/disk/dm/targets/dmirror/Makefile b/sys/dev/disk/dm/dmirror/Makefile
similarity index 100%
rename from sys/dev/disk/dm/targets/dmirror/Makefile
rename to sys/dev/disk/dm/dmirror/Makefile
diff --git a/sys/dev/disk/dm/targets/dmirror/dm_target_dmirror.c b/sys/dev/disk/dm/dmirror/dm_target_dmirror.c
similarity index 100%
rename from sys/dev/disk/dm/targets/dmirror/dm_target_dmirror.c
rename to sys/dev/disk/dm/dmirror/dm_target_dmirror.c
diff --git a/sys/dev/disk/dm/targets/dmirror/dmirror_notes.txt b/sys/dev/disk/dm/dmirror/dmirror_notes.txt
similarity index 100%
rename from sys/dev/disk/dm/targets/dmirror/dmirror_notes.txt
rename to sys/dev/disk/dm/dmirror/dmirror_notes.txt
diff --git a/sys/dev/disk/dm/targets/flakey/Makefile b/sys/dev/disk/dm/flakey/Makefile
similarity index 100%
rename from sys/dev/disk/dm/targets/flakey/Makefile
rename to sys/dev/disk/dm/flakey/Makefile
diff --git a/sys/dev/disk/dm/targets/flakey/dm_target_flakey.c b/sys/dev/disk/dm/flakey/dm_target_flakey.c
similarity index 100%
rename from sys/dev/disk/dm/targets/flakey/dm_target_flakey.c
rename to sys/dev/disk/dm/flakey/dm_target_flakey.c
diff --git a/sys/dev/disk/dm/targets/linear/Makefile b/sys/dev/disk/dm/linear/Makefile
similarity index 100%
rename from sys/dev/disk/dm/targets/linear/Makefile
rename to sys/dev/disk/dm/linear/Makefile
diff --git a/sys/dev/disk/dm/targets/linear/dm_target_linear.c b/sys/dev/disk/dm/linear/dm_target_linear.c
similarity index 100%
rename from sys/dev/disk/dm/targets/linear/dm_target_linear.c
rename to sys/dev/disk/dm/linear/dm_target_linear.c
diff --git a/sys/dev/disk/dm/targets/mirror/dm_target_mirror.c b/sys/dev/disk/dm/mirror/dm_target_mirror.c
similarity index 100%
rename from sys/dev/disk/dm/targets/mirror/dm_target_mirror.c
rename to sys/dev/disk/dm/mirror/dm_target_mirror.c
diff --git a/sys/dev/disk/dm/targets/snapshot/dm_target_snapshot.c b/sys/dev/disk/dm/snapshot/dm_target_snapshot.c
similarity index 100%
rename from sys/dev/disk/dm/targets/snapshot/dm_target_snapshot.c
rename to sys/dev/disk/dm/snapshot/dm_target_snapshot.c
diff --git a/sys/dev/disk/dm/targets/striped/Makefile b/sys/dev/disk/dm/striped/Makefile
similarity index 100%
rename from sys/dev/disk/dm/targets/striped/Makefile
rename to sys/dev/disk/dm/striped/Makefile
diff --git a/sys/dev/disk/dm/targets/striped/dm_target_striped.c b/sys/dev/disk/dm/striped/dm_target_striped.c
similarity index 100%
rename from sys/dev/disk/dm/targets/striped/dm_target_striped.c
rename to sys/dev/disk/dm/striped/dm_target_striped.c
diff --git a/sys/dev/disk/dm/targets/Makefile b/sys/dev/disk/dm/targets/Makefile
deleted file mode 100644
index 4a5fa8b..0000000
--- a/sys/dev/disk/dm/targets/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIR= linear striped crypt delay flakey
-
-.include <bsd.subdir.mk>
-- 
2.9.2

