SCSI source code

某種程度在沒有任何工具時,可以透過 scsi 檔案來判斷硬體是否壞掉

cat /proc/scsi/sg/device_hdr
cat /proc/scsi/sg/devices
cat /proc/scsi/sg/device_strs

cat /proc/scsi/scsi

sg source code

在看 sg 檔案時會有一個問題是,顯示的結果都是數字.
目前網路上有部分的人有把 mapping 給寫出來,但是大部分都不太清楚.
所以想要從 linux source code 的 define 找看看原本數字的定義
從這邊可以看出來 sg 的資料結構,然後回推回去原本 scsi define 的意思
https://elixir.bootlin.com/linux/latest/source/drivers/scsi/sg.c

reference

  1. http://www.tldp.org/HOWTO/SCSI-Generic-HOWTO/sg_io_hdr_t.html
  2. https://www.kernel.org/doc/html/latest/driver-api/scsi.html#c.scsi_device_type
  3. https://www.tldp.org/HOWTO/SCSI-Generic-HOWTO/proc.html