Commit Diff


commit - 21d2a1649cd72d7726158c5bf09a2ce32efb5ecc
commit + 47e7231af327f44dffcd608ef7368306745fe45a
blob - f9ad11834abf0b448410c7d5bf17a6e995d08756
blob + f9447fde737162e13d9bc8c5e674892ea56543e8
--- diskinfo.1
+++ diskinfo.1
@@ -30,7 +30,15 @@
 The
 .Nm
 utility displays information about the specified
-.Ar disk .
+.Ar disk
+device.
+The
+.Ar disk
+operand can be a
+.Dq short form
+name or
+.Xr disklabel 8
+UID.
 If no operands are specified,
 information for all available disks is displayed.
 By default, size values are displayed as 512-byte block counts.
blob - aeaf6cd60f2e4595b27378f8241f9aea748357f8
blob + 3ac2099e6ccc3686cad4b424faa1bcc900cd58a9
--- diskinfo.c
+++ diskinfo.c
@@ -80,7 +80,8 @@ print_partition(const char *devname, const struct disk
 	int j;
 
 	if (DL_GETPSIZE(pp)) {
-		printf("\n%c-- %s%c\t", last ? '`' : '|', devname,
+		printf("\n%c-- %s%s%c\t", last ? '`' : '|',devname,
+		    isduid(devname, OPENDEV_PART) ? "." : "",
 		    DL_PARTNUM2NAME(i));
 		    
 		if (human) {
@@ -120,9 +121,11 @@ print_device(char *devname, int human)
 		err(1, "%s: ioctl(DIOCGDINFO)", __func__);
 
 	printf("%s:", devname);
-	printf("%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
-	    dl.d_uid[0], dl.d_uid[1], dl.d_uid[2], dl.d_uid[3],
-	    dl.d_uid[4], dl.d_uid[5], dl.d_uid[6], dl.d_uid[7]);
+	if (!isduid(devname, OPENDEV_PART)) {
+		printf("%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
+		    dl.d_uid[0], dl.d_uid[1], dl.d_uid[2], dl.d_uid[3],
+		    dl.d_uid[4], dl.d_uid[5], dl.d_uid[6], dl.d_uid[7]);
+	}
 	printf(" [%s %s]", di.vendor, di.product);
 
 	last_i = -1;