Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177367097
D7828.1794211723.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D7828.1794211723.diff
View Options
Index: head/usr.sbin/diskinfo/diskinfo.8
===================================================================
--- head/usr.sbin/diskinfo/diskinfo.8
+++ head/usr.sbin/diskinfo/diskinfo.8
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 22, 2016
+.Dd July 1, 2017
.Dt DISKINFO 8
.Os
.Sh NAME
@@ -38,6 +38,12 @@
.Nm
.Op Fl citv
.Ar disk ...
+.Nm
+.Op Fl p
+.Ar disk ...
+.Nm
+.Op Fl s
+.Ar disk ...
.Sh DESCRIPTION
The
.Nm
@@ -52,6 +58,12 @@
Perform a simple measurement of the I/O read command overhead.
.It Fl i
Perform a simple IOPS benchmark.
+.It Fl p
+Return the physical path of the disk.
+This is a string that identifies the physical path to the disk in the
+storage enclsoure.
+.It Fl s
+Return the disk serial number
.It Fl t
Perform a simple and rather naive benchmark of the disks seek
and transfer performance.
@@ -62,6 +74,13 @@
media size in sectors, stripe size, stripe offset, firmware cylinders,
firmware heads, and firmware sectors.
The last three fields are only present if the information is available.
+.It Fl i
+Return the disk ident, usually the serial number.
+.It Fl p
+Return the physical path of the disk.
+This is a string that identifies the physical path to the disk in the
+storage enclsoure.
+.El
.Sh HISTORY
The
.Nm
Index: head/usr.sbin/diskinfo/diskinfo.c
===================================================================
--- head/usr.sbin/diskinfo/diskinfo.c
+++ head/usr.sbin/diskinfo/diskinfo.c
@@ -55,7 +55,7 @@
exit (1);
}
-static int opt_c, opt_i, opt_t, opt_v;
+static int opt_c, opt_i, opt_p, opt_s, opt_t, opt_v;
static void speeddisk(int fd, off_t mediasize, u_int sectorsize);
static void commandtime(int fd, off_t mediasize, u_int sectorsize);
@@ -74,7 +74,7 @@
u_int sectorsize, fwsectors, fwheads, zoned = 0;
uint32_t zone_mode;
- while ((ch = getopt(argc, argv, "citv")) != -1) {
+ while ((ch = getopt(argc, argv, "cipstv")) != -1) {
switch (ch) {
case 'c':
opt_c = 1;
@@ -84,6 +84,12 @@
opt_i = 1;
opt_v = 1;
break;
+ case 'p':
+ opt_p = 1;
+ break;
+ case 's':
+ opt_s = 1;
+ break;
case 't':
opt_t = 1;
opt_v = 1;
@@ -101,6 +107,11 @@
if (argc < 1)
usage();
+ if ((opt_p && opt_s) || ((opt_p || opt_s) && (opt_c || opt_i || opt_t || opt_v))) {
+ warnx("-p or -s cannot be used with other options");
+ usage();
+ }
+
for (i = 0; i < argc; i++) {
fd = open(argv[i], O_RDONLY | O_DIRECT);
if (fd < 0 && errno == ENOENT && *argv[i] != '/') {
@@ -124,7 +135,27 @@
fwheads = 0;
stripesize = sb.st_blksize;
stripeoffset = 0;
+ if (opt_p || opt_s) {
+ warnx("-p and -s only operate on physical devices: %s", argv[i]);
+ goto out;
+ }
} else {
+ if (opt_p) {
+ if (ioctl(fd, DIOCGPHYSPATH, physpath) == 0) {
+ printf("%s\n", physpath);
+ } else {
+ warnx("Failed to determine physpath for: %s", argv[i]);
+ }
+ goto out;
+ }
+ if (opt_s) {
+ if (ioctl(fd, DIOCGIDENT, ident) == 0) {
+ printf("%s\n", ident);
+ } else {
+ warnx("Failed to determine serial number for: %s", argv[i]);
+ }
+ goto out;
+ }
error = ioctl(fd, DIOCGMEDIASIZE, &mediasize);
if (error) {
warnx("%s: ioctl(DIOCGMEDIASIZE) failed, probably not a disk.", argv[i]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 9, 8:08 AM (2 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41607625
Default Alt Text
D7828.1794211723.diff (3 KB)
Attached To
Mode
D7828: Add -p (physpath) and -s (serial#) to diskinfo
Attached
Detach File
Event Timeline