diff options
| author | tkusumi <tkusumi@NetBSD.org> | 2019-12-14 17:15:54 +0000 |
|---|---|---|
| committer | tkusumi <tkusumi@NetBSD.org> | 2019-12-14 17:15:54 +0000 |
| commit | 1528d864bfe91f969809660088a84f4e52d3dec7 (patch) | |
| tree | bd63640059c80f5087634108a94cea02ee93e3d4 /sys/dev/dm/dm_ioctl.c | |
| parent | 9b76f0fd6bcb8f485c44285047b8d00249a645ae (diff) | |
dm: Don't try to implement "status" as subset of "table"
The way dm_table_status_ioctl() implements "status" and "table" is
not compatible with Linux kernel. Some targets have different outputs
that "status" can't be implemented as subset of "table".
Add ->info() handler to sync with "status" behavior in Linux kernel.
Some targets which currently exist in NetBSD (I think striped)
as well as some minor targets that I plan to port to NetBSD
can/should implement ->info(), but will do that in a different commit.
taken-from: DragonFlyBSD
Diffstat (limited to 'sys/dev/dm/dm_ioctl.c')
| -rw-r--r-- | sys/dev/dm/dm_ioctl.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sys/dev/dm/dm_ioctl.c b/sys/dev/dm/dm_ioctl.c index 3e4e154a77f..41a8a11b9f0 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.43 2019/12/14 14:43:38 tkusumi Exp $ */ +/* $NetBSD: dm_ioctl.c,v 1.44 2019/12/14 17:15:54 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.43 2019/12/14 14:43:38 tkusumi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.44 2019/12/14 17:15:54 tkusumi Exp $"); /* * Locking is used to synchronise between ioctl calls and between dm_table's @@ -942,17 +942,21 @@ dm_table_status_ioctl(prop_dictionary_t dm_dict) */ prop_dictionary_set_cstring(target_dict, DM_TABLE_PARAMS, ""); - if (flags & DM_STATUS_TABLE_FLAG) { - params = table_en->target->status - (table_en->target_config); - - if (params != NULL) { - prop_dictionary_set_cstring(target_dict, - DM_TABLE_PARAMS, params); + if (flags & DM_STATUS_TABLE_FLAG) + params = table_en->target->status( + table_en->target_config); + else if (table_en->target->info) + params = table_en->target->info( + table_en->target_config); + else + params = NULL; - kmem_free(params, DM_MAX_PARAMS_SIZE); - } + if (params != NULL) { + prop_dictionary_set_cstring(target_dict, + DM_TABLE_PARAMS, params); + kmem_free(params, DM_MAX_PARAMS_SIZE); } + prop_array_add(cmd_array, target_dict); prop_object_release(target_dict); } |
