Messages in this thread | | | Date | Fri, 15 May 1998 15:15:08 +0200 | From | (Joerg Weule) | Subject | Re: pre11b probs... |
| |
Hi,
since I want to switch some behavior of my program dds2tar, I had to know the vendor of the current tape, used for backup. I found out, that with the minor device number I can get the vendor with the following script. For the first tape I can use ...;popen("scsi_vendor tape 1","r");... the get the full name ;-)
Is there an easier way?
Thanks in advance
Jörg
------------------------------------------------------------------------------- Jörg Weule - weule@uni-duesseldorf.de - http://www.cs.uni-duesseldorf.de/~weule
------------------------------------------------------------------------------- #!/bin/csh # (C) Jörg Weule -- weule@acm.org -- May 1998 # # Determine the Verndor of a device # # csh-Example: # # <1>scsi_vendor # Disks: SEAGATE SAMSUNG # Cdroms: TOSHIBA PHILIPS # Tapes: HP # <2>scsi_vendor disk # SEAGATE SAMSUNG # <383>scsi_vendor cd # TOSHIBA PHILIPS # <3>scsi_vendor tape # HP # <4>scsi_vendor tape 1 # HP # <5>scsi_vendor dsik 1 # <6>scsi_vendor disk 1 # SEAGATE # <7>scsi_vendor disk 2 # SAMSUNG # set s = ( ) ; set c = ( ) ; set d = ( ) ; set x = ( `grep '^ ' /proc/scsi/scsi | cut -c3-18` ) set o = '' ; set v = '' ; foreach i ( $x ) if ( "$o" == 'Vendor:' ) set v = $i ; if ( "$o" == 'Type:' && "$i" == 'Sequenti' ) set s = ( $s $v ); if ( "$o" == 'Type:' && "$i" == 'CD-ROM' ) set c = ( $c $v ); if ( "$o" == 'Type:' && "$i" == 'Direct-A' ) set d = ( $d $v ); set o = $i ; end if ( $# == 0 ) then echo Disks: $d echo Cdroms: $c echo Tapes: $s exit 0 ; endif if ( $# == 1 ) then set v = '' ; if ( $1 == disk ) then echo $d endif if ( $1 == cd ) then echo $c endif if ( $1 == tape ) then echo $s endif exit 0 ; endif if ( $# == 2 ) then set v = '' ; if ( $1 == disk && $#d >= $2 ) then set v = $d[$2] ; endif if ( $1 == cd && $#c >= $2 ) then set v = $c[$2] ; endif if ( $1 == tape && $#s >= $2 ) then set v = $s[$2] ; endif echo $v exit 0 ; endif if ( "$v" == "$3" ) then exit 2 ; endif exit 1 ;
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |