From 87d1de18f98b3e78b5d086567959f7431f8fc42a Mon Sep 17 00:00:00 2001 From: tkusumi Date: Sat, 21 Dec 2019 11:59:03 +0000 Subject: dm: Remove target's ->deps() by implementing deps in dm core Retrieving device dependencies doesn't need to be target specific. The reason it currently needs ->deps() is because dm core doesn't have data structure that allows table to walk through target's underlying devices. Add struct dm_mapping to be able to do this, and remove ->deps()'s from targets which basically do the same thing. =====(A) before this commit table | [dm core] ------------------------------------------------------- | pdev pdev pdev [dm targets] v ^ ^ ^ target----/---------/---------/ (void*) =====(B) this commit table---->mapping-->mapping-->mapping-->... | | | | | v v v [dm core] ------------------------------------------------------- | pdev pdev pdev [dm targets] v ^ ^ ^ target----/---------/---------/ (void*) taken-from: DragonFlyBSD --- sys/dev/dm/dm_target_linear.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'sys/dev/dm/dm_target_linear.c') diff --git a/sys/dev/dm/dm_target_linear.c b/sys/dev/dm/dm_target_linear.c index 04de7e43d8d..24d1fea5c0b 100644 --- a/sys/dev/dm/dm_target_linear.c +++ b/sys/dev/dm/dm_target_linear.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_target_linear.c,v 1.34 2019/12/20 16:16:36 tkusumi Exp $ */ +/* $NetBSD: dm_target_linear.c,v 1.35 2019/12/21 11:59:03 tkusumi Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.34 2019/12/20 16:16:36 tkusumi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.35 2019/12/21 11:59:03 tkusumi Exp $"); /* * This file implements initial version of device-mapper dklinear target. @@ -75,6 +75,7 @@ dm_target_linear_init(dm_table_entry_t *table_en, int argc, char **argv) tlc->pdev = dmp; tlc->offset = atoi64(argv[1]); + dm_table_add_deps(table_en, dmp); table_en->target_config = tlc; return 0; @@ -162,23 +163,6 @@ out: return 0; } -/* Add this target pdev dependencies to prop_array_t */ -int -dm_target_linear_deps(dm_table_entry_t *table_en, prop_array_t prop_array) -{ - dm_target_linear_config_t *tlc; - - if (table_en->target_config == NULL) - return ENOENT; - - tlc = table_en->target_config; - - prop_array_add_uint64(prop_array, - (uint64_t) tlc->pdev->pdev_vnode->v_rdev); - - return 0; -} - /* * Register upcall device. * Linear target doesn't need any upcall devices but other targets like -- cgit