diff options
| author | tkusumi <tkusumi@NetBSD.org> | 2019-12-23 16:17:35 +0000 |
|---|---|---|
| committer | tkusumi <tkusumi@NetBSD.org> | 2019-12-23 16:17:35 +0000 |
| commit | 1c72639d0a434ac8105c817b5167d90cdc5fbe29 (patch) | |
| tree | a45a0cc0d4dbac38c4e7fc8b2916d4344eade96d /sys/dev/dm/dm_ioctl.c | |
| parent | cd0348d50f1abd8b73f854d1873432b8b1e6d185 (diff) | |
dm: Make target's ->table() optional
Since ->info() (counter part of ->table() in the original dm design
in Linux kernel in .status where both INFO and TABLE are optional)
is an optional handler, make ->table() optional as well. Some
targets don't have anything to do in ->table() just as in ->info().
taken-from: DragonFlyBSD
Diffstat (limited to 'sys/dev/dm/dm_ioctl.c')
| -rw-r--r-- | sys/dev/dm/dm_ioctl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/dm/dm_ioctl.c b/sys/dev/dm/dm_ioctl.c index a4aacad3209..7ffee7255cc 100644 --- a/sys/dev/dm/dm_ioctl.c +++ b/sys/dev/dm/dm_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_ioctl.c,v 1.48 2019/12/21 11:59:03 tkusumi Exp $ */ +/* $NetBSD: dm_ioctl.c,v 1.49 2019/12/23 16:17:35 tkusumi Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.48 2019/12/21 11:59:03 tkusumi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.49 2019/12/23 16:17:35 tkusumi Exp $"); /* * Locking is used to synchronise between ioctl calls and between dm_table's @@ -936,6 +936,7 @@ dm_table_status_ioctl(prop_dictionary_t dm_dict) SLIST_FOREACH(table_en, tbl, next) { char *params; + int is_table; target_dict = prop_dictionary_create(); aprint_debug("%016" PRIu64 ", length %016" PRIu64 @@ -960,10 +961,11 @@ dm_table_status_ioctl(prop_dictionary_t dm_dict) */ prop_dictionary_set_cstring(target_dict, DM_TABLE_PARAMS, ""); - if (flags & DM_STATUS_TABLE_FLAG) + is_table = (flags & DM_STATUS_TABLE_FLAG) ? 1 : 0; + if (is_table && table_en->target->table) params = table_en->target->table( table_en->target_config); - else if (table_en->target->info) + else if (!is_table && table_en->target->info) params = table_en->target->info( table_en->target_config); else |
