make it compileable.

This commit is contained in:
Le Zhang
2015-12-16 00:04:55 +08:00
parent 7d34e3c64b
commit 5f197d8035
6 changed files with 40 additions and 29 deletions

View File

@@ -34,7 +34,7 @@ type BackingStore interface {
type BackingStoreFunc func() (BackingStore, error)
var registeredPlugins = map[name](BackingStoreFunc){}
var registeredPlugins = map[string](BackingStoreFunc){}
func RegisterBackingStore(name string, f BackingStoreFunc) {
registeredPlugins[name] = f

View File

@@ -17,7 +17,7 @@ limitations under the License.
// Target Driver Interface
package scsi
var SCSITargetDriverState int
type SCSITargetDriverState int
const (
// just registered
@@ -51,7 +51,9 @@ type SCSITargetDriverOps interface {
CommandNotify(nid uint64, result int, cmd *SCSICommand) error
}
var fakeSCSITargetDriver SCSITargetDriver
type fakeSCSITargetDriver struct {
SCSITargetDriver
}
func (fake *fakeSCSITargetDriver) Init() error {
return nil

View File

@@ -63,7 +63,6 @@ var (
ASC_LOGICAL_UNIT_NOT_CONFIG SCSISubError = 0x3e00
/* Key 3: Medium Errors */
ASC_WRITE_ERROR SCSISubError = 0x0c00
ASC_UNRECOVERED_READ SCSISubError = 0x1100
ASC_RECORDED_ENTITY_NOT_FOUND SCSISubError = 0x1400
ASC_UNKNOWN_FORMAT SCSISubError = 0x3001

View File

@@ -39,8 +39,8 @@ func (sbc *SBCSCSIDeviceProtocol) OfflineLu(lu *SCSILu) error {
func NewSBCDevice() (SBCSCSIDeviceProtocol, error) {
var sbc = SBCSCSIDeviceProtocol{
Type: TYPE_DISK,
SCSIDeviceOps: make([]SCSIDeviceOperation, 0xff),
BaseSCSIDeviceProtocol{Type: TYPE_DISK,
SCSIDeviceOps: make([]SCSIDeviceOperation, 256)},
}
for i := 0; i <= 256; i++ {
sbc.SCSIDeviceOps = append(sbc.SCSIDeviceOps, NewSCSIDeviceOperation(SPCIllegalOp, nil, 0))
@@ -94,6 +94,8 @@ func NewSBCDevice() (SBCSCSIDeviceProtocol, error) {
sbc.SCSIDeviceOps[WRITE_12] = NewSCSIDeviceOperation(SBCReadWrite, nil, PR_WE_FA|PR_EA_FA|PR_WE_FA|PR_WE_FN)
sbc.SCSIDeviceOps[WRITE_VERIFY_12] = NewSCSIDeviceOperation(SBCReadWrite, nil, PR_EA_FA|PR_EA_FN)
sbc.SCSIDeviceOps[VERIFY_12] = NewSCSIDeviceOperation(SBCVerify, nil, PR_EA_FA|PR_EA_FN)
return sbc, nil
}
func SBCModeSelect(host int, cmd *SCSICommand) error {

View File

@@ -30,18 +30,17 @@ package scsi
* 7 Automation/Drive Interface (ADT)
* 8 AT Attachment Interface (ATA/ATAPI-7)
*/
type ProtocolIdentifier int
var (
PIV_FCP ProtocolIdentifier = iota
PIV_SPI ProtocolIdentifier
PIV_S3P ProtocolIdentifier
PIV_SBP ProtocolIdentifier
PIV_SRP ProtocolIdentifier
PIV_ISCSI ProtocolIdentifier
PIV_SAS ProtocolIdentifier
PIV_ADT ProtocolIdentifier
PIV_ATA ProtocolIdentifier
const (
PIV_FCP = iota
PIV_SPI
PIV_S3P
PIV_SBP
PIV_SRP
PIV_ISCSI
PIV_SAS
PIV_ADT
PIV_ATA
)
/*
@@ -88,18 +87,17 @@ var (
* 7 - MD5 logical unit identifier - 7.6.3.10
* 8 - SCSI name string - 7.6.3.11
*/
type DesignatorType int
var (
DESG_VENDOR DesignatorType = iota
DESG_T10 DesignatorType
DESG_EUI64 DesignatorType
DESG_NAA DesignatorType
DESG_REL_TGT_PORT DesignatorType
DESG_TGT_PORT_GRP DesignatorType
DESG_LU_GRP DesignatorType
DESG_MD5 DesignatorType
DESG_SCSI DesignatorType
const (
DESG_VENDOR = iota
DESG_T10
DESG_EUI64
DESG_NAA
DESG_REL_TGT_PORT
DESG_TGT_PORT_GRP
DESG_LU_GRP
DESG_MD5
DESG_SCSI
)
func SPCIllegalOp(host int, cmd *SCSICommand) error {
@@ -175,4 +173,5 @@ func SPCRequestSense(host int, cmd *SCSICommand) error {
}
func SPCSendDiagnostics(host int, cmd *SCSICommand) error {
return nil
}

View File

@@ -16,13 +16,22 @@ limitations under the License.
package scsi
var SCSITargetState int
type SCSITargetState int
var (
TargetOnline SCSITargetState = 1
TargetReady SCSITargetState = 2
)
const (
PR_SPECIAL = (1 << 5)
PR_WE_FA = (1 << 4)
PR_EA_FA = (1 << 3)
PR_RR_FR = (1 << 2)
PR_WE_FN = (1 << 1)
PR_EA_FN = (1 << 0)
)
type SCSITarget struct {
Name string
TID int