HP Visualize J210XC IRIX to HP-UX Migration Guide - Page 22

Major and Minor Numbers

Page 22 highlights

Devices C is the controller unit number of the MUX card. P is the port number on the MUX card. Ports are numbered starting with 0. Printers are usually numbered starting at 0 or 1. Examples /dev/tty0p3 /dev/lp0 Character device file for a terminal port on the first MUX at port 3 Character special file for the first printer (using a special printer card) added to the system Major and Minor Numbers Special files are identified by their name and major and minor numbers. You can look at this information when you do a long listing of the /dev directory. Consider the command # ls -l /dev/console /dev/*dsk and its output: crw--w--w- 1 root sys 0 0x000000 Aug 15 16:11 /dev/console /dev/dsk: total 0 brw-r----- 1 bin sys 31 0x002000 Aug 11 11:50 c0t2d0 brw-r----- 1 bin sys 31 0x005000 Aug 11 13:54 c0t5d0 brw-r----- 1 root sys 31 0x006000 Aug 11 11:56 c0t6d0 /dev/rdsk: total 0 crw-r----- 1 bin sys 188 0x002000 Aug 11 11:50 c0t2d0 crw-r----- 1 bin sys 188 0x005000 Aug 11 13:54 c0t5d0 crw-r----- 1 root sys 188 0x006000 Aug 11 11:50 c0t6d0 The first character of each line identifies the type of device file. A b denotes a block device, and a c indicates a character device. A block device transfers data a block at a time by using the system buffers. A disk drive holding a mountable file system is an example of a block device. A character device reads or writes data one character at a time. Tape drives are usually character devices. Some devices are capable of I/O in both block and character mode. Such devices require two device files: one for block and one for character mode. A hard disk is an example of a device which uses both character and block device files. For purposes of mounting the disk as a file system, use the block device file. For purposes of accessing the disk for backups, use the character device file. The major and minor numbers appear immediately before the date. The major number identifies what kernel driver is being referred to by the device file. The value chosen for the major number is based on both the device driver and the access method (block or character). For devices needing both a character and block device file, there are different character major numbers and block major numbers. You can use the lsdev command to list the device drivers and their major numbers in the system. For # lsdev, for example: Character 0 1 3 16 17 46 52 56 60 64 66 Block -1 -1 -1 -1 -1 -1 -1 -1 -1 64 -1 Driver cn asio0 mm ptym ptys netdiag1 lan2 ni netman lv audio Class pseudo tty pseudo ptym ptys unknown lan unknown unknown lvm audio 17

  • 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

Devices
17
C
is the controller unit number of the MUX card.
P
is the port number on the MUX card. Ports are numbered starting with 0.
Printers are usually numbered starting at
0
or
1
.
Examples
/dev/tty0p3
Character device file for a terminal port on the first MUX at port
3
/dev/lp0
Character special file for the first printer (using a special printer card) added to the
system
Major and Minor Numbers
Special files are identified by their name and major and minor numbers. You can look at this information
when you do a long listing of the
/dev
directory. Consider the command
# ls -l /dev/console /dev/*dsk
and
its output:
crw--w--w- 1 root sys 0 0x000000 Aug 15 16:11 /dev/console
/dev/dsk:
total 0
brw-r----- 1 bin sys 31 0x002000 Aug 11 11:50 c0t2d0
brw-r----- 1 bin sys 31 0x005000 Aug 11 13:54 c0t5d0
brw-r----- 1 root sys 31 0x006000 Aug 11 11:56 c0t6d0
/dev/rdsk:
total 0
crw-r----- 1 bin sys 188 0x002000 Aug 11 11:50 c0t2d0
crw-r----- 1 bin sys 188 0x005000 Aug 11 13:54 c0t5d0
crw-r----- 1 root sys 188 0x006000 Aug 11 11:50 c0t6d0
The first character of each line identifies the type of device file. A
b
denotes a block device, and a
c
indicates a character device. A block device transfers data a block at a time by using the system buffers. A
disk drive holding a mountable file system is an example of a block device. A character device reads or
writes data one character at a time. Tape drives are usually character devices. Some devices are capable of
I/O in both block and character mode. Such devices require two device files: one for block and one for
character mode. A hard disk is an example of a device which uses both character and block device files. For
purposes of mounting the disk as a file system, use the block device file. For purposes of accessing the disk
for backups, use the character device file.
The major and minor numbers appear immediately before the date. The major number identifies what
kernel driver is being referred to by the device file. The value chosen for the major number is based on both
the device driver and the access method (block or character).
For devices needing both a character and
block device file, there are different character major numbers and block major numbers. You can use the
lsdev
command to list the device drivers and their major numbers in the system. For
# lsdev,
for example:
Character Block
Driver
Class
0
-1
cn
pseudo
1
-1
asio0
tty
3
-1
mm
pseudo
16
-1
ptym
ptym
17
-1
ptys
ptys
46
-1
netdiag1
unknown
52
-1
lan2
lan
56
-1
ni
unknown
60
-1
netman
unknown
64
64
lv
lvm
66
-1
audio
audio