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: Add dummy target ->sync()/->secsize() to prev...



details:   https://anonhg.NetBSD.org/src/rev/8f4fe168a36f
branches:  trunk
changeset: 967420:8f4fe168a36f
user:      tkusumi <tkusumi%NetBSD.org@localhost>
date:      Sun Dec 08 14:59:42 2019 +0000

description:
dm: Add dummy target ->sync()/->secsize() to prevent panic on modload(8)

dm_target_insert() has assertions to ensure targets implement all handlers.
Adding dummy ones at least prevents panic on modload(8).

diffstat:

 sys/dev/dm/dm.h                 |   9 ++++++++-
 sys/dev/dm/dm_target_error.c    |   5 +++--
 sys/dev/dm/dm_target_mirror.c   |   5 +++--
 sys/dev/dm/dm_target_snapshot.c |  15 +++++++++++++--
 sys/dev/dm/dm_target_zero.c     |   5 +++--
 5 files changed, 30 insertions(+), 9 deletions(-)

diffs (161 lines):

diff -r fa5897e9b158 -r 8f4fe168a36f sys/dev/dm/dm.h
--- a/sys/dev/dm/dm.h   Sun Dec 08 13:19:59 2019 +0000
+++ b/sys/dev/dm/dm.h   Sun Dec 08 14:59:42 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm.h,v 1.37 2019/12/08 10:50:21 tkusumi Exp $      */
+/*        $NetBSD: dm.h,v 1.38 2019/12/08 14:59:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -293,6 +293,13 @@
 int dm_pdev_init(void);
 dm_pdev_t* dm_pdev_insert(const char *);
 
+/* XXX dummy */
+static __inline int
+dm_target_dummy_secsize(dm_table_entry_t *table_en, unsigned *secsizep)
+{
+       return 0;
+}
+
 #endif /*_KERNEL*/
 
 #endif /*_DM_DEV_H_*/
diff -r fa5897e9b158 -r 8f4fe168a36f sys/dev/dm/dm_target_error.c
--- a/sys/dev/dm/dm_target_error.c      Sun Dec 08 13:19:59 2019 +0000
+++ b/sys/dev/dm/dm_target_error.c      Sun Dec 08 14:59:42 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_error.c,v 1.17 2019/12/08 04:41:02 tkusumi Exp $      */
+/*        $NetBSD: dm_target_error.c,v 1.18 2019/12/08 14:59:42 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.17 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.18 2019/12/08 14:59:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -88,6 +88,7 @@
                dmt->deps = &dm_target_error_deps;
                dmt->destroy = &dm_target_error_destroy;
                dmt->upcall = &dm_target_error_upcall;
+               dmt->secsize = dm_target_dummy_secsize;
 
                r = dm_target_insert(dmt);
 
diff -r fa5897e9b158 -r 8f4fe168a36f sys/dev/dm/dm_target_mirror.c
--- a/sys/dev/dm/dm_target_mirror.c     Sun Dec 08 13:19:59 2019 +0000
+++ b/sys/dev/dm/dm_target_mirror.c     Sun Dec 08 14:59:42 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.16 2019/12/08 10:50:21 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.17 2019/12/08 14:59:42 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.16 2019/12/08 10:50:21 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.17 2019/12/08 14:59:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper mirror target.
@@ -100,6 +100,7 @@
                dmt->deps = &dm_target_mirror_deps;
                dmt->destroy = &dm_target_mirror_destroy;
                dmt->upcall = &dm_target_mirror_upcall;
+               dmt->secsize = dm_target_dummy_secsize;
 
                r = dm_target_insert(dmt);
 
diff -r fa5897e9b158 -r 8f4fe168a36f sys/dev/dm/dm_target_snapshot.c
--- a/sys/dev/dm/dm_target_snapshot.c   Sun Dec 08 13:19:59 2019 +0000
+++ b/sys/dev/dm/dm_target_snapshot.c   Sun Dec 08 14:59:42 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_snapshot.c,v 1.28 2019/12/08 10:50:21 tkusumi Exp $      */
+/*        $NetBSD: dm_target_snapshot.c,v 1.29 2019/12/08 14:59:42 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.28 2019/12/08 10:50:21 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.29 2019/12/08 14:59:42 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -90,6 +90,7 @@
 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_sync(dm_table_entry_t *);
 int dm_target_snapshot_deps(dm_table_entry_t *, prop_array_t);
 int dm_target_snapshot_destroy(dm_table_entry_t *);
 int dm_target_snapshot_upcall(dm_table_entry_t *, struct buf *);
@@ -158,9 +159,11 @@
                dmt->init = &dm_target_snapshot_init;
                dmt->status = &dm_target_snapshot_status;
                dmt->strategy = &dm_target_snapshot_strategy;
+               dmt->sync = &dm_target_snapshot_sync;
                dmt->deps = &dm_target_snapshot_deps;
                dmt->destroy = &dm_target_snapshot_destroy;
                dmt->upcall = &dm_target_snapshot_upcall;
+               dmt->secsize = dm_target_dummy_secsize;
 
                r = dm_target_insert(dmt);
 
@@ -174,6 +177,7 @@
                dmt1->deps = &dm_target_snapshot_orig_deps;
                dmt1->destroy = &dm_target_snapshot_orig_destroy;
                dmt1->upcall = &dm_target_snapshot_orig_upcall;
+               dmt1->secsize = dm_target_dummy_secsize;
 
                r = dm_target_insert(dmt1);
                break;
@@ -319,6 +323,13 @@
        return 0;
 }
 
+/* XXX dummy */
+int
+dm_target_snapshot_sync(dm_table_entry_t *table_en)
+{
+       return 0;
+}
+
 /* Doesn't do anything here. */
 int
 dm_target_snapshot_destroy(dm_table_entry_t *table_en)
diff -r fa5897e9b158 -r 8f4fe168a36f sys/dev/dm/dm_target_zero.c
--- a/sys/dev/dm/dm_target_zero.c       Sun Dec 08 13:19:59 2019 +0000
+++ b/sys/dev/dm/dm_target_zero.c       Sun Dec 08 14:59:42 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_zero.c,v 1.19 2019/12/08 04:41:02 tkusumi Exp $      */
+/*        $NetBSD: dm_target_zero.c,v 1.20 2019/12/08 14:59:42 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.19 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.20 2019/12/08 14:59:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper zero target.
@@ -88,6 +88,7 @@
                dmt->deps = &dm_target_zero_deps;
                dmt->destroy = &dm_target_zero_destroy;
                dmt->upcall = &dm_target_zero_upcall;
+               dmt->secsize = dm_target_dummy_secsize;
 
                r = dm_target_insert(dmt);
                break;



Home | Main Index | Thread Index | Old Index