ata.go
func ataIdentify(r *ATAArg, rs io.ReadSeeker) (*ATAArg, error) {
	// Only ATA device identify allowed here
	if r.CmdStatus != ATACmdStatusIdentify {
		return nil, errATAAbort
	}

	// Request must be for 1 sector (512 bytes)
	if r.SectorCount != 1 {
		return nil, errATAAbort
	}

	// If rs is an Identifier, request its identity directly
	ident, ok := rs.(Identifier)
	if !ok {
		// Currently no generic Identify implementation, as is done in
		// vblade.
		// TODO(mdlayher): add generic Identify implementation
		return nil, ErrNotImplemented
	}

	// Retrieve device identity information
	id, err := ident.Identify()
	if err != nil {
		return nil, err
	}

	return &ATAArg{
		CmdStatus: ATACmdStatusReadyStatus,
		Data:      id[:],
	}, nil
}
func ataIdentify(r *ATAArg, rs io.ReadSeeker) (*ATAArg, error) {
	// Only ATA device identify allowed here
	if r.CmdStatus != ATACmdStatusIdentify {
		return nil, errATAAbort
	}

	// Request must be for 1 sector (512 bytes)
	if r.SectorCount != 1 {
		return nil, errATAAbort
	}

	// If rs is an Identifier, request its identity directly
	ident, ok := rs.(Identifier)
	if !ok {
		// Currently no generic Identify implementation, as is done in
		// vblade.
		// TODO(mdlayher): add generic Identify implementation
		return nil, ErrNotImplemented
	}

	// Retrieve device identity information
	id, err := ident.Identify()
	if err != nil {
		return nil, err
	}

	return &ATAArg{
		CmdStatus: ATACmdStatusReadyStatus,
		Data:      id[:],
	}, nil
}
func ataIdentify ( r * ATAArg , rs io . ReadSeeker ) ( * ATAArg , error ) { // Only ATA device identify allowed here if r . CmdStatus != ATACmdStatusIdentify { return nil , errATAAbort } // Request must be for 1 sector (512 bytes) if r . SectorCount != 1 { return nil , errATAAbort } // If rs is an Identifier, request its identity directly ident , ok := rs . ( Identifier ) if ! ok { // Currently no generic Identify implementation, as is done in // vblade. // TODO(mdlayher): add generic Identify implementation return nil , ErrNotImplemented } // Retrieve device identity information id , err := ident . Identify ( ) if err != nil { return nil , err } return & ATAArg { CmdStatus : ATACmdStatusReadyStatus , Data : id [ : ] , } , nil }
// ataIdentify performs an ATA identify request on rs using the argument
// values in r.
ataIdentify performs an ATA identify request on rs using the argument values in r .