dm: Rename targets' ->status() to ->table() given ->info() exists

Since now that dm targets in NetBSD have ->info() for "status",
->status() should be renamed to ->table() for "table",
given how dm target status was originally designed in Linux kernel.

taken-from: DragonFlyBSD
This commit is contained in:
tkusumi 2019-12-15 05:56:02 +00:00
parent cd7f626ab2
commit 8026110e0c
9 changed files with 54 additions and 54 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm.h,v 1.41 2019/12/14 17:15:54 tkusumi Exp $ */
/* $NetBSD: dm.h,v 1.42 2019/12/15 05:56:02 tkusumi Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -184,12 +184,12 @@ typedef struct dm_target {
int (*deps) (dm_table_entry_t *, prop_array_t);
/*
* Info/status routine are called to get params string, which is target
* Info/table routine are called to get params string, which is target
* specific. When dm_table_status_ioctl is called with flag
* DM_STATUS_TABLE_FLAG I have to sent params string back.
*/
char *(*info)(void *);
char * (*status)(void *);
char *(*table)(void *);
int (*strategy)(dm_table_entry_t *, struct buf *);
int (*sync)(dm_table_entry_t *);
int (*upcall)(dm_table_entry_t *, struct buf *);
@ -242,7 +242,7 @@ int dm_target_init(void);
/* dm_target_linear.c */
int dm_target_linear_init(dm_table_entry_t *, int, char **);
char *dm_target_linear_status(void *);
char *dm_target_linear_table(void *);
int dm_target_linear_strategy(dm_table_entry_t *, struct buf *);
int dm_target_linear_sync(dm_table_entry_t *);
int dm_target_linear_deps(dm_table_entry_t *, prop_array_t);
@ -255,7 +255,7 @@ uint64_t atoi(const char *);
/* dm_target_stripe.c */
int dm_target_stripe_init(dm_table_entry_t *, int, char **);
char *dm_target_stripe_status(void *);
char *dm_target_stripe_table(void *);
int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *);
int dm_target_stripe_sync(dm_table_entry_t *);
int dm_target_stripe_deps(dm_table_entry_t *, prop_array_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm_ioctl.c,v 1.44 2019/12/14 17:15:54 tkusumi Exp $ */
/* $NetBSD: dm_ioctl.c,v 1.45 2019/12/15 05:56:02 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.44 2019/12/14 17:15:54 tkusumi Exp $");
__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.45 2019/12/15 05:56:02 tkusumi Exp $");
/*
* Locking is used to synchronise between ioctl calls and between dm_table's
@ -943,7 +943,7 @@ 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(
params = table_en->target->table(
table_en->target_config);
else if (table_en->target->info)
params = table_en->target->info(

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm_target.c,v 1.28 2019/12/14 10:49:30 tkusumi Exp $ */
/* $NetBSD: dm_target.c,v 1.29 2019/12/15 05:56:02 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_target.c,v 1.28 2019/12/14 10:49:30 tkusumi Exp $");
__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.29 2019/12/15 05:56:02 tkusumi Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -160,8 +160,8 @@ dm_target_insert(dm_target_t *dm_target)
printf("%s missing init\n", dm_target->name);
return EINVAL;
}
if (dm_target->status == NULL) {
printf("%s missing status\n", dm_target->name);
if (dm_target->table == NULL) {
printf("%s missing table\n", dm_target->name);
return EINVAL;
}
if (dm_target->strategy == NULL) {
@ -331,7 +331,7 @@ dm_target_init(void)
dmt->version[1] = 0;
dmt->version[2] = 2;
dmt->init = &dm_target_linear_init;
dmt->status = &dm_target_linear_status;
dmt->table = &dm_target_linear_table;
dmt->strategy = &dm_target_linear_strategy;
dmt->sync = &dm_target_linear_sync;
dmt->deps = &dm_target_linear_deps;
@ -345,7 +345,7 @@ dm_target_init(void)
dmt3->version[1] = 0;
dmt3->version[2] = 3;
dmt3->init = &dm_target_stripe_init;
dmt3->status = &dm_target_stripe_status;
dmt3->table = &dm_target_stripe_table;
dmt3->strategy = &dm_target_stripe_strategy;
dmt3->sync = &dm_target_stripe_sync;
dmt3->deps = &dm_target_stripe_deps;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm_target_error.c,v 1.20 2019/12/14 10:02:35 tkusumi Exp $ */
/* $NetBSD: dm_target_error.c,v 1.21 2019/12/15 05:56:02 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_target_error.c,v 1.20 2019/12/14 10:02:35 tkusumi Exp $");
__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.21 2019/12/15 05:56:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper error target.
@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.20 2019/12/14 10:02:35 tkusumi
/* dm_target_error.c */
int dm_target_error_init(dm_table_entry_t*, int, char **);
char *dm_target_error_status(void *);
char *dm_target_error_table(void *);
int dm_target_error_strategy(dm_table_entry_t *, struct buf *);
int dm_target_error_sync(dm_table_entry_t *);
int dm_target_error_deps(dm_table_entry_t *, prop_array_t);
@ -82,7 +82,7 @@ dm_target_error_modcmd(modcmd_t cmd, void *arg)
dmt->version[1] = 0;
dmt->version[2] = 0;
dmt->init = &dm_target_error_init;
dmt->status = &dm_target_error_status;
dmt->table = &dm_target_error_table;
dmt->strategy = &dm_target_error_strategy;
dmt->sync = &dm_target_error_sync;
dmt->deps = &dm_target_error_deps;
@ -121,9 +121,9 @@ dm_target_error_init(dm_table_entry_t *table_en, int argc, char **argv)
return 0;
}
/* Status routine called to get params string. */
/* Table routine called to get params string. */
char *
dm_target_error_status(void *target_config)
dm_target_error_table(void *target_config)
{
return NULL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm_target_linear.c,v 1.28 2019/12/14 10:02:35 tkusumi Exp $ */
/* $NetBSD: dm_target_linear.c,v 1.29 2019/12/15 05:56:02 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_target_linear.c,v 1.28 2019/12/14 10:02:35 tkusumi Exp $");
__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.29 2019/12/15 05:56:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper dklinear target.
@ -84,18 +84,18 @@ dm_target_linear_init(dm_table_entry_t *table_en, int argc, char **argv)
}
/*
* Status routine is called to get params string, which is target
* Table routine is called to get params string, which is target
* specific. When dm_table_status_ioctl is called with flag
* DM_STATUS_TABLE_FLAG I have to sent params string back.
*/
char *
dm_target_linear_status(void *target_config)
dm_target_linear_table(void *target_config)
{
dm_target_linear_config_t *tlc;
char *params;
tlc = target_config;
aprint_debug("Linear target status function called\n");
aprint_debug("Linear target table function called\n");
params = kmem_alloc(DM_MAX_PARAMS_SIZE, KM_SLEEP);
snprintf(params, DM_MAX_PARAMS_SIZE, "%s %" PRIu64,

View File

@ -1,4 +1,4 @@
/*$NetBSD: dm_target_mirror.c,v 1.19 2019/12/14 10:02:35 tkusumi Exp $*/
/*$NetBSD: dm_target_mirror.c,v 1.20 2019/12/15 05:56:02 tkusumi Exp $*/
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.19 2019/12/14 10:02:35 tkusumi Exp $");
__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.20 2019/12/15 05:56:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper mirror target.
@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.19 2019/12/14 10:02:35 tkusum
/* dm_target_mirror.c */
int dm_target_mirror_init(dm_table_entry_t *, int, char **);
char *dm_target_mirror_status(void *);
char *dm_target_mirror_table(void *);
int dm_target_mirror_strategy(dm_table_entry_t *, struct buf *);
int dm_target_mirror_sync(dm_table_entry_t *);
int dm_target_mirror_deps(dm_table_entry_t *, prop_array_t);
@ -94,7 +94,7 @@ dm_target_mirror_modcmd(modcmd_t cmd, void *arg)
dmt->version[1] = 0;
dmt->version[2] = 0;
dmt->init = &dm_target_mirror_init;
dmt->status = &dm_target_mirror_status;
dmt->table = &dm_target_mirror_table;
dmt->strategy = &dm_target_mirror_strategy;
dmt->sync = &dm_target_mirror_sync;
dmt->deps = &dm_target_mirror_deps;
@ -137,9 +137,9 @@ dm_target_mirror_init(dm_table_entry_t *table_en, int argc, char **argv)
return ENOSYS;
}
/* Status routine called to get params string. */
/* Table routine called to get params string. */
char *
dm_target_mirror_status(void *target_config)
dm_target_mirror_table(void *target_config)
{
return NULL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm_target_snapshot.c,v 1.31 2019/12/14 10:02:35 tkusumi Exp $ */
/* $NetBSD: dm_target_snapshot.c,v 1.32 2019/12/15 05:56:02 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_target_snapshot.c,v 1.31 2019/12/14 10:02:35 tkusumi Exp $");
__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.32 2019/12/15 05:56:02 tkusumi Exp $");
/*
* 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@ -88,7 +88,7 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.31 2019/12/14 10:02:35 tkus
/* dm_target_snapshot.c */
int dm_target_snapshot_init(dm_table_entry_t *, int, char **);
char *dm_target_snapshot_status(void *);
char *dm_target_snapshot_table(void *);
int dm_target_snapshot_strategy(dm_table_entry_t *, struct buf *);
int dm_target_snapshot_sync(dm_table_entry_t *);
int dm_target_snapshot_deps(dm_table_entry_t *, prop_array_t);
@ -97,7 +97,7 @@ int dm_target_snapshot_upcall(dm_table_entry_t *, struct buf *);
/* dm snapshot origin driver */
int dm_target_snapshot_orig_init(dm_table_entry_t *, int, char **);
char *dm_target_snapshot_orig_status(void *);
char *dm_target_snapshot_orig_table(void *);
int dm_target_snapshot_orig_strategy(dm_table_entry_t *, struct buf *);
int dm_target_snapshot_orig_sync(dm_table_entry_t *);
int dm_target_snapshot_orig_deps(dm_table_entry_t *, prop_array_t);
@ -157,7 +157,7 @@ dm_target_snapshot_modcmd(modcmd_t cmd, void *arg)
dmt->version[1] = 0;
dmt->version[2] = 5;
dmt->init = &dm_target_snapshot_init;
dmt->status = &dm_target_snapshot_status;
dmt->table = &dm_target_snapshot_table;
dmt->strategy = &dm_target_snapshot_strategy;
dmt->sync = &dm_target_snapshot_sync;
dmt->deps = &dm_target_snapshot_deps;
@ -171,7 +171,7 @@ dm_target_snapshot_modcmd(modcmd_t cmd, void *arg)
dmt1->version[1] = 0;
dmt1->version[2] = 5;
dmt1->init = &dm_target_snapshot_orig_init;
dmt1->status = &dm_target_snapshot_orig_status;
dmt1->table = &dm_target_snapshot_orig_table;
dmt1->strategy = &dm_target_snapshot_orig_strategy;
dmt1->sync = &dm_target_snapshot_orig_sync;
dmt1->deps = &dm_target_snapshot_orig_deps;
@ -249,12 +249,12 @@ dm_target_snapshot_init(dm_table_entry_t *table_en, int argc, char **argv)
}
/*
* Status routine is called to get params string, which is target
* Table routine is called to get params string, which is target
* specific. When dm_table_status_ioctl is called with flag
* DM_STATUS_TABLE_FLAG I have to sent params string back.
*/
char *
dm_target_snapshot_status(void *target_config)
dm_target_snapshot_table(void *target_config)
{
dm_target_snapshot_config_t *tsc;
@ -269,7 +269,7 @@ dm_target_snapshot_status(void *target_config)
cow_len = 0;
count = 0;
printf("Snapshot target status function called\n");
printf("Snapshot target table function called\n");
/* count number of chars in offset */
for (i = tsc->tsc_chunk_size; i != 0; i /= 10)
@ -415,12 +415,12 @@ dm_target_snapshot_orig_init(dm_table_entry_t *table_en, int argc, char **argv)
}
/*
* Status routine is called to get params string, which is target
* Table routine is called to get params string, which is target
* specific. When dm_table_status_ioctl is called with flag
* DM_STATUS_TABLE_FLAG I have to sent params string back.
*/
char *
dm_target_snapshot_orig_status(void *target_config)
dm_target_snapshot_orig_table(void *target_config)
{
dm_target_snapshot_origin_config_t *tsoc;
@ -431,7 +431,7 @@ dm_target_snapshot_orig_status(void *target_config)
prm_len = 0;
printf("Snapshot origin target status function called\n");
printf("Snapshot origin target table function called\n");
/* length of names + count of chars + spaces and null char */
prm_len = strlen(tsoc->tsoc_real_dev->name) + 1;

View File

@ -1,4 +1,4 @@
/*$NetBSD: dm_target_stripe.c,v 1.35 2019/12/14 10:02:35 tkusumi Exp $*/
/*$NetBSD: dm_target_stripe.c,v 1.36 2019/12/15 05:56:02 tkusumi Exp $*/
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.35 2019/12/14 10:02:35 tkusumi Exp $");
__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.36 2019/12/15 05:56:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper stripe target.
@ -82,7 +82,7 @@ dm_target_stripe_modcmd(modcmd_t cmd, void *arg)
dmt->version[1] = 0;
dmt->version[2] = 0;
dmt->init = &dm_target_stripe_init;
dmt->status = &dm_target_stripe_status;
dmt->table = &dm_target_stripe_table;
dmt->strategy = &dm_target_stripe_strategy;
dmt->sync = &dm_target_stripe_sync;
dmt->deps = &dm_target_stripe_deps;
@ -183,9 +183,9 @@ dm_target_stripe_init(dm_table_entry_t *table_en, int argc, char **argv)
return 0;
}
/* Status routine called to get params string. */
/* Table routine called to get params string. */
char *
dm_target_stripe_status(void *target_config)
dm_target_stripe_table(void *target_config)
{
dm_target_linear_config_t *tlc;
dm_target_stripe_config_t *tsc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm_target_zero.c,v 1.22 2019/12/14 10:02:35 tkusumi Exp $ */
/* $NetBSD: dm_target_zero.c,v 1.23 2019/12/15 05:56:02 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_target_zero.c,v 1.22 2019/12/14 10:02:35 tkusumi Exp $");
__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.23 2019/12/15 05:56:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper zero target.
@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.22 2019/12/14 10:02:35 tkusumi
/* dm_target_zero.c */
int dm_target_zero_init(dm_table_entry_t *, int, char **);
char *dm_target_zero_status(void *);
char *dm_target_zero_table(void *);
int dm_target_zero_strategy(dm_table_entry_t *, struct buf *);
int dm_target_zero_sync(dm_table_entry_t *);
int dm_target_zero_destroy(dm_table_entry_t *);
@ -82,7 +82,7 @@ dm_target_zero_modcmd(modcmd_t cmd, void *arg)
dmt->version[1] = 0;
dmt->version[2] = 0;
dmt->init = &dm_target_zero_init;
dmt->status = &dm_target_zero_status;
dmt->table = &dm_target_zero_table;
dmt->strategy = &dm_target_zero_strategy;
dmt->sync = &dm_target_zero_sync;
dmt->deps = &dm_target_zero_deps;
@ -124,9 +124,9 @@ dm_target_zero_init(dm_table_entry_t *table_en, int argc, char **argv)
return 0;
}
/* Status routine called to get params string. */
/* Table routine called to get params string. */
char *
dm_target_zero_status(void *target_config)
dm_target_zero_table(void *target_config)
{
return NULL;
}