goscsi

package module
v0.0.0-...-cf7be94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2026 License: GPL-2.0, GPL-2.0-or-later Imports: 6 Imported by: 0

README

package goscsi provides a device command interface and the scsi-id example program.

To regenerate CGO definitions of system headers,

$ go generate ./godefs

© 2022 Platina Systems, Inc. All rights reserved. Use of this source code is governed by this BSD-style LICENSE.

Documentation

Overview

package goscsi provides a device command interface.

Index

Constants

View Source
const (
	Page00  = 0x00
	Page80  = 0x80
	Page83  = 0x83
	DataLen = 0xfc
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dev

type Dev struct{ EmbeddedDev }

func Open

func Open(fn string) (Dev, error)

func (Dev) IDs

func (dev Dev) IDs() (dscs []IdDsc, err error)

IDs() returns the identification descriptors from the page 0x83 EVPD inquiry response.

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

	Table 459 Device Identification VPD page
	┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
	┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
	┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
	┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
	┃ 0   │ PERIPHERAL QUALIFIER     │ PERIPHERAL DEVICE TYPE                     ┃
	┠─────┼──────────────────────────┴────────────────────────────────────────────┨
	┃ 1   │ PAGE CODE (83h)                                                       ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
        ┃ 2   │ (MSB)                                                                 ┃
        ┠─────┤          PAGE LENGTH (n-3)                                            ┃
	┃ 3   │                                                                 (LSB) ┃
	┠─────┴───────────────────────────────────────────────────────────────────────┨
	┃ Identification descriptor list ...                                          ┃
	┠─────┬───────────────────────────────────────────────────────────────────────┨
	┃ 4   │ First Identification Descriptor (see table 460)                       ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
	┃ n   │ Last Identification Descriptor                                        ┃
	┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

func (Dev) Inquiry

func (dev Dev) Inquiry(vpd vpd.Request, pagecode byte, data []byte) error

func (Dev) SerialNumber

func (dev Dev) SerialNumber() (sn String, err error)

SerialNumber() returns the `Product Serial Number` field from the page 0x80 EVPD inquiry response.

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

	Table 484 Unit Serial Number page (80h)
	┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
	┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
	┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
	┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
	┃ 0   │ PERIPHERAL QUALIFIER     │ PERIPHERAL DEVICE TYPE                     ┃
	┠─────┼──────────────────────────┴────────────────────────────────────────────┨
	┃ 1   │ PAGE CODE (80h)                                                       ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
	┃ 2   │ Reserved                                                              ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
	┃ 3   │ PAGE LENGTH                                                           ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
        ┃ 4   │                                                                       ┃
        ┠─────┤                                                                       ┃
        ┃ ... │ Product Serial Number                                                 ┃
        ┠─────┤                                                                       ┃
	┃ n   │                                                                       ┃
	┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

func (Dev) StandardInquiry

func (dev Dev) StandardInquiry() (std StdInqData, err error)

func (Dev) VPDs

func (dev Dev) VPDs() (l []byte, err error)

VPDs() returns the `SUPPORTED PAGE LIST` from the page 0x00 EVPD inquiry response.

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

Table 483 Supported Vital Product Data pages
┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
┃ 0   │ PERIPHERAL QUALIFIER     │ PERIPHERAL DEVICE TYPE                     ┃
┠─────┼──────────────────────────┴────────────────────────────────────────────┨
┃ 1   │ PAGE CODE (00h)                                                       ┃
┠─────┼───────────────────────────────────────────────────────────────────────┨
┃ 2   │ Reserved                                                              ┃
┠─────┼───────────────────────────────────────────────────────────────────────┨
┃ 3   │ PAGE LENGTH (n-3)                                                     ┃
┠─────┼───────────────────────────────────────────────────────────────────────┨
┃ 4   │                                                                       ┃
┠─────┤                                                                       ┃
┃ ... │ SUPPORTED PAGE LIST                                                   ┃
┠─────┤                                                                       ┃
┃ n   │                                                                       ┃
┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

type EmbeddedDev

type EmbeddedDev interface {
	Close() error
	Request(cdb, fromdev, todev []byte) error
	RequestWithTimeout(cdb, fromdev, todev []byte, timeout time.Duration) error
}

type IdDsc

type IdDsc []byte

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

	Table 460 Identification Descriptor
	┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
	┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
	┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
	┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
	┃ 0   │ PROTOCOL IDENTIFER                │ CODE SET                          ┃
	┠─────┼────────┬────────┬─────────────────┼───────────────────────────────────┨
	┃ 1   │ PIV    │Reserved│ ASSOCIATION     │ IDENTIFIER TYPE                   ┃
	┠─────┼────────┴────────┴─────────────────┴───────────────────────────────────┨
	┃ 2   │ Reserved                                                              ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
	┃ 3   │ IDENTIFIER LENGTH (n-3)                                               ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
        ┃ 4   │                                                                       ┃
        ┠─────┤                                                                       ┃
        ┃ ... │ IDENTIFIER                                                            ┃
        ┠─────┤                                                                       ┃
	┃ n   │                                                                       ┃
	┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

func (IdDsc) Ascii

func (dsc IdDsc) Ascii() bool

func (IdDsc) Association

func (dsc IdDsc) Association() uint8

func (IdDsc) ID

func (dsc IdDsc) ID() []byte

func (IdDsc) Len

func (dsc IdDsc) Len()