remove unnecessary code and doc

This commit is contained in:
Lei Xue
2016-11-28 14:36:13 +08:00
parent 05b6f88de4
commit 82ae696822
10 changed files with 49 additions and 73 deletions

View File

@@ -62,9 +62,6 @@ You can test this with [open-iscsi](http://www.open-iscsi.com/) or [libiscsi](ht
* SCSI Command Queue (p2) * SCSI Command Queue (p2)
* More SCSI commands * More SCSI commands
* SPC3/SAM2 * SPC3/SAM2
* Page83(Inquiry) (orzhang, p1)
* Page0 (Inquiry) (orzhang, p1)
* Define Device UUID
* Verify (carmark, p1) * Verify (carmark, p1)
* Support `Target Group` and `Target Port` (p3) * Support `Target Group` and `Target Port` (p3)
* Refactor (carmark, p1) * Refactor (carmark, p1)

View File

@@ -67,18 +67,27 @@ type ISCSICommand struct {
ExpCmdSN, MaxCmdSN uint32 ExpCmdSN, MaxCmdSN uint32
AHSLen int AHSLen int
ConnID uint16 // Connection ID. // Connection ID.
CmdSN uint32 // Command serial number. ConnID uint16
ExpStatSN uint32 // Expected status serial. // Command serial number.
CmdSN uint32
// Expected status serial.
ExpStatSN uint32
Read, Write bool Read, Write bool
LUN [8]uint8 LUN [8]uint8
Transit bool // Transit bit. // Transit bit.
Cont bool // Continue bit. Transit bool
CSG, NSG Stage // Current Stage, Next Stage. // Continue bit.
ISID uint64 // Initiator part of the SSID. Cont bool
TSIH uint16 // Target-assigned Session Identifying Handle. // Current Stage, Next Stage.
StatSN uint32 // Status serial number. CSG, NSG Stage
// Initiator part of the SSID.
ISID uint64
// Target-assigned Session Identifying Handle.
TSIH uint16
// Status serial number.
StatSN uint32
// For login response. // For login response.
StatusClass uint8 StatusClass uint8

View File

@@ -70,15 +70,18 @@ type ISCSIRedirectInfo struct {
} }
type iSCSITPGT struct { type iSCSITPGT struct {
TPGT uint16 /* Mapping to SCSI Reltive Target Port ID */ // Mapping to SCSI Reltive Target Port ID
TPGT uint16
Portals map[string]struct{} Portals map[string]struct{}
} }
type ISCSITarget struct { type ISCSITarget struct {
api.SCSITarget api.SCSITarget
api.SCSITargetDriverCommon api.SCSITargetDriverCommon
TPGTs map[uint16]*iSCSITPGT /* Key is a TPGT number */ // TPGT number is the key
Sessions map[uint16]*ISCSISession /* Key is an TSIH */ TPGTs map[uint16]*iSCSITPGT
// TSIH is the key
Sessions map[uint16]*ISCSISession
SessionParam []ISCSISessionParam SessionParam []ISCSISessionParam
Alias string Alias string
MaxSessions int MaxSessions int

View File

@@ -1,25 +0,0 @@
/*
Copyright 2016 The GoStor Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package iscsit
type ISCSIPortal struct {
Address string
Port int
Tpgt int
Fd int
Af int
}

View File

@@ -192,31 +192,6 @@ func (tq *taskQueue) Pop() interface{} {
return item return item
} }
// The BHS is 48 bytes long. The Opcode and DataSegmentLength fields
// appear in all iSCSI PDUs. In addition, when used, the Initiator Task
// Tag and Logical Unit Number always appear in the same location in the
// header.
type iscsiHeader struct {
opcode uint8
flags uint8 // Final bit
rsvd2 [2]uint8
hlength uint8 // AHSs total length
dlength [3]uint8 // Data length
lun [8]uint8
itt uint8 // Initiator Task Tag
ttt uint8 // Target Task Tag
statsn uint8
expStatSN uint8
maxStatSN uint8
other [12]uint8
}
type iscsiPdu struct {
bhs iscsiHeader
ahsSize uint
dataSize uint
}
// New creates a new session. // New creates a new session.
func (s *ISCSITargetDriver) NewISCSISession(conn *iscsiConnection, isid uint64) (*ISCSISession, error) { func (s *ISCSITargetDriver) NewISCSISession(conn *iscsiConnection, isid uint64) (*ISCSISession, error) {
var ( var (

View File

@@ -153,7 +153,6 @@ const (
* device type values are reserved for this peripheral qualifier. * device type values are reserved for this peripheral qualifier.
* 100b to 111b Vendor specific * 100b to 111b Vendor specific
*/ */
const ( const (
PQ_DEVICE_CONNECTED = byte(0x00 << 5) PQ_DEVICE_CONNECTED = byte(0x00 << 5)
PQ_DEVICE_NOT_CONNECT = byte(0x01 << 5) PQ_DEVICE_NOT_CONNECT = byte(0x01 << 5)

View File

@@ -87,7 +87,7 @@ func luPerformCommand(tid int, cmd *api.SCSICommand) api.SAMStat {
fn := cmd.Device.DeviceProtocol.PerformCommand(op) fn := cmd.Device.DeviceProtocol.PerformCommand(op)
if fn != nil { if fn != nil {
fnop := fn.(SCSIDeviceOperation) fnop := fn.(SCSIDeviceOperation)
// host := cmd.ITNexus.Host // TODO host := cmd.ITNexus.Host
host := 0 host := 0
return fnop.CommandPerformFunc(host, cmd) return fnop.CommandPerformFunc(host, cmd)
} }

View File

@@ -1,3 +1,19 @@
/*
Copyright 2016 The GoStor Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package scsi package scsi
import ( import (

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2015 The GoStor Authors All rights reserved. Copyright 2016 The GoStor Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -28,9 +28,11 @@ import (
type BackendType string type BackendType string
type SCSILUMap struct { type SCSILUMap struct {
mutex sync.RWMutex mutex sync.RWMutex
AllDevices api.LUNMap /* use UUID as the key for all LUs*/ // use UUID as the key for all LUs
TargetsLUNMap map[string]api.LUNMap /* use target name as the key for target's LUN map*/ AllDevices api.LUNMap
// use target name as the key for target's LUN map
TargetsLUNMap map[string]api.LUNMap
} }
var globalSCSILUMap = SCSILUMap{AllDevices: make(api.LUNMap), TargetsLUNMap: make(map[string]api.LUNMap)} var globalSCSILUMap = SCSILUMap{AllDevices: make(api.LUNMap), TargetsLUNMap: make(map[string]api.LUNMap)}
@@ -85,7 +87,7 @@ func InitSCSILUMap(config *config.Config) error {
return errors.New("LU Number must be a number") return errors.New("LU Number must be a number")
} }
mappingLUN(deviceID, lun, tgtName) mappingLUN(deviceID, lun, tgtName)
//Init SCSISimpleReservationOperator // Init SCSISimpleReservationOperator
op := GetSCSIReservationOperator() op := GetSCSIReservationOperator()
if simpleOp, ok = op.(*SCSISimpleReservationOperator); ok { if simpleOp, ok = op.(*SCSISimpleReservationOperator); ok {
simpleOp.InitLUReservation(tgtName, deviceID) simpleOp.InitLUReservation(tgtName, deviceID)

View File

@@ -1,5 +1,5 @@
/* /*
Copyright 2015 The GoStor Authors All rights reserved. Copyright 2016 The GoStor Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.