Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Make getdiskinfo() compatible with a DIOCGWEDGEINFO.



details:   https://anonhg.NetBSD.org/src/rev/b370295034d6
branches:  trunk
changeset: 1007767:b370295034d6
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Feb 29 14:44:44 2020 +0000

description:
Make getdiskinfo() compatible with a DIOCGWEDGEINFO.

dkw_parent is defined to hold the disk name as used by disk_find(), not
a partition (i.e. no partition letter appended).

diffstat:

 sys/kern/subr_disk_open.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r f64f56bf1515 -r b370295034d6 sys/kern/subr_disk_open.c
--- a/sys/kern/subr_disk_open.c Sat Feb 29 14:03:17 2020 +0000
+++ b/sys/kern/subr_disk_open.c Sat Feb 29 14:44:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_disk_open.c,v 1.14 2019/02/20 10:02:51 hannken Exp $      */
+/*     $NetBSD: subr_disk_open.c,v 1.15 2020/02/29 14:44:44 mlelstv Exp $      */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.14 2019/02/20 10:02:51 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.15 2020/02/29 14:44:44 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -160,7 +160,8 @@
 
        dkw->dkw_wname[0] = '\0';
 
-       strlcpy(dkw->dkw_parent, dkw->dkw_devname, sizeof(dkw->dkw_parent));
+       snprintf(dkw->dkw_parent, sizeof(dkw->dkw_parent), "%s%" PRId32,
+           devsw_blk2name(major(dev)), DISKUNIT(dev));
 
        dkw->dkw_size = pi.pi_size;
        dkw->dkw_offset = pi.pi_offset;



Home | Main Index | Thread Index | Old Index