1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
|
. \" @(#)rscsi.1 1.5 09/11/15 Copyr 2000-2008 J. Schilling
. \" Manual Seite fuer rscsi
. \"
.if t .ds a \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'a
.if t .ds o \v'-0.55m'\h'0.00n'\z.\h'0.45n'\z.\v'0.55m'\h'-0.45n'o
.if t .ds u \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'u
.if t .ds A \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'A
.if t .ds O \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'O
.if t .ds U \v'-0.77m'\h'0.30n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.75n'U
.if t .ds s \\(*b
.if t .ds S SS
.if n .ds a ae
.if n .ds o oe
.if n .ds u ue
.if n .ds s sz
.TH RSCSI 1 "Release 3.0" "J\*org Schilling" "Schily\'s USER COMMANDS"
.SH NAME
rscsi \- remote generic SCSI transport protocol server
.SH SYNOPSIS
.B /opt/schily/sbin/rscsi
.SH DESCRIPTION
.IX "rscsi command" "" "\fLrscsi\fP \(em remote generic SCSI transport protocol server"
.IX "remote generic SCSI transport protocol server" "" "remote generic SCSI transport protocol server \(em \fLrscsi\fP"
The
.B rscsi
command is a
remote generic SCSI transport server program.
.B rscsi
is a program that is run locally on the machine with SCSI devices,
it is used by remote programs like
.BR cdrecord (1),
.BR cdda2wav (1),
.BR readcd (1),
and
.BR sformat (1)
that like to access SCSI devices
through an interprocess communication connection
via
.BR libscg .
.B rscsi
is normally started up with an
.BR rexec (3)
or
.BR rcmd (3)
call but it may also be connected via an internal pipe to an
.BR ssh (1)
session that was set up by the remote user.
.LP
The
.B rscsi
program accepts
.BR scg_open ,
.BR scg_close ,
.B scg_cmd
and
similar requests that are all related to the interface of
.BR libscg .
.B rscsi
performs the commands and then responds with a status indication.
.LP
The
.B rscsi
program is prepared to be installed as a
.B user shell
in the passwd
file to create remote SCSI specific logins and security checking.
.LP
All requests are send to the
.B rscsi
program in
.SM ASCII
and thus are byte order and machine independent.
.LP
All responses are send back in
.SM ASCII
and in one of the following two forms.
.LP
All successful commands (except for the "S" command that sends SCSI commands) have responses of
.IP
.BI A number\en
.LP
where
.I number
is the
.SM ASCII
representation of a decimal number that usually is the return
code of the corresponding system call or function.
.sp
All unsuccessful commands are responded to with
.IP
.BI E error-number \en error-message \en xerror-len\fB\en\fIxerror-txt
.LP
where
.I error-number
is one of the possible error
numbers described in
.BR intro (2),
and
.I error-message
is the corresponding error string as retrieved by
.BR strerror (3),
.I xerror-len
is the length of the additional error text
.I xerror-txt
and may be 0. In case
.I xerror-len
is 0, no
.I xerror-txt
is send.
Note that a failed SCSI command that returned SCSI sense data counts as
a successful command and does not use the default error format.
.LP
.ne 15
The
.B rscsi
protocol implements the
following commands:
.RS
.br
.ne 7
.TP 12
.BI V what \en
Return the
.B version
for several instances of the software in the
.B rscsi
server.
The parameter
.B what
may have the following values:
.RS
.TP
.B 0
Return
.B SCG_VERSION
from
.B libscg
on the
.B rscsi
server.
This returns the version string for the low level SCSI transport adaptation layer.
.TP
.B 1
Return
.B SCG_AUTHOR
from
.B libscg
on the
.B rscsi
server.
This returns the author name for the low level SCSI transport adaptation layer.
.TP
.B 2
Return
.B SCG_SCCS_ID
from
.B libscg
on the
.B rscsi
server.
This returns the SCCS version string for the low level SCSI transport adaptation layer.
.TP
.B 20
Return
.B SCG_KVERSION
from
.B libscg
on the
.B rscsi
server.
This returns the version of kernel instance of the driver that is underneath the
low level SCSI transport adaptation layer.
.sp
This call may not be supported for all operating systems.
.PP
.sp
This command corresponds to the
.BR scg_version (3)
function from
.BR libscg .
.RE
.br
.ne 7
.TP
.BI O device \en
Open the specified SCSI
.IR device .
.sp
See the description of the
.B dev=
option in
.BR cdrecord (1)
for more information on possible values of the
.I device
parameter.
.sp
If a device is already open, it is
closed before a new open is performed.
.sp
This command corresponds to the
.BR scg_open (3)
function from
.BR libscg .
.sp
The return value in case of success is 0.
.br
.ne 7
.TP
.BI C device \en
Close the currently open device or file. The argument
.I device
is ignored.
.sp
This command corresponds to the
.BR scg_close (3)
function from
.BR libscg .
.sp
The return value is the return value from the
.BR scg_close (3)
function.
.br
.ne 7
.TP
.BI D size \en
Set up the maximum DMA size for the currently open SCSI device.
The
.I size
parameter is the desired DMA size in bytes.
.sp
This command corresponds to the
.BR scg_bufsize (3)
function from
.BR libscg .
.sp
The returned value is the actual DMA size that could be set up.
This value may be lower than the
.I size
parameter.
.br
.ne 7
.TP
.BI M size \en
Allocate a buffer suitable for SCSI DMA transfers.
.sp
This command corresponds to the
.BR scg_getbuf (3)
function from
.BR libscg .
.sp
The returned value is the actual DMA size that could be set up.
This value may be lower than the
.I size
parameter.
.br
.ne 7
.TP
.B F\en
Free a previously allocated buffer.
.sp
This command corresponds to the
.BR scg_freebuf (3)
function from
.BR libscg .
.sp
The return value in case of success is 0.
.br
.ne 7
.TP
.B N\en
Retrieve the maximum permitted value for the SCSI bus number.
.sp
This command corresponds to the
.BR scg_numbus (3)
function from
.BR libscg .
.sp
The return value is the return value from the
.BR scg_numbus (3)
function.
.br
.ne 7
.TP
.BI B busno \en chan \en
Checks whether there is a SCSI bus with a busnumber that is equal to
.IR busno .
The
.I chan
parameter is currently ignored.
.sp
This command corresponds to the
.BR scg_havebus (3)
function from
.BR libscg .
.sp
The return value is the return value from the
.BR scg_havebus (3)
function.
.br
.ne 7
.TP
.BI T busno \en chan \en target\fB\en\fIlun\fB\en
Set the SCSI target address to
.IR busno ", " target ", " lun .
The parameter
.I chan
is currently ignored.
.sp
This command corresponds to the
.BR scg_settarget (3)
function from
.BR libscg .
.sp
The return value is the return value from the
.BR scg_havebus (3)
function.
.br
.ne 7
.TP
.B I\en
Retrieve the SCSI initiator ID for the current SCSI bus.
.sp
This command corresponds to the
.BR scg_initiator_id (3)
function from
.BR libscg .
.sp
The return value is the return value from the
.BR scg_initiator_id (3)
function.
.br
.ne 7
.TP
.B A\en
Check whether the current target is or may be an ATAPI device.
.sp
This command corresponds to the
.BR scg_isatapi (3)
function from
.BR libscg .
.sp
The return value is the return value from the
.BR scg_isatapi (3)
function.
.br
.ne 7
.TP
.BI R what \en
Perform a SCSI reset. The parameter
.I what
may have the following values:
.RS
.TP
0
Test whether a SCSI reset is supported as with the
.B SCG_RESET_NOP
parameter.
.TP
1
Perform a SCSI target reset as with the
.B SCG_RESET_TGT
parameter.
.TP
2
Perform a SCSI bus reset as with the
.B SCG_RESET_BUS
parameter.
.PP
.sp
This command corresponds to the
.BR scg_reset (3)
function from
.BR libscg .
.sp
The return value is the return value from the
.BR scg_reset (3)
function.
.RE
.br
.ne 7
.TP
.BI S count \en flags \en\fIcdb_len\fB\en\fIsense_len\fB\en\fItimeout\fB\en
Send a SCSI command to the currently selected target.
This command takes the following parameters:
.RS
.TP
.B count
The DMA count for this command. If the command is a command that transfers
data to the target, the related data is send directly after the SCSI command descriptor block.
that is described above.
.TP
.B flags
The flags that apply to this SCSI command:
.RS
.TP
.B 1
Tell the kernel that the SCSI command will transfer data from the target to the host.
This corresponds to the flag value
.BR SCG_RECV_DATA .
.TP
.B 2
Tell the kernel to send the SCSI command with disconnect/reconnect enabled.
This corresponds to the flag value
.BR SCG_DISRE_ENA .
This flag is not supported on all platforms.
.TP
.B 4
Make the kernel silent on SCSI errors.
This corresponds to the flag value
.BR SCG_SILENT .
This flag is not supported on all platforms.
.TP
.B 8
Tell the kernel to retry the SCSI command in case of a retryable SCSI transport error.
This corresponds to the flag value
.BR SCG_CMD_RETRY .
This flag is not supported on all platforms.
.TP
.B 16
Tell the kernel to send the SCSI command with parity disabled.
This corresponds to the flag value
.BR SCG_NOPARITY .
This flag is not supported on all platforms.
.RE
.TP
.B cdb_len
The SCSI command descriptor length for this command.
The SCSI command descriptor has to be send with the correct length directly after the new line past the
.B timeout
value.
.TP
.B sense_len
The amount of sense data that is expected in return of a failed SCSI command that
produces SCSI sense data.
.TP
.B timeout
The timeout for the SCSI command in seconds.
Fractions of a second may be specified by sending a floating point number.
.PP
The reply for a SCSI command that could be send to the target is:
.sp
.BI A count \en error \en\fIerrno\fB\en\fIscb\fB\en\fIsense_count\fB\en
.TP
.B count
The DMA count of any data returned from the target.
If this count is nonzero, the data is send back directly after the reply block mentioned above.
.TP
.B error
A SCSI error classification from one of the following values:
.RS
.sp
.ne 3
.TP
.B 0
No error occurred.
This value corresponds to the value
.B SCG_NO_ERROR .
.sp
.ne 3
.TP
.B 1
A retryable error occurred while trying to transport the SCSI command to the target.
This value corresponds to the value
.B SCG_RETRYABLE .
.sp
.ne 3
.TP
.B 2
A fatal error occurred while trying to transport the SCSI command to the target.
This value corresponds to the value
.B SCG_FATAL .
.sp
.ne 3
.TP
.B 3
A SCSI timeout occurred.
This value corresponds to the value
.B SCG_TIMEOUT .
.RE
.sp
.ne 3
.TP
.B errno
Any possible
.B "UNIX errno
value for the SCSI command.
.sp
.ne 3
.TP
.B scb
The SCSI status byte
.sp
.ne 3
.TP
.B sense_count
The sense count returned for the SCSI command.
The SCSI sense data is send back directly after any possible
SCSI DMA data received from the target.
.sp
This command corresponds to the
.BR scg_cmd (3)
function from
.BR libscg .
.sp
The return value is the return value from the
.BR scg_cmd (3)
function.
.RE
.RE
.LP
Any other command causes
.B rscsi
to exit.
.SH FILES
.TP
/etc/default/rscsi
Default values can be set for the following options in /etc/default/rscsi.
For example:
.sp
.BR DEBUG= /tmp/rscsi.debug
.br
.BR USER= rscsi
.br
.BR ACCESS= "rscsi myhost.mydomain.org 1 -1 3 0"
.sp
All keywords must be on the beginning of a line.
.RS
.TP
.B DEBUG
If you like to get debug information, set this to a file name where
.B rscsi
should put debug information.
.TP
.B USER
The name of a user (local to the RSCSI server) that may use
the services of the
.B rscsi
server.
More than one
.BI USER= name
line is possible.
A line
.BR USER= *
grants access to all users.
.TP
.B ACCESS
This keyword is followed by six parameters separated by a TAB.
The
.B name
of a user (local to the RSCSI server host) that may use
the services of the
.B rscsi
server followed by the
.B "name of a host
from where operation is granted
followed by a
.B "SCSI device
specification that is made of
.B bus-number
.BR channel " (ignored for now)
.B target-id
and
.B lun
that specify a SCSI device that may be accessed if this
.B ACCESS
line matches.
If one or more entries of the
.B bus-number
.B channel
.B target-id
.B lun
specification is set to -1, this matches any possible value
for the related part of the SCSI device specification.
More than one
.BI ACCESS= "name host SCSI-device"
line is possible.
.sp
If standard input of
.B rscsi
is not a socket from a remote host,
.B rscsi
will compare the
.B "host entry
from
.B /etc/default/rscsi
with the following strings:
.RS
.TP 10
.B PIPE
If
.B stdin
is a
.SM UNIX
pipe.
.sp
If you like to allow remote connections that use the
.B ssh
protocol, you need to use the word
.B PIPE
instead of the real hostname in the matching
.B ACCESS=
line.
.TP
.B ILLEGAL_SOCKET
If
.B getpeername()
does not work for
.BR stdin .
.TP
.B NOT_IP
If
.B getpeername()
works for
.B stdin
but is not connected to an internet socket.
.RE
.RE
.SH "SEE ALSO"
.BR cdrecord (1),
.BR cdda2wav (1),
.BR readcd (1),
.BR sformat (1),
.BR ssh (1),
.BR intro (2),
.BR open (2),
.BR close (2),
.BR read (2),
.BR write (2),
.BR ioctl (2),
.BR getpeername(3)
.BR rcmd (3),
.BR rexec (3),
.BR strerror (3)
.SH DIAGNOSTICS
All responses are send to the network connection.
They use the form described above.
.SH NOTES
.LP
The possibility to create a debug file by calling
.BI rscsi " file
has been disabled for security reasons.
If you like to debug
.B rscsi
edit
.B /etc/default/rscsi
and insert a
.B DEBUG
entry.
.SH BUGS
.LP
None known.
.SH HISTORY
.LP
The
.B rscsi
command has been developed by J\*org Schilling in June 2000.
.SH AUTHOR
.nf
J\*org Schilling
Seestr. 110
D-13353 Berlin
Germany
.fi
.PP
Mail bugs and suggestions to:
.PP
.B
joerg.schilling@fokus.fraunhofer.de
or
.B
js@cs.tu-berlin.de
or
.B
joerg@schily.isdn.cs.tu-berlin.de
.br
.ne 7
.SH "INTERFACE STABILITY
The interfaces provided by
.B rscsi
are designed for long term stability.
As
.B rscsi
depends on interfaces provided by the underlying operating system,
the stability of the interfaces offered by
.B rscsi
depends on the interface stability of the OS interfaces.
Modified interfaces in the OS may enforce modified interfaces
in
.BR rscsi .
|