make it compileable.
This commit is contained in:
@@ -34,7 +34,7 @@ type BackingStore interface {
|
|||||||
|
|
||||||
type BackingStoreFunc func() (BackingStore, error)
|
type BackingStoreFunc func() (BackingStore, error)
|
||||||
|
|
||||||
var registeredPlugins = map[name](BackingStoreFunc){}
|
var registeredPlugins = map[string](BackingStoreFunc){}
|
||||||
|
|
||||||
func RegisterBackingStore(name string, f BackingStoreFunc) {
|
func RegisterBackingStore(name string, f BackingStoreFunc) {
|
||||||
registeredPlugins[name] = f
|
registeredPlugins[name] = f
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ limitations under the License.
|
|||||||
// Target Driver Interface
|
// Target Driver Interface
|
||||||
package scsi
|
package scsi
|
||||||
|
|
||||||
var SCSITargetDriverState int
|
type SCSITargetDriverState int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// just registered
|
// just registered
|
||||||
@@ -51,7 +51,9 @@ type SCSITargetDriverOps interface {
|
|||||||
CommandNotify(nid uint64, result int, cmd *SCSICommand) error
|
CommandNotify(nid uint64, result int, cmd *SCSICommand) error
|
||||||
}
|
}
|
||||||
|
|
||||||
var fakeSCSITargetDriver SCSITargetDriver
|
type fakeSCSITargetDriver struct {
|
||||||
|
SCSITargetDriver
|
||||||
|
}
|
||||||
|
|
||||||
func (fake *fakeSCSITargetDriver) Init() error {
|
func (fake *fakeSCSITargetDriver) Init() error {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ var (
|
|||||||
ASC_LOGICAL_UNIT_NOT_CONFIG SCSISubError = 0x3e00
|
ASC_LOGICAL_UNIT_NOT_CONFIG SCSISubError = 0x3e00
|
||||||
|
|
||||||
/* Key 3: Medium Errors */
|
/* Key 3: Medium Errors */
|
||||||
ASC_WRITE_ERROR SCSISubError = 0x0c00
|
|
||||||
ASC_UNRECOVERED_READ SCSISubError = 0x1100
|
ASC_UNRECOVERED_READ SCSISubError = 0x1100
|
||||||
ASC_RECORDED_ENTITY_NOT_FOUND SCSISubError = 0x1400
|
ASC_RECORDED_ENTITY_NOT_FOUND SCSISubError = 0x1400
|
||||||
ASC_UNKNOWN_FORMAT SCSISubError = 0x3001
|
ASC_UNKNOWN_FORMAT SCSISubError = 0x3001
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ func (sbc *SBCSCSIDeviceProtocol) OfflineLu(lu *SCSILu) error {
|
|||||||
|
|
||||||
func NewSBCDevice() (SBCSCSIDeviceProtocol, error) {
|
func NewSBCDevice() (SBCSCSIDeviceProtocol, error) {
|
||||||
var sbc = SBCSCSIDeviceProtocol{
|
var sbc = SBCSCSIDeviceProtocol{
|
||||||
Type: TYPE_DISK,
|
BaseSCSIDeviceProtocol{Type: TYPE_DISK,
|
||||||
SCSIDeviceOps: make([]SCSIDeviceOperation, 0xff),
|
SCSIDeviceOps: make([]SCSIDeviceOperation, 256)},
|
||||||
}
|
}
|
||||||
for i := 0; i <= 256; i++ {
|
for i := 0; i <= 256; i++ {
|
||||||
sbc.SCSIDeviceOps = append(sbc.SCSIDeviceOps, NewSCSIDeviceOperation(SPCIllegalOp, nil, 0))
|
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_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[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)
|
sbc.SCSIDeviceOps[VERIFY_12] = NewSCSIDeviceOperation(SBCVerify, nil, PR_EA_FA|PR_EA_FN)
|
||||||
|
|
||||||
|
return sbc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func SBCModeSelect(host int, cmd *SCSICommand) error {
|
func SBCModeSelect(host int, cmd *SCSICommand) error {
|
||||||
|
|||||||
@@ -30,18 +30,17 @@ package scsi
|
|||||||
* 7 Automation/Drive Interface (ADT)
|
* 7 Automation/Drive Interface (ADT)
|
||||||
* 8 AT Attachment Interface (ATA/ATAPI-7)
|
* 8 AT Attachment Interface (ATA/ATAPI-7)
|
||||||
*/
|
*/
|
||||||
type ProtocolIdentifier int
|
|
||||||
|
|
||||||
var (
|
const (
|
||||||
PIV_FCP ProtocolIdentifier = iota
|
PIV_FCP = iota
|
||||||
PIV_SPI ProtocolIdentifier
|
PIV_SPI
|
||||||
PIV_S3P ProtocolIdentifier
|
PIV_S3P
|
||||||
PIV_SBP ProtocolIdentifier
|
PIV_SBP
|
||||||
PIV_SRP ProtocolIdentifier
|
PIV_SRP
|
||||||
PIV_ISCSI ProtocolIdentifier
|
PIV_ISCSI
|
||||||
PIV_SAS ProtocolIdentifier
|
PIV_SAS
|
||||||
PIV_ADT ProtocolIdentifier
|
PIV_ADT
|
||||||
PIV_ATA ProtocolIdentifier
|
PIV_ATA
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -88,18 +87,17 @@ var (
|
|||||||
* 7 - MD5 logical unit identifier - 7.6.3.10
|
* 7 - MD5 logical unit identifier - 7.6.3.10
|
||||||
* 8 - SCSI name string - 7.6.3.11
|
* 8 - SCSI name string - 7.6.3.11
|
||||||
*/
|
*/
|
||||||
type DesignatorType int
|
|
||||||
|
|
||||||
var (
|
const (
|
||||||
DESG_VENDOR DesignatorType = iota
|
DESG_VENDOR = iota
|
||||||
DESG_T10 DesignatorType
|
DESG_T10
|
||||||
DESG_EUI64 DesignatorType
|
DESG_EUI64
|
||||||
DESG_NAA DesignatorType
|
DESG_NAA
|
||||||
DESG_REL_TGT_PORT DesignatorType
|
DESG_REL_TGT_PORT
|
||||||
DESG_TGT_PORT_GRP DesignatorType
|
DESG_TGT_PORT_GRP
|
||||||
DESG_LU_GRP DesignatorType
|
DESG_LU_GRP
|
||||||
DESG_MD5 DesignatorType
|
DESG_MD5
|
||||||
DESG_SCSI DesignatorType
|
DESG_SCSI
|
||||||
)
|
)
|
||||||
|
|
||||||
func SPCIllegalOp(host int, cmd *SCSICommand) error {
|
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 {
|
func SPCSendDiagnostics(host int, cmd *SCSICommand) error {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,22 @@ limitations under the License.
|
|||||||
|
|
||||||
package scsi
|
package scsi
|
||||||
|
|
||||||
var SCSITargetState int
|
type SCSITargetState int
|
||||||
|
|
||||||
var (
|
var (
|
||||||
TargetOnline SCSITargetState = 1
|
TargetOnline SCSITargetState = 1
|
||||||
TargetReady SCSITargetState = 2
|
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 {
|
type SCSITarget struct {
|
||||||
Name string
|
Name string
|
||||||
TID int
|
TID int
|
||||||
|
|||||||
Reference in New Issue
Block a user