1
0

scuzz 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. .TH SCUZZ 8
  2. .SH NAME
  3. scuzz \- SCSI target control
  4. .SH SYNOPSIS
  5. .B scuzz
  6. [
  7. .B -6eq
  8. ] [
  9. .B -m
  10. .I max-xfer
  11. ] [
  12. [
  13. .B -r
  14. ]
  15. .I sddev
  16. ]
  17. .SH DESCRIPTION
  18. .I Scuzz
  19. is an interactive program for exercising
  20. raw SCSI devices.
  21. Its intended purpose is to investigate and manipulate
  22. odd devices without the effort of writing a special driver,
  23. such as shuffling the media around on an optical jukebox.
  24. It reads commands from standard input and applies them to a SCSI target
  25. (other devices accessed through the
  26. .IR sd (3)
  27. interface,
  28. such as ATA(PI) devices,
  29. may also work).
  30. If
  31. .I sddev
  32. is given on the command line, an
  33. .B open
  34. (see below)
  35. is immediately applied to the target.
  36. On successful completion of a command,
  37. .BI ok " n
  38. is printed, where
  39. .I n
  40. is the number of bytes transferred to/from the target;
  41. the
  42. .B -q
  43. command line option suppresses the
  44. .B ok
  45. message.
  46. .LP
  47. The
  48. .B -6
  49. forces the use of 6-byte SCSI commands rather than 10-byte ones.
  50. Some older devices require this, though
  51. .I scuzz
  52. attempts to adapt automatically.
  53. The
  54. .B -e
  55. makes
  56. .I scuzz
  57. more willing to retry I/O errors but less tolerant of other errors
  58. and implies
  59. .BR -6 .
  60. This option is often needed to read Exabyte 8mm tapes.
  61. The
  62. .B -m
  63. option sets the maximum I/O transfer size to
  64. .IR max-xfer .
  65. Exabyte drives often require this to be 1024 or the exact tape block size
  66. and some 4mm drives require this to be the exact tape block size or larger.
  67. .SS Commands
  68. .TF "inquiry"
  69. .PD
  70. .TP
  71. .BI help " command
  72. .B Help
  73. is rudimentary and prints a one line synopsis for the named
  74. .IR command ,
  75. or for all commands if no argument is given.
  76. .TP
  77. .B probe
  78. .B Probe
  79. attempts an
  80. .B inquiry
  81. command on all SCSI units,
  82. and prints the result preceded by the name of those
  83. targets which respond.
  84. .LP
  85. The
  86. .B help
  87. and
  88. .B probe
  89. commands may be given at any time.
  90. .TF "inquiry"
  91. .PD
  92. .TP
  93. .BI open\ [ -r ] sddev
  94. .B Open
  95. must be given before any of the remaining commands will be accepted.
  96. Internally,
  97. unless the
  98. .B -r
  99. option is given,
  100. .B open
  101. issues
  102. .B ready
  103. then
  104. .BR inquiry ,
  105. followed by a device class-specific command to determine the
  106. logical block size of the target.
  107. .I Sddev
  108. is an
  109. .IR sd (3)
  110. device directory like
  111. .IR /dev/sdC0 .
  112. .TP
  113. .B close
  114. .B Close
  115. need only be given if another target is to be opened in the current
  116. session.
  117. .LP
  118. The remaining commands are in rough groups,
  119. intended for specific classes of device.
  120. With the exception of the
  121. .BR read ,
  122. .BR write ,
  123. and
  124. .B space
  125. commands,
  126. all arguments are in the style of ANSI-C integer constants.
  127. .TF "inquiry"
  128. .PD
  129. .TP
  130. .B ready
  131. Test Unit Ready
  132. checks if the unit is powered up and ready to do
  133. .B read
  134. and
  135. .B write
  136. commands.
  137. .TP
  138. .B rezero
  139. Rezero
  140. Unit requests that a disk be brought to a known state,
  141. usually by seeking to track zero.
  142. .TP
  143. .B rewind
  144. .B Rewind
  145. positions a tape at the beginning of current partition
  146. (there is usually only one partition, the beginning of tape).
  147. .TP
  148. .B reqsense
  149. Request Sense retrieves Sense Data concerning an error or
  150. other condition and is usually issued following the completion of a command
  151. that had check-condition status.
  152. .I Scuzz
  153. automatically issues a
  154. .B reqsense
  155. in response to a check-condition status and prints the result.
  156. .TP
  157. .B format
  158. Format
  159. Unit performs a ``low level'' format of a disk.
  160. .TP
  161. .B rblimits
  162. Read Block Limits
  163. reports the possible block lengths for the logical unit. Tapes only.
  164. .TP
  165. .BI read " file nbytes
  166. .B Read
  167. transfers data from the target to the host.
  168. A missing
  169. .I nbytes
  170. causes the entire device to be read.
  171. .TP
  172. .BI write " file nbytes
  173. .B Write
  174. transfers data from the host to the target.
  175. A missing
  176. .I nbytes
  177. causes the entire input file to be transferred.
  178. .IP
  179. The first argument to the
  180. .BR read
  181. and
  182. .BR write
  183. commands specifies a source
  184. .RB ( write )
  185. or destination
  186. .RB ( read )
  187. for the I/O.
  188. The argument is either a plain file name or
  189. .B |
  190. followed by a command to be executed by
  191. .IR rc (1).
  192. The argument may be quoted in the style of
  193. .IR rc (1).
  194. .TP
  195. .BI seek " offset whence
  196. .B Seek
  197. requests the target to seek to a position on a disk,
  198. arguments being in the style of
  199. .IR seek (2);
  200. .I whence
  201. is 0 by default.
  202. .IP
  203. .I Scuzz
  204. maintains an internal notion of where the current target
  205. is positioned.
  206. The
  207. .BR seek ,
  208. .BR read ,
  209. .BR write ,
  210. .BR rewind ,
  211. .BR rezero ,
  212. and
  213. .B wtrack
  214. commands all manipulate the internal offset.
  215. .TP
  216. .BI filemark " howmany
  217. Write Filemarks
  218. writes one (default) or more filemarks on a tape.
  219. .TP
  220. .BI space\ [ -b ]\ [ -f ]\ [[ "--\fP]\fIhowmany\fP]"
  221. .B Space
  222. positions a tape forwards or backwards.
  223. The arguments
  224. specify logical block
  225. .RB ( -b )
  226. or
  227. filemark
  228. .RB ( -f )
  229. spacing;
  230. default is
  231. .BR -b .
  232. If
  233. .I howmany
  234. is negative
  235. it specifies spacing backwards,
  236. and should be preceded by
  237. .B --
  238. to turn off any further
  239. option processing.
  240. Default is 1.
  241. .TP
  242. .B inquiry
  243. .B Inquiry
  244. is issued to determine the device type of a particular target,
  245. and to determine some basic information about the implemented options and
  246. the product name.
  247. .TP
  248. .BI modeselect bytes...
  249. .TP
  250. .BI modeselect6 bytes...
  251. Mode
  252. Select
  253. is issued to set variable parameters in the target.
  254. .I Bytes
  255. given as arguments comprise all the data for the target;
  256. see an appropriate manual for the format.
  257. The default is the 10-byte form of the command;
  258. modeselect6 is the 6-byte version.
  259. .TP
  260. .BI modesense\ [ page [ nbytes ]]
  261. .TP
  262. .BI modesense6\ [ page [ nbytes ]]
  263. Mode
  264. Sense
  265. reports variable and fixed parameters from the target.
  266. If no
  267. .I page
  268. is given,
  269. all pages are returned.
  270. .I Nbytes
  271. specifies how many bytes should be returned.
  272. The default is the 10-byte form of the command;
  273. modesense6 is the 6-byte version.
  274. .TP
  275. .BI start\ [ code ]
  276. .TP
  277. .BI stop\ [ code ]
  278. .TP
  279. .BI eject\ [ code ]
  280. .TP
  281. .BI ingest\ [ code ]
  282. .BR Start ,
  283. .BR stop ,
  284. .BR eject ,
  285. and
  286. .B ingest
  287. are synonyms for Start/Stop Unit with different default values of
  288. .IR code .
  289. Start/Stop Unit is typically used to spin up and spin down a rotating
  290. disk drive.
  291. .I Code
  292. is 0 to stop,
  293. 1 to start and
  294. 3 to eject (if the device supports ejection of the medium).
  295. .TP
  296. .B capacity
  297. Read Capacity reports the number of blocks and the block
  298. size of a disk.
  299. .LP
  300. The following commands are specific to CD and CD-R/RW devices.
  301. A brief description of each is given; see the SCSI-3
  302. Multimedia Commands (MMC) Specification for details of arguments
  303. and interpretation of the results.
  304. .TF "inquiry"
  305. .PD
  306. .TP
  307. .BI blank\ [ track/LBA [ type ]]
  308. Erase a CD-RW disk.
  309. Type identifies the method and coverage of the blanking.
  310. .TP
  311. .BI rtoc\ [ track/session-number [ ses ]]
  312. The Read TOC/PMA command transfers data from one of the tables of contents
  313. (TOC or PMA) on the CD medium.
  314. .TP
  315. .B rdiscinfo
  316. (Note the spelling.)
  317. Provides information about disks, including incomplete CD-R/RW.
  318. .TP
  319. .BI rtrackinfo\ [ track ]
  320. Provides information about a track, regardless of its status.
  321. .TP
  322. .B cdpause
  323. .TP
  324. .B cdresume
  325. Pause/resume playback.
  326. .TP
  327. .B cdstop
  328. Stop playback.
  329. .TP
  330. .BI cdplay\ [ track-number ]\ or\ [ -r [ "LBA\fP[\fIlength\fP]]]"
  331. Play audio.
  332. With no arguments, starts at the beginning of the medium.
  333. If a track number is given, the table of contents is read
  334. to find the playback start point.
  335. If the
  336. .B -r
  337. option is given, block addressing is used to find the
  338. playback start point.
  339. .TP
  340. .BI cdload\ [ slot ]
  341. .TP
  342. .BI cdunload\ [ slot ]
  343. Load/unload a disk from a changer.
  344. .TP
  345. .B cdstatus
  346. Read the mechanism status.
  347. .LP
  348. The following commands are specific to Media Changer devices.
  349. A brief description of each is given; see the SCSI-3
  350. Medium Changer Commands (SMC) Specification for details of arguments.
  351. .TF "inquiry"
  352. .PD
  353. .TP
  354. .B einit
  355. Initialize element status.
  356. .TP
  357. .BI "estatus " "type " [ length ]
  358. Report the status of the internal elements.
  359. Type 0 reports all element types.
  360. .TP
  361. .BI "mmove " transport\ source\ destination [ invert ]
  362. Move medium.
  363. .SH FILES
  364. .TF /dev/sdXX/raw
  365. .TP
  366. .B /dev/\fIsdXX\fP/raw
  367. raw SCSI interface for command, I/O, and status.
  368. .SH SOURCE
  369. .B /sys/src/cmd/scuzz
  370. .SH "SEE ALSO"
  371. .IR sd (3)
  372. .br
  373. .IR "Small Computer System Interface - 2 (X3T9.2/86-109)" ,
  374. Global Engineering Documents
  375. .br
  376. .IR "SCSI Bench Reference" ,
  377. ENDL Publications
  378. .br
  379. .IR "SCSI-3 Multimedia Commands (MMC) Specification" ,
  380. www.t10.org
  381. .br
  382. .IR "SCSI-3 Medium Changer Commands (SMC) Specification" ,
  383. www.t10.org
  384. .SH BUGS
  385. Only a limited subset of SCSI commands has been implemented (as needed).
  386. .LP
  387. Only one target can be open at a time.
  388. .LP
  389. LUNs other than 0 are not supported.
  390. .LP
  391. No way to force 10-byte commands, though they are the default.
  392. .LP
  393. Should be recoded to use
  394. .IR scsi (2)
  395. in order to get more complete sense code descriptions.
  396. .LP
  397. .I Scuzz
  398. betrays its origins by spelling
  399. .B rdiscinfo
  400. with a
  401. .B c
  402. even though the devices it manipulates are spelled with a
  403. .BR k .
  404. .LP
  405. The
  406. .I max-xfer
  407. value is currently limited to 245760
  408. to limit kernel memory consumption.