Device Files in HP-UX 11i


What could be more confusing in the UNIX world than device files? Fortunately, in HP-UX, device files for workstations and servers are nearly identical, so if you learn one, your knowledge applies to the other. In this section, I cover:

  • The structure of device files

  • Some commands associated with helping you work with device files

  • Some examples of creating device files

A device file provides the HP-UX kernel with important information about a specific device. The HP-UX kernel needs to know a lot about a device before Input/Output operations can be performed. With HP-UX 11i, the device file naming convention is the same for workstations and server systems. Device files are in the /dev directory. There may also be a subdirectory under /dev used to further categorize the device files. Examples of a subdirectories are /dev/dsk, where disk device files are usually located, and /dev/rmt , where tape drive device files are located. Figure 5-1 shows the HP-UX 11i device file-naming convention.

Figure 5-1. HP-UX 11i Device File Naming Convention

graphics/05fig01.gif

There are a number of commands that you can use as you go about creating device files. The ioscan command is the first of these. Some of the examples in this section were used in Chapter 3, when building a kernel was covered. The following is an ioscan output of the same workstation for which sysdef was run when describing how a kernel is created in Chapter 3. (Using -f with ioscan would have created a full listing; you should try it with and without -f. ) I included four ioscan outputs so you could see examples from a variety of different systems. The last listing is from a large V-Class system used in some of the examples in Chapter 8, where disks and file systems are covered.

(on workstation)

 $  /usr/sbin/ioscan  H/W Path     Class             Description ============================================================              bc 1            graphics          Graphics 2            ba 2/0          unknown 2/0/1           ext_bus        Built-in SCSI 2/0/1.1            target 2/0/1.1.0            disk      HP      C2247 2/0/1.2            target 2/0/1.2.0            disk      TOSHIBA CD-ROM XM-3301TA 2/0/1.6            target 2/0/1.6.0            disk      HP      C2247 2/0/2           lan            Built-in LAN 2/0/4           tty            Built-in RS-232C 2/0/6           ext_bus        Built-in Parallel Interface 2/0/8           audio          Built-in Audio 2/0/10          pc             Built-in Floppy Drive 2/0/10.1           floppy      HP_PC_FDC_FLOPPY 2/0/11          ps2            Built-in Keyboard 8            processor         Processor 9            memory            Memory 

The following is an ioscan output from a server system. Note the four processors shown in this output.

( on server)

 $  /usr/sbin/ioscan  H/W Path     Class             Description ============================================================              bc 8            bc                I/O Adapter 10           bc                I/O Adapter 10/0            ext_bus        GSC built-in Fast/Wide SCSI 10/0.3             target 10/0.3.0              disk     HP      C2490WD 10/0.4             target 10/0.4.0              disk     HP      C2490WD 10/0.5             target 10/0.5.0              disk     HP      C2490WD 10/0.6             target 10/0.6.0              disk     HP      C2490WD 10/4         bc                Bus Converter 10/4/0             tty         MUX 10/12        ba                Core I/O Adapter 10/12/0         ext_bus        Built-in Parallel Interface 10/12/5         ext_bus        Built-in SCSI 10/12/5.0          target 10/12/5.0.0           tape     HP       HP35480A 10/12/5.2          target 10/12/5.2.0           disk     TOSHIBA CD-ROM XM-4101TA 10/12/6         lan            Built-in LAN 10//12/7        ps2            Built-in Keyboard/Mouse 32          processor          Processor 34          processor          Processor 36          processor          Processor 38          processor          Processor 49          memory             Memory 

The next command that helps you when creating device files is lsdev. lsdev lists the drivers configured into your system. When adding a device file, you need to have the driver for the device configured into the system. You can use the manual kernel configuration process covered earlier to add a driver to the kernel. There are columns for the major number for a character device and block device, the driver name , and the class of the driver. The major number, character device, and other parameters are defined later. Here is an example of running lsdev on the same workstation on which ioscan was run:

