aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2009-06-11 20:41:54 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2009-06-11 20:41:54 +0000
commit8432345d953594ff5f7a31de9ab1786161397e19 (patch)
tree4ef56b1f4ad2c104de6838ecb476e19534b99cfc /examples
parentafbb295c8d601488c2253ecda4a6e459c547c0fd (diff)
downloadsg3_utils-8432345d953594ff5f7a31de9ab1786161397e19.tar.gz
add sg_unmap
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@273 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'examples')
-rw-r--r--examples/sdiag_sas_p1_idle.txt3
-rwxr-xr-xexamples/sg_persist_tst.sh13
-rw-r--r--examples/sg_unmap_example.txt40
3 files changed, 51 insertions, 5 deletions
diff --git a/examples/sdiag_sas_p1_idle.txt b/examples/sdiag_sas_p1_idle.txt
index 3bd2ccca..39091ced 100644
--- a/examples/sdiag_sas_p1_idle.txt
+++ b/examples/sdiag_sas_p1_idle.txt
@@ -1,7 +1,8 @@
# This is the hex for a SAS protocol specific diagnostic
# page. It will attempt to put phy identifier 1 of the
# given device into IDLE (continuously transmit idle dwords) mode.
-# Physical transmission speed is 3 Gbps.
+# Physical transmission speed is 3 Gbps (last number on first
+# active line can be 8 for 1.5Gbps, 9 for 3Gbps and 10 for 6Gbps).
# See sdiag_sas_p1_stop.txt to turn off this test pattern.
# N.B. This will turn the receiver off on phy id 1.
#
diff --git a/examples/sg_persist_tst.sh b/examples/sg_persist_tst.sh
index f0cd4d38..52dac061 100755
--- a/examples/sg_persist_tst.sh
+++ b/examples/sg_persist_tst.sh
@@ -1,9 +1,9 @@
#!/bin/sh
# This script is meant as an example of using the sg_persist utility
# in the sg3_utils package. This script works as expected on the
-# author's Fujitsu MAM3184 and a Seagate ST373455 disk.
+# author's Fujitsu MAM3184, Seagate ST373455 and ST9146803SS disks.
#
-# Version 1.5 20070314
+# Version 1.6 20090608
# N.B. make sure the device name is correct for your environment.
@@ -40,7 +40,7 @@ echo ""
sleep 1
echo ">>> check if any keys are registered:"
-sg_persist -k $1
+sg_persist --no-inquiry --read-keys $1
sleep 1
echo
@@ -50,7 +50,7 @@ sleep 1
echo
echo ">>> now key 123abc should be registered:"
-sg_persist -n -k $1
+sg_persist -n --read-keys $1
sleep 1
echo
@@ -64,6 +64,11 @@ sg_persist -n --read-reservation $1
sleep 1
echo
+echo ">>> try to 'read full status' (may not be supported):"
+sg_persist -n --read-full-status $1
+sleep 1
+
+echo
echo ">>> now release reservation:"
sg_persist -n --out --release --param-rk=123abc --prout-type=1 $1
sleep 1
diff --git a/examples/sg_unmap_example.txt b/examples/sg_unmap_example.txt
new file mode 100644
index 00000000..34b7e66f
--- /dev/null
+++ b/examples/sg_unmap_example.txt
@@ -0,0 +1,40 @@
+# sg_unmap_example.txt
+# This is an example of the contents of a file that can be given to sg_unmap
+# For example, assume the /dev/sdc is a scratch disk (e.g. one made by the
+# scsi_debug kernel module) then:
+# sg_unmap --in=sg_map_example.txt /dev/sdc
+
+0x12345678,1 # unmap LBA 0x12345678
+0x12345678 2 # unmap LBA 0x12345678 and 0x12345679
+0x12345678 3333 # unmap 3333 blocks starting at LBA 0x12345678
+
+0X5a5a5a5a5a 0 # unmaps 0 blocks (i.e. does nothing)
+
+ a5a5a5h
+7 # unmap 7 blocks starting at LBA 0xa5a5a5
+
+# Note that there can be leading and trailing whitespace and whitespace
+# (plus comma) can be a separator.
+#
+# Example invocation:
+# $ sg_unmap --in=../examples/sg_unmap_example.txt -vv /dev/sdc
+# open /dev/sg2 with flags=0x802
+# unmap cdb: 42 00 00 00 00 00 00 00 58 00
+# unmap parameter list:
+# 00 56 00 50 00 00 00 00 00 00 00 00 12 34 56 78
+# 00 00 00 01 00 00 00 00 00 00 00 00 12 34 56 78
+# 00 00 00 02 00 00 00 00 00 00 00 00 12 34 56 78
+# 00 00 0d 05 00 00 00 00 00 00 00 5a 5a 5a 5a 5a
+# 00 00 00 00 00 00 00 00 00 00 00 00 00 a5 a5 a5
+# 00 00 00 07 00 00 00 00
+# sg_cmds_process_resp: slen=18
+# unmap: Fixed format, current; Sense key: Illegal Request
+# Additional sense: Invalid command operation code
+# Raw sense data (in hex):
+# 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00
+# 00 00
+# UNMAP not supported
+#
+# --------------------------------------------------------
+# Notice the 8 byte header then 5 descriptors in the parameter
+# list