Module Name:    src
Committed By:   mlelstv
Date:           Tue Mar 19 06:51:05 UTC 2019

Modified Files:
        src/sys/dev/ata: wd.c wdvar.h

Log Message:
Set disk model name as disk type. The information can be queried through
drvctl(4).


To generate a diff of this commit:
cvs rdiff -u -r1.444 -r1.445 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ata/wdvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.444 src/sys/dev/ata/wd.c:1.445
--- src/sys/dev/ata/wd.c:1.444	Tue Mar 19 06:47:12 2019
+++ src/sys/dev/ata/wd.c	Tue Mar 19 06:51:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.444 2019/03/19 06:47:12 mlelstv Exp $ */
+/*	$NetBSD: wd.c,v 1.445 2019/03/19 06:51:05 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.444 2019/03/19 06:47:12 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.445 2019/03/19 06:51:05 mlelstv Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -309,7 +309,7 @@ wdattach(device_t parent, device_t self,
 	struct dk_softc *dksc = &wd->sc_dksc;
 	struct ata_device *adev= aux;
 	int i, blank;
-	char tbuf[41], pbuf[9], c, *p, *q;
+	char tbuf[41],pbuf[9], c, *p, *q;
 	const struct wd_quirk *wdq;
 	int dtype = DKTYPE_UNKNOWN;
 
@@ -359,7 +359,8 @@ wdattach(device_t parent, device_t self,
 	}
 	*q++ = '\0';
 
-	aprint_normal_dev(self, "<%s>\n", tbuf);
+	wd->sc_typename = kmem_asprintf("%s", tbuf);
+	aprint_normal_dev(self, "<%s>\n", wd->sc_typename);
 
 	wdq = wd_lookup_quirks(tbuf);
 	if (wdq != NULL)
@@ -555,6 +556,10 @@ wddetach(device_t self, int flags)
 	}
 	wd->sc_bscount = 0;
 #endif
+	if (wd->sc_typename != NULL) {
+		kmem_free(wd->sc_typename, strlen(wd->sc_typename) + 1);
+		wd->sc_typename = NULL;
+	}
 
 	pmf_device_deregister(self);
 
@@ -1608,7 +1613,7 @@ wd_set_geometry(struct wd_softc *wd)
 	if ((wd->sc_flags & WDF_LBA) == 0)
 		dg->dg_ncylinders = wd->sc_params.atap_cylinders;
 
-	disk_set_info(dksc->sc_dev, &dksc->sc_dkdev, NULL);
+	disk_set_info(dksc->sc_dev, &dksc->sc_dkdev, wd->sc_typename);
 }
 
 int

Index: src/sys/dev/ata/wdvar.h
diff -u src/sys/dev/ata/wdvar.h:1.47 src/sys/dev/ata/wdvar.h:1.48
--- src/sys/dev/ata/wdvar.h:1.47	Mon Oct 22 20:13:47 2018
+++ src/sys/dev/ata/wdvar.h	Tue Mar 19 06:51:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdvar.h,v 1.47 2018/10/22 20:13:47 jdolecek Exp $	*/
+/*	$NetBSD: wdvar.h,v 1.48 2019/03/19 06:51:05 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -86,6 +86,8 @@ struct wd_softc {
 	int drv_chaos_freq;		/* frequency of simulated bio errors */
 	int drv_chaos_cnt;		/* count of processed bio read xfers */
 #endif
+	unsigned inflight;
+	char *sc_typename;
 };
 
 #endif /* _DEV_ATA_WDVAR_H_ */

Reply via email to