( on workstation)

 $  /usr/sbin/lsdev  Character     Block     Driver     Class     0          -1       cn         pseudo     1          -1       ansio0     tty     3          -1       mm         pseudo    16          -1       ptym       ptym    17          -1       ptys       ptys    24          -1       hil        hil    27          -1       dmem       pseudo    46          -1       netdiag1   unknown    52          -1       lan2       lan    64          64       lv         lvm    66          -1       audio      audio    69          -1       dev_config pseudo    72          -1       clone      pseudo    73          -1       strlog     pseudo    74          -1       sad        pseudo    75          -1       telm       strtelm    76          -1       tels       strtels    77          -1       tlctls     pseudo    78          -1       tlcots     pseudo    79          -1       tlcotsod   pseudo   114          -1       ip         pseudo   115          -1       arp        pseudo   116          -1       echo       pseudo   119          -1       dlpi       pseudo   130          -1       rawip      pseudo   136          -1       tcp        pseudo   137          -1       udp        pseudo   138          -1       stcpmap    pseudo   139          -1       nuls       pseudo   140          -1       netqa      pseudo   141          -1       tun        pseudo   142          -1       btlan3     unknown   143          -1       fddi3      unknown   144          -1       fddi0      unknown   145          -1       fcT1_cntl  unknown   156          -1       ptm        strptym   157          -1       ptm        strptys   159          -1       ps2        ps2   164          -1       pipedev    unknown   168          -1       beep       graf_pseudo   169          -1       fcgsc_lan  lan   170          -1       lpr0       unknown   174          -1       framebuf   graf_pseudo   183          -1       diag1      diag   188          31       sdisk      disk   189          -1       klog       pseudo   196          -1       eeprom     da   203          -1       sctl       ctl   205          -1       stape      tape   207          -1       sy         pseudo   216          -1       CentIF     ext_bus   227          -1       kepd       pseudo   229          -1       ite        graf_pseudo   232          -1       diag2      diag 

Here is an example of running lsdev on the same server on which ioscan was run:

( on server)

 $  /usr/sbin/lsdev  Character     Block     Driver     Class     0          -1       cn         pseudo     1          -1       asio0      tty     3          -1       mm         pseudo    16          -1       ptym       ptym    17          -1       ptys       ptys    28          -1       diag0      diag    46          -1       netdiag1   unknown    52          -1       lan2       lan    64          64       lv         lvm    69          -1       dev_config pseudo    72          -1       clone      pseudo    73          -1       strlog     pseudo    74          -1       sad        pseudo    75          -1       telm       strtelm    76          -1       tels       strtels    77          -1       tlctls     pseudo    78          -1       tlcots     pseudo    79          -1       tlcotsod   pseudo   114          -1       ip         pseudo   116          -1       echo       pseudo   119          -1       dlpi       pseudo   130          -1       rawip      pseudo   136          -1       lpr0       unknown   137          -1       udp        pseudo   138          -1       stcpmap    pseudo   139          -1       nuls       pseudo   140          -1       netqa      pseudo   141          -1       tun        pseuod   142          -1       btlan3     unknown   143          -1       fddi3      unknown   144          -1       fddi0      unknown   156          -1       ptm        strptym   157          -1       ptm        strptys   159          -1       ps2        ps2   164          -1       pipedev    unknown   168          -1       beep       graf_pseudo   174          -1       framebuf   graf_pseudo   188          31       sdisk      disk   189          -1       klog       pseudo   193          -1       mux2       tty   203          -1       sctl       ctl   205          -1       stape      tape   207          -1       sy         pseudo   216          -1       CentIF     ext_bus   227          -1       kepd       pseudo   229          -1       ite        graf_pseudo 

From these two lsdev outputs, you can observe some minor differences in the devices. The workstation, for instance, has such classes as audio and floppy, the server has a multiplexer.

You can use ioscan to show the device files for a particular peripheral. Going back to the server that had four disks and a CD-ROM attached to it, you could issue the following ioscan command to see the device files associated with disk:

( on server)

 $  /usr/sbin/ioscan -fn -C disk  Class  I  H/W Path   Driver  S/W State  H/W Type   Description ============================================================ disk   0 10/0.3.0    sdisk    CLAIMED    DEVICE     HP C2490WD                      /dev/dsk/c0t3d0  /dev/rdsk/c0t3d0 disk   1 10/0.4.0    sdisk    CLAIMED    DEVICE     HP C2490WD                      /dev/dsk/c0t4d0  /dev/rdsk/c0t4d0 disk   2 10/0.5.0    sdisk    CLAIMED    DEVICE     HP C2490WD                      /dev/dsk/c0t5d0  /dev/rdsk/c0t5d0 disk   3 10/0.6.0    sdisk    CLAIMED    DEVICE     HP C2490WD                      /dev/dsk/c0t6d0  /dev/rdsk/c0t6d0 disk   3 10/12/5/2/0 sdisk    CLAIMED    DEVICE     CD-ROM                      /dev/dsk/c1t2d0  /dev/rdsk/c1t2d0 

You can see from this ioscan all of the device files associated with disk, including the CD-ROM.

You could find out more information about one of these devices with the diskinfo command. Specify the character device you want to know more about, as shown below (using the -v option for verbose provides more detailed information).

 $  diskinfo /dev/rdsk/c0t5d0  SCSI describe of /dev/rdsk/c0t5d0              vendor: HP          product id: C2490WD                type: direct access                size: 2082636 bytes    bytes per sector: 512 


HP-UX 11i Systems Administration Handbook and Toolkit
HP-UX 11i Systems Administration Handbook and Toolkit (2nd Edition)
ISBN: 0131018833
EAN: 2147483647
Year: 2003
Pages: 301

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net