mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
diskinfo(8): introduce new option -l
In modes -p or -s, add an option -l to start each line
with a device name separated with a tab. Update the manual page.
Add an example to list names with corresponding serial numbers:
diskinfo -ls /dev/da?
(cherry picked from commit e333110d1d
)
This commit is contained in:
parent
229bdf3093
commit
9fd628361b
|
@ -27,7 +27,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd July 4, 2017
|
||||
.Dd March 5, 2024
|
||||
.Dt DISKINFO 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -38,10 +38,12 @@
|
|||
.Op Fl citSvw
|
||||
.Ar disk ...
|
||||
.Nm
|
||||
.Op Fl p
|
||||
.Op Fl l
|
||||
.Fl p
|
||||
.Ar disk ...
|
||||
.Nm
|
||||
.Op Fl s
|
||||
.Op Fl l
|
||||
.Fl s
|
||||
.Ar disk ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
|
@ -57,6 +59,13 @@ Print fields one per line with a descriptive comment.
|
|||
Perform a simple measurement of the I/O read command overhead.
|
||||
.It Fl i
|
||||
Perform a simple IOPS benchmark.
|
||||
.It Fl l
|
||||
In case of
|
||||
.Fl p
|
||||
or
|
||||
.Fl s
|
||||
modes prepend each line of an output with a device name using a tab
|
||||
character as a separator.
|
||||
.It Fl p
|
||||
Return the physical path of the disk.
|
||||
This is a string that identifies the physical path to the disk in the
|
||||
|
@ -80,6 +89,14 @@ with the following fields: device name, sectorsize, media size in bytes,
|
|||
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.
|
||||
.Sh EXAMPLES
|
||||
List first ten (at most)
|
||||
.Xr da 4
|
||||
devices with corresponding serial numbers:
|
||||
.Pp
|
||||
.Dl diskinfo -ls /dev/da?
|
||||
.Sh SEE ALSO
|
||||
.Xr da 4
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
|
|
|
@ -58,11 +58,14 @@
|
|||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: diskinfo [-cipsStvw] disk ...\n");
|
||||
fprintf(stderr, "usage: diskinfo [-ciStvw] disk ...\n"
|
||||
" diskinfo [-l] -p disk ...\n"
|
||||
" diskinfo [-l] -s disk ...\n"
|
||||
);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static int opt_c, opt_i, opt_p, opt_s, opt_S, opt_t, opt_v, opt_w;
|
||||
static int opt_c, opt_i, opt_l, opt_p, opt_s, opt_S, opt_t, opt_v, opt_w;
|
||||
|
||||
static bool candelete(int fd);
|
||||
static void speeddisk(int fd, off_t mediasize, u_int sectorsize);
|
||||
|
@ -88,7 +91,7 @@ main(int argc, char **argv)
|
|||
u_int sectorsize, fwsectors, fwheads, zoned = 0, isreg;
|
||||
uint32_t zone_mode;
|
||||
|
||||
while ((ch = getopt(argc, argv, "cipsStvw")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "cilpsStvw")) != -1) {
|
||||
switch (ch) {
|
||||
case 'c':
|
||||
opt_c = 1;
|
||||
|
@ -98,6 +101,9 @@ main(int argc, char **argv)
|
|||
opt_i = 1;
|
||||
opt_v = 1;
|
||||
break;
|
||||
case 'l':
|
||||
opt_l = 1;
|
||||
break;
|
||||
case 'p':
|
||||
opt_p = 1;
|
||||
break;
|
||||
|
@ -169,6 +175,9 @@ main(int argc, char **argv)
|
|||
goto out;
|
||||
}
|
||||
} else {
|
||||
if (opt_l && (opt_p || opt_s)) {
|
||||
printf("%s\t", argv[i]);
|
||||
}
|
||||
if (opt_p) {
|
||||
if (ioctl(fd, DIOCGPHYSPATH, physpath) == 0) {
|
||||
printf("%s\n", physpath);
|
||||
|
|
Loading…
Reference in a new issue