[PATCH v5 2/3] dm: make mapped_device locking functions available

From: Kees Cook
Date: Sat Feb 20 2016 - 13:14:56 EST


For init to build a mapped_device, it must hold the appropriate locks,
so move these to the common header.

Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
---
v5: first version of this specific patch in the series
---
drivers/md/dm.h | 2 --
include/linux/device-mapper.h | 6 ++++++
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 7edcf97dfa5a..f21700431f67 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -78,8 +78,6 @@ bool dm_table_mq_request_based(struct dm_table *t);
void dm_table_free_md_mempools(struct dm_table *t);
struct dm_md_mempools *dm_table_get_md_mempools(struct dm_table *t);

-void dm_lock_md_type(struct mapped_device *md);
-void dm_unlock_md_type(struct mapped_device *md);
void dm_set_md_type(struct mapped_device *md, unsigned type);
unsigned dm_get_md_type(struct mapped_device *md);
struct target_type *dm_get_immutable_target_type(struct mapped_device *md);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 87afa0552398..48df518345fd 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -414,6 +414,12 @@ union map_info *dm_get_rq_mapinfo(struct request *rq);
struct queue_limits *dm_get_queue_limits(struct mapped_device *md);

/*
+ * Lock functions.
+ */
+void dm_lock_md_type(struct mapped_device *md);
+void dm_unlock_md_type(struct mapped_device *md);
+
+/*
* Geometry functions.
*/
int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo);
--
2.6.3