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: Fix "table" output format of dm-linear and dm...



details:   https://anonhg.NetBSD.org/src/rev/9df3d6cb8623
branches:  trunk
changeset: 847378:9df3d6cb8623
user:      tkusumi <tkusumi%NetBSD.org@localhost>
date:      Fri Dec 20 16:16:36 2019 +0000

description:
dm: Fix "table" output format of dm-linear and dm-stripe

The existing "table" output showing device file path of pdev is
not compatible with dm in Linux kernel (and also DragonFlyBSD).
It should be showing "major:minor" instead.

taken-from: DragonFlyBSD

diffstat:

 sys/dev/dm/dm.h               |  3 ++-
 sys/dev/dm/dm_pdev.c          |  8 ++++++--
 sys/dev/dm/dm_target_linear.c |  6 +++---
 sys/dev/dm/dm_target_stripe.c |  6 +++---
 4 files changed, 14 insertions(+), 9 deletions(-)

diffs (100 lines):

diff -r ed7ff6c3ef7f -r 9df3d6cb8623 sys/dev/dm/dm.h
--- a/sys/dev/dm/dm.h   Fri Dec 20 14:09:23 2019 +0000
+++ b/sys/dev/dm/dm.h   Fri Dec 20 16:16:36 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm.h,v 1.48 2019/12/16 15:59:04 tkusumi Exp $      */
+/*        $NetBSD: dm.h,v 1.49 2019/12/20 16:16:36 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -103,6 +103,7 @@
  */
 typedef struct dm_pdev {
        char name[MAX_DEV_NAME];
+       char udev_name[MAX_DEV_NAME];
 
        struct vnode *pdev_vnode;
        uint64_t pdev_numsec;
diff -r ed7ff6c3ef7f -r 9df3d6cb8623 sys/dev/dm/dm_pdev.c
--- a/sys/dev/dm/dm_pdev.c      Fri Dec 20 14:09:23 2019 +0000
+++ b/sys/dev/dm/dm_pdev.c      Fri Dec 20 16:16:36 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_pdev.c,v 1.21 2019/12/15 14:39:42 tkusumi Exp $      */
+/*        $NetBSD: dm_pdev.c,v 1.22 2019/12/20 16:16:36 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_pdev.c,v 1.21 2019/12/15 14:39:42 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.22 2019/12/20 16:16:36 tkusumi Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -127,6 +127,10 @@
        getdisksize(dmp->pdev_vnode, &dmp->pdev_numsec, &dmp->pdev_secsize);
        dmp->ref_cnt = 1;
 
+       snprintf(dmp->udev_name, sizeof(dmp->udev_name), "%d:%d",
+           major(dmp->pdev_vnode->v_rdev), minor(dmp->pdev_vnode->v_rdev));
+       aprint_debug("%s: %s %s\n", __func__, dev_name, dmp->udev_name);
+
        SLIST_INSERT_HEAD(&dm_pdev_list, dmp, next_pdev);
        mutex_exit(&dm_pdev_mutex);
 
diff -r ed7ff6c3ef7f -r 9df3d6cb8623 sys/dev/dm/dm_target_linear.c
--- a/sys/dev/dm/dm_target_linear.c     Fri Dec 20 14:09:23 2019 +0000
+++ b/sys/dev/dm/dm_target_linear.c     Fri Dec 20 16:16:36 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_linear.c,v 1.33 2019/12/18 14:31:35 tkusumi Exp $      */
+/*        $NetBSD: dm_target_linear.c,v 1.34 2019/12/20 16:16:36 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.33 2019/12/18 14:31:35 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.34 2019/12/20 16:16:36 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -96,7 +96,7 @@
 
        params = kmem_alloc(DM_MAX_PARAMS_SIZE, KM_SLEEP);
        snprintf(params, DM_MAX_PARAMS_SIZE, "%s %" PRIu64,
-           tlc->pdev->name, tlc->offset);
+           tlc->pdev->udev_name, tlc->offset);
 
        return params;
 }
diff -r ed7ff6c3ef7f -r 9df3d6cb8623 sys/dev/dm/dm_target_stripe.c
--- a/sys/dev/dm/dm_target_stripe.c     Fri Dec 20 14:09:23 2019 +0000
+++ b/sys/dev/dm/dm_target_stripe.c     Fri Dec 20 16:16:36 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.40 2019/12/18 14:31:35 tkusumi Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.41 2019/12/20 16:16:36 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.40 2019/12/18 14:31:35 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.41 2019/12/20 16:16:36 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper stripe target.
@@ -197,7 +197,7 @@
 
        TAILQ_FOREACH(tlc, &tsc->stripe_devs, entries) {
                snprintf(tmp, DM_MAX_PARAMS_SIZE, " %s %" PRIu64,
-                   tlc->pdev->name, tlc->offset);
+                   tlc->pdev->udev_name, tlc->offset);
                strcat(params, tmp);
        }
 



Home | Main Index | Thread Index | Old Index