mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
Add "report only" functionality to 'camcontrol format', so users can get a
report on the status of a format already running on a drive. Fix status reporting for 'camcontrol format'. This was broken in rev 1.34 of camcontrol.c, almost 4 years ago! Submitted by: joerg (most of the reportonly changes) MFC after: 3 days
This commit is contained in:
parent
6e34b4796d
commit
e9e4d3e4d4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144134
@ -1,5 +1,5 @@
|
||||
.\"
|
||||
.\" Copyright (c) 1998, 1999, 2000, 2002 Kenneth D. Merry.
|
||||
.\" Copyright (c) 1998, 1999, 2000, 2002, 2005 Kenneth D. Merry.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
@ -138,6 +138,7 @@
|
||||
.Op device id
|
||||
.Op generic args
|
||||
.Op Fl q
|
||||
.Op Fl r
|
||||
.Op Fl w
|
||||
.Op Fl y
|
||||
.Nm
|
||||
@ -675,6 +676,11 @@ the questions, however.
|
||||
To disable questions, use the
|
||||
.Fl y
|
||||
argument, below.
|
||||
.It Fl r
|
||||
Run in
|
||||
.Dq report only
|
||||
mode.
|
||||
This will report status on a format that is already running on the drive.
|
||||
.It Fl w
|
||||
Issue a non-immediate format command.
|
||||
By default,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002 Kenneth D. Merry
|
||||
* Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2005 Kenneth D. Merry
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -144,7 +144,7 @@ struct camcontrol_opts option_table[] = {
|
||||
{"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
|
||||
{"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
|
||||
{"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "IPTSXc"},
|
||||
{"format", CAM_CMD_FORMAT, CAM_ARG_NONE, "qwy"},
|
||||
{"format", CAM_CMD_FORMAT, CAM_ARG_NONE, "qrwy"},
|
||||
#endif /* MINIMALISTIC */
|
||||
{"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL},
|
||||
{"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL},
|
||||
@ -2857,6 +2857,7 @@ scsiformat(struct cam_device *device, int argc, char **argv,
|
||||
u_int32_t dxfer_len = 0;
|
||||
u_int8_t byte2 = 0;
|
||||
int num_warnings = 0;
|
||||
int reportonly = 0;
|
||||
|
||||
ccb = cam_getccb(device);
|
||||
|
||||
@ -2873,6 +2874,9 @@ scsiformat(struct cam_device *device, int argc, char **argv,
|
||||
case 'q':
|
||||
quiet++;
|
||||
break;
|
||||
case 'r':
|
||||
reportonly = 1;
|
||||
break;
|
||||
case 'w':
|
||||
immediate = 0;
|
||||
break;
|
||||
@ -2882,6 +2886,9 @@ scsiformat(struct cam_device *device, int argc, char **argv,
|
||||
}
|
||||
}
|
||||
|
||||
if (reportonly)
|
||||
goto doreport;
|
||||
|
||||
if (quiet == 0) {
|
||||
fprintf(stdout, "You are about to REMOVE ALL DATA from the "
|
||||
"following device:\n");
|
||||
@ -3024,6 +3031,7 @@ scsiformat(struct cam_device *device, int argc, char **argv,
|
||||
goto scsiformat_bailout;
|
||||
}
|
||||
|
||||
doreport:
|
||||
do {
|
||||
cam_status status;
|
||||
|
||||
@ -3065,7 +3073,7 @@ scsiformat(struct cam_device *device, int argc, char **argv,
|
||||
|
||||
if ((status != CAM_REQ_CMP)
|
||||
&& (status == CAM_SCSI_STATUS_ERROR)
|
||||
&& ((status & CAM_AUTOSNS_VALID) != 0)) {
|
||||
&& ((ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0)) {
|
||||
struct scsi_sense_data *sense;
|
||||
int error_code, sense_key, asc, ascq;
|
||||
|
||||
@ -3176,7 +3184,7 @@ usage(int verbose)
|
||||
" [-D <enable|disable>][-O offset][-q]\n"
|
||||
" [-R syncrate][-v][-T <enable|disable>]\n"
|
||||
" [-U][-W bus_width]\n"
|
||||
" camcontrol format [dev_id][generic args][-q][-w][-y]\n"
|
||||
" camcontrol format [dev_id][generic args][-q][-r][-w][-y]\n"
|
||||
#endif /* MINIMALISTIC */
|
||||
" camcontrol help\n");
|
||||
if (!verbose)
|
||||
@ -3254,6 +3262,7 @@ usage(int verbose)
|
||||
"-v also print a Path Inquiry CCB for the controller\n"
|
||||
"format arguments:\n"
|
||||
"-q be quiet, don't print status messages\n"
|
||||
"-r run in report only mode\n"
|
||||
"-w don't send immediate format command\n"
|
||||
"-y don't ask any questions\n");
|
||||
#endif /* MINIMALISTIC */
|
||||
|
Loading…
Reference in New Issue
Block a user