Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dm dm: Refactor target's ->init() i/f
details: https://anonhg.NetBSD.org/src/rev/76778d924569
branches: trunk
changeset: 465944:76778d924569
user: tkusumi <tkusumi%NetBSD.org@localhost>
date: Sun Dec 08 04:41:02 2019 +0000
description:
dm: Refactor target's ->init() i/f
Take dm_table_entry_t* instead of void**.
Remove dm_dev_t* unneeded by target code.
No functional change, but for future changes.
taken-from: DragonFlyBSD
diffstat:
sys/dev/dm/dm.h | 8 ++++----
sys/dev/dm/dm_ioctl.c | 7 +++----
sys/dev/dm/dm_target_error.c | 10 +++++-----
sys/dev/dm/dm_target_linear.c | 8 ++++----
sys/dev/dm/dm_target_mirror.c | 10 +++++-----
sys/dev/dm/dm_target_snapshot.c | 16 ++++++++--------
sys/dev/dm/dm_target_stripe.c | 8 ++++----
sys/dev/dm/dm_target_zero.c | 10 +++++-----
8 files changed, 38 insertions(+), 39 deletions(-)
diffs (truncated from 334 to 300 lines):
diff -r 1de6005e2cab -r 76778d924569 sys/dev/dm/dm.h
--- a/sys/dev/dm/dm.h Sun Dec 08 02:57:52 2019 +0000
+++ b/sys/dev/dm/dm.h Sun Dec 08 04:41:02 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm.h,v 1.34 2019/12/07 15:28:39 tkusumi Exp $ */
+/* $NetBSD: dm.h,v 1.35 2019/12/08 04:41:02 tkusumi Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -213,7 +213,7 @@
typedef struct dm_target {
char name[DM_MAX_TYPE_NAME];
/* Initialize target_config area */
- int (*init)(dm_dev_t *, void **, char *);
+ int (*init)(dm_table_entry_t *, char *);
/* Destroy target_config area */
int (*destroy)(dm_table_entry_t *);
@@ -275,7 +275,7 @@
#define DM_MAX_PARAMS_SIZE 1024
/* dm_target_linear.c */
-int dm_target_linear_init(dm_dev_t *, void**, char *);
+int dm_target_linear_init(dm_table_entry_t *, char *);
char *dm_target_linear_status(void *);
int dm_target_linear_strategy(dm_table_entry_t *, struct buf *);
int dm_target_linear_sync(dm_table_entry_t *);
@@ -288,7 +288,7 @@
uint64_t atoi(const char *);
/* dm_target_stripe.c */
-int dm_target_stripe_init(dm_dev_t *, void**, char *);
+int dm_target_stripe_init(dm_table_entry_t *, char *);
char *dm_target_stripe_status(void *);
int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *);
int dm_target_stripe_sync(dm_table_entry_t *);
diff -r 1de6005e2cab -r 76778d924569 sys/dev/dm/dm_ioctl.c
--- a/sys/dev/dm/dm_ioctl.c Sun Dec 08 02:57:52 2019 +0000
+++ b/sys/dev/dm/dm_ioctl.c Sun Dec 08 04:41:02 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.39 2019/12/06 16:33:47 tkusumi Exp $ */
+/* $NetBSD: dm_ioctl.c,v 1.40 2019/12/08 04:41: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.39 2019/12/06 16:33:47 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.40 2019/12/08 04:41:02 tkusumi Exp $");
/*
* Locking is used to synchronise between ioctl calls and between dm_table's
@@ -780,8 +780,7 @@
* routine and parse parameters there.
*/
- if ((ret = target->init(dmv, &table_en->target_config,
- str)) != 0) {
+ if ((ret = target->init(table_en, str)) != 0) {
dm_table_release(&dmv->table_head, DM_TABLE_INACTIVE);
dm_table_destroy(&dmv->table_head, DM_TABLE_INACTIVE);
free(str, M_TEMP);
diff -r 1de6005e2cab -r 76778d924569 sys/dev/dm/dm_target_error.c
--- a/sys/dev/dm/dm_target_error.c Sun Dec 08 02:57:52 2019 +0000
+++ b/sys/dev/dm/dm_target_error.c Sun Dec 08 04:41:02 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_error.c,v 1.16 2019/12/07 15:28:39 tkusumi Exp $ */
+/* $NetBSD: dm_target_error.c,v 1.17 2019/12/08 04:41: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.16 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.17 2019/12/08 04:41:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper error target.
@@ -42,7 +42,7 @@
#include "dm.h"
/* dm_target_error.c */
-int dm_target_error_init(dm_dev_t *, void**, char *);
+int dm_target_error_init(dm_table_entry_t*, char *);
char *dm_target_error_status(void *);
int dm_target_error_strategy(dm_table_entry_t *, struct buf *);
int dm_target_error_sync(dm_table_entry_t *);
@@ -110,12 +110,12 @@
/* Init function called from dm_table_load_ioctl. */
int
-dm_target_error_init(dm_dev_t *dmv, void **target_config, char *argv)
+dm_target_error_init(dm_table_entry_t *table_en, char *params)
{
printf("Error target init function called!!\n");
- *target_config = NULL;
+ table_en->target_config = NULL;
return 0;
}
diff -r 1de6005e2cab -r 76778d924569 sys/dev/dm/dm_target_linear.c
--- a/sys/dev/dm/dm_target_linear.c Sun Dec 08 02:57:52 2019 +0000
+++ b/sys/dev/dm/dm_target_linear.c Sun Dec 08 04:41:02 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_linear.c,v 1.24 2019/12/07 15:28:39 tkusumi Exp $ */
+/* $NetBSD: dm_target_linear.c,v 1.25 2019/12/08 04:41: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.24 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.25 2019/12/08 04:41:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper dklinear target.
@@ -55,7 +55,7 @@
* @argv[1] is physical data offset.
*/
int
-dm_target_linear_init(dm_dev_t *dmv, void **target_config, char *params)
+dm_target_linear_init(dm_table_entry_t *table_en, char *params)
{
dm_target_linear_config_t *tlc;
dm_pdev_t *dmp;
@@ -86,7 +86,7 @@
tlc->pdev = dmp;
tlc->offset = atoi(argv[1]);
- *target_config = tlc;
+ table_en->target_config = tlc;
return 0;
}
diff -r 1de6005e2cab -r 76778d924569 sys/dev/dm/dm_target_mirror.c
--- a/sys/dev/dm/dm_target_mirror.c Sun Dec 08 02:57:52 2019 +0000
+++ b/sys/dev/dm/dm_target_mirror.c Sun Dec 08 04:41:02 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.14 2019/12/07 15:28:39 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.15 2019/12/08 04:41: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.14 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.15 2019/12/08 04:41:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper mirror target.
@@ -42,7 +42,7 @@
#include "dm.h"
/* dm_target_mirror.c */
-int dm_target_mirror_init(dm_dev_t *, void**, char *);
+int dm_target_mirror_init(dm_table_entry_t *, char *);
char *dm_target_mirror_status(void *);
int dm_target_mirror_strategy(dm_table_entry_t *, struct buf *);
int dm_target_mirror_sync(dm_table_entry_t *);
@@ -114,12 +114,12 @@
* 0 52428800 mirror clustered_disk 4 253:2 1024 UUID block_on_error 3 253:3 0 253:4 0 253:5 0
*/
int
-dm_target_mirror_init(dm_dev_t *dmv, void **target_config, char *argv)
+dm_target_mirror_init(dm_table_entry_t *table_en, char *params)
{
printf("Mirror target init function called!!\n");
- *target_config = NULL;
+ table_en->target_config = NULL;
return ENOSYS;
}
diff -r 1de6005e2cab -r 76778d924569 sys/dev/dm/dm_target_snapshot.c
--- a/sys/dev/dm/dm_target_snapshot.c Sun Dec 08 02:57:52 2019 +0000
+++ b/sys/dev/dm/dm_target_snapshot.c Sun Dec 08 04:41:02 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_snapshot.c,v 1.25 2019/12/07 15:28:39 tkusumi Exp $ */
+/* $NetBSD: dm_target_snapshot.c,v 1.26 2019/12/08 04:41: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.25 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.26 2019/12/08 04:41:02 tkusumi Exp $");
/*
* 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -87,7 +87,7 @@
#include "dm.h"
/* dm_target_snapshot.c */
-int dm_target_snapshot_init(dm_dev_t *, void**, char *);
+int dm_target_snapshot_init(dm_table_entry_t *, char *);
char *dm_target_snapshot_status(void *);
int dm_target_snapshot_strategy(dm_table_entry_t *, struct buf *);
int dm_target_snapshot_deps(dm_table_entry_t *, prop_array_t);
@@ -95,7 +95,7 @@
int dm_target_snapshot_upcall(dm_table_entry_t *, struct buf *);
/* dm snapshot origin driver */
-int dm_target_snapshot_orig_init(dm_dev_t *, void**, char *);
+int dm_target_snapshot_orig_init(dm_table_entry_t *, char *);
char *dm_target_snapshot_orig_status(void *);
int dm_target_snapshot_orig_strategy(dm_table_entry_t *, struct buf *);
int dm_target_snapshot_orig_sync(dm_table_entry_t *);
@@ -192,7 +192,7 @@
* snapshot_origin device, cow device, persistent flag, chunk size
*/
int
-dm_target_snapshot_init(dm_dev_t *dmv, void **target_config, char *params)
+dm_target_snapshot_init(dm_table_entry_t *table_en, char *params)
{
dm_target_snapshot_config_t *tsc;
dm_pdev_t *dmp_snap, *dmp_cow;
@@ -238,7 +238,7 @@
tsc->tsc_snap_dev = dmp_snap;
tsc->tsc_cow_dev = dmp_cow;
- *target_config = tsc;
+ table_en->target_config = tsc;
dmv->sec_size = dmp_snap->dmp_secsize;
@@ -387,7 +387,7 @@
* argv: /dev/mapper/my_data_real
*/
int
-dm_target_snapshot_orig_init(dm_dev_t *dmv, void **target_config, char *params)
+dm_target_snapshot_orig_init(dm_table_entry_t *table_en, char *params)
{
dm_target_snapshot_origin_config_t *tsoc;
dm_pdev_t *dmp_real;
@@ -405,7 +405,7 @@
tsoc = kmem_alloc(sizeof(dm_target_snapshot_origin_config_t), KM_SLEEP);
tsoc->tsoc_real_dev = dmp_real;
- *target_config = tsoc;
+ table_en->target_config = tsoc;
return 0;
}
diff -r 1de6005e2cab -r 76778d924569 sys/dev/dm/dm_target_stripe.c
--- a/sys/dev/dm/dm_target_stripe.c Sun Dec 08 02:57:52 2019 +0000
+++ b/sys/dev/dm/dm_target_stripe.c Sun Dec 08 04:41:02 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.30 2019/12/07 15:28:39 tkusumi Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.31 2019/12/08 04:41: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.30 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.31 2019/12/08 04:41:02 tkusumi Exp $");
/*
* This file implements initial version of device-mapper stripe target.
@@ -128,7 +128,7 @@
* 0 65536 striped 2 512 /dev/hda 0 /dev/hdb 0
*/
int
-dm_target_stripe_init(dm_dev_t *dmv, void **target_config, char *params)
+dm_target_stripe_init(dm_table_entry_t *table_en, char *params)
{
dm_target_linear_config_t *tlc;
dm_target_stripe_config_t *tsc;
@@ -183,7 +183,7 @@
TAILQ_INSERT_TAIL(&tsc->stripe_devs, tlc, entries);
}
- *target_config = tsc;
+ table_en->target_config = tsc;
return 0;
}
diff -r 1de6005e2cab -r 76778d924569 sys/dev/dm/dm_target_zero.c
--- a/sys/dev/dm/dm_target_zero.c Sun Dec 08 02:57:52 2019 +0000
+++ b/sys/dev/dm/dm_target_zero.c Sun Dec 08 04:41:02 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_zero.c,v 1.18 2019/12/07 15:28:39 tkusumi Exp $ */
+/* $NetBSD: dm_target_zero.c,v 1.19 2019/12/08 04:41:02 tkusumi Exp $ */
/*
Home |
Main Index |
Thread Index |
Old Index