FreeBSD/usr.sbin/mlxcontrol/command.c
/********************************************************************************
 * Initiate a consistency check on a system drive.
 *
 * check [<drive>]
 *	Start a check of <drive>
 *
 */
Initiate a consistency check on a system drive.
check []
Start a check of 
Initiate a consistency check on a system drive . check [] Start a check of
static int
cmd_check(int argc, char *argv[])
{
    int		unit, fd, result;
    if (argc != 2)
	return(cmd_help(argc, argv));
    if ((unit = driveunit(argv[1])) == -1) {
	warnx("'%s' is not a valid drive", argv[1]);
    } else {
	if ((fd = open(drivepath(unit), 0)) < 0) {
	    warn("can't open %s", drivepath(unit));
	} else {
	    if ((ioctl(fd, MLXD_CHECKASYNC, &result)) < 0) {
		switch(result) {
		case 0x0002:
		    warnx("one or more of the SCSI disks on which the drive '%s' depends is DEAD", argv[1]);
		    break;
		case 0x0105:
		    warnx("drive %s is invalid, or not a drive which can be checked", argv[1]);
		    break;
		case 0x0106:
		    warnx("drive rebuild or consistency check is already in progress on this controller");
		    break;
		default:
		    warn("ioctl MLXD_CHECKASYNC");
		}
	    }
	}
    }
    return(0);
}
static int cmd_check ( int argc , char * argv [ ] ) { int unit , fd , result ; if ( argc != 2 ) return ( cmd_help ( argc , argv ) ) ; if ( ( unit = driveunit ( argv [ 1 ] ) ) == -1 ) { warnx ( " " , argv [ 1 ] ) ; } else { if ( ( fd = open ( drivepath ( unit ) , 0 ) ) < 0 ) { warn ( " " , drivepath ( unit ) ) ; } else { if ( ( ioctl ( fd , MLXD_CHECKASYNC , & result ) ) < 0 ) { switch ( result ) { case 0x0002 : warnx ( " " , argv [ 1 ] ) ; break ; case 0x0105 : warnx ( " " , argv [ 1 ] ) ; break ; case 0x0106 : warnx ( " " ) ; break ; default : warn ( " " ) ; } } } } return ( 0 ) ; }
Initiate a consistency check on a system drive.
Initiate a consistency check on a system drive .
/* Get the device */ /* Try to start the check */