Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Aug 2017 14:45:58 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r321929 - stable/11/usr.sbin/diskinfo
Message-ID:  <201708021445.v72Ejw0o071655@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Aug  2 14:45:58 2017
New Revision: 321929
URL: https://svnweb.freebsd.org/changeset/base/321929

Log:
  MFC r320730: Report device descr in addition to ident.
  
  Serial number without device model is somewhat less useful.

Modified:
  stable/11/usr.sbin/diskinfo/diskinfo.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/diskinfo/diskinfo.c
==============================================================================
--- stable/11/usr.sbin/diskinfo/diskinfo.c	Wed Aug  2 14:45:22 2017	(r321928)
+++ stable/11/usr.sbin/diskinfo/diskinfo.c	Wed Aug  2 14:45:58 2017	(r321929)
@@ -34,6 +34,7 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <string.h>
 #include <strings.h>
 #include <unistd.h>
 #include <errno.h>
@@ -73,6 +74,7 @@ main(int argc, char **argv)
 	int i, ch, fd, error, exitval = 0;
 	char buf[BUFSIZ], ident[DISK_IDENT_SIZE], physpath[MAXPATHLEN];
 	char zone_desc[64];
+	struct diocgattr_arg arg;
 	off_t	mediasize, stripesize, stripeoffset;
 	u_int	sectorsize, fwsectors, fwheads, zoned = 0, isreg;
 	uint32_t zone_mode;
@@ -230,6 +232,10 @@ main(int argc, char **argv)
 				printf("\t%-12u\t# Heads according to firmware.\n", fwheads);
 				printf("\t%-12u\t# Sectors according to firmware.\n", fwsectors);
 			} 
+			strlcpy(arg.name, "GEOM::descr", sizeof(arg.name));
+			arg.len = sizeof(arg.value.str);
+			if (ioctl(fd, DIOCGATTR, &arg) == 0)
+				printf("\t%-12s\t# Disk descr.\n", arg.value.str);
 			if (ioctl(fd, DIOCGIDENT, ident) == 0)
 				printf("\t%-12s\t# Disk ident.\n", ident);
 			if (ioctl(fd, DIOCGPHYSPATH, physpath) == 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708021445.v72Ejw0o071655>