Lines Matching +full:on +full:- +full:device
1 .\" Copyright (C) Caldera International Inc. 2001-2002. All rights reserved.
32 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
37 .EH 'PSD:3-%''The UNIX I/O System'
38 .OH 'The UNIX I/O System''PSD:3-%'
53 guidance to writers of device driver routines,
55 and nature of device drivers than the implementation
61 in the paper ``The UNIX Time-sharing System.''
71 Device Classes
73 There are two classes of device:
79 which work, or can work, with addressible 512-byte blocks.
91 Character-type devices have a much
99 device number.
101 with the minor device number
102 in the low-order 8 bits and the major device number
103 in the next-higher 8 bits;
109 The major device number selects which driver will deal with
110 the device; the minor device number is not used
118 The major device numbers for block and character devices
134 which is stored in the system's per-process
146 or other operation on the open file.
152 which is a per-system data base.
160 This table is per-system because the same instance
173 There is also a 32-bit file offset
180 which contains a copy of the file's i-node.
208 is a special file containing a currently-mounted
214 corresponding i-node as stored on the disk;
220 and the device and i-number
224 the 3-byte, compressed format used on the disk to full
233 the system always calls the device's
236 required (rewinding a tape, turning on
237 the data-terminal-ready lead of a modem, etc.).
243 that is, when the i-node table entry
246 for a device to maintain, or depend on,
249 implement an exclusive-use device which cannot
267 of the I/O target area, the byte-count for the transfer,
270 a character-type special file, the appropriate read
279 to a physical block number; a block-type
286 read or write the appropriate device.
288 Character Device Drivers
294 Each device provides five routines:
295 open, close, read, write, and special-function
300 If a call on the routine
304 on non-exclusive devices that require no setup)
312 on read-only devices)
325 is opened with the full device number as argument.
327 non-zero only if the device is to be written upon.
337 The first argument is the device number;
338 the second is a flag which is non-zero
345 is called, it is supplied the device
347 The per-user variable
362 .I on,
373 characters from the user's buffer to the device,
382 Successive calls on it return
412 the count is not too large and is non-zero.
421 The device's
427 is guaranteed to be non-zero.
445 The ``special-functions'' routine
454 is a pointer to the device's routine,
456 is the device number,
463 the device is supposed to place up to 3 words of status information
470 the device should take up to 3 words of
475 Finally, each device should have appropriate interrupt-time
477 When an interrupt occurs, it is turned into a C-compatible call
479 The interrupt-catching mechanism makes
480 the low-order four bits of the ``new PS'' word in the
485 to encode the minor device number.
491 to character device drivers.
496 For relatively low data-rate devices, the best mechanism
510 A character is placed on the end of a queue by
519 The first character on the queue may be retrieved
522 which returns either the (non-negative) character
529 Thus device handlers,
534 to device handlers is the sleep-wakeup mechanism.
541 at that time, the process is marked ready-to-run
555 by the sleeper and the waker-up.
560 Processes sleeping on an event should not assume
566 a higher numerical value indicates a less-favored
576 priority less than PZERO on an event which might never occur.
591 If a device driver
595 (for example, a device going on-line, which does not
608 inconvenient interrupts from the device.
610 If a device needs to know about real-time intervals,
623 to provide real-time delays after function characters
624 like new-line and tab in typewriter output,
633 can be going on at once.
636 is called at clock-interrupt time, so it should
640 The Block-device Interface
644 the images of blocks of data on the various devices.
647 device in multiprogrammed fashion maintain a consistent
651 keeping in-core copies of blocks that are being
658 which maintain a doubly-linked list
660 block device, and a
663 which generally maintain a doubly-linked list of blocks
669 also contains the device and block number to which the
685 Given a device and block number,
703 device block, is made ``busy,''
716 routine is used to implement read-ahead.
720 a block (on the same device) to be read asynchronously
731 There are three subtly-different write routines,
734 use by others and place it on the free list.
737 buffer on the appropriate device queue,
741 places the buffer on the device's queue, but does not wait
757 it is used, for example, when updating i-nodes.
771 block, on the assumption that
774 will be given soon which will re-use the same block.
802 This bit is set when the buffer is handed to the device strategy routine
813 to 0 when a block is handed to the device strategy
814 routine and is turned on when the operation completes,
827 if it is non-zero.
834 whereby a more detailed error-reporting
837 This bit indicates that the buffer header is not on
841 blocks associated with its device, however.
847 for a given device and finds the requested
848 block with this bit on, it sleeps until the bit
852 need to allocate the Unibus map on an 11/70.
854 This bit is set on buffers that have the Unibus map allocated,
873 is on.
877 every time a buffer is freed on the chance that someone
880 This bit may be set on buffers just before releasing them; if it
881 is on,
889 to indicate to the appropriate device driver
901 should be called for the buffer on completion.
912 Block Device Drivers
917 and that of a table for each block device.
919 Just as for character devices, block device drivers may supply
925 called respectively on each open and on the final close
926 of the device.
928 each block device driver has a
935 and the major and minor device number.
951 In cases where the device
952 is capable, under error-free operation,
954 the device's word-count register should be placed
960 when reading this device
973 of core images to and from the swapping device,
975 for this device.
977 no extraneous bits get turned on in the
980 The device's table specified by
985 head of the chain of buffers for the device
987 and a first and last pointer for a device queue.
988 Of these things, all are used solely by the device driver
990 except for the buffer-chain pointers.
992 device, and is used at a minimum to
993 indicate that the device is currently engaged in
997 The device queue is used to remember stacked requests;
998 in the simplest case it may be maintained as a first-in
999 first-out list.
1006 which maintain the device queues.
1009 are provided which are useful to block device drivers.
1027 It may be called only in the non-interrupt
1032 Raw Block-device I/O
1034 A scheme has been set up whereby block device drivers may
1036 directly between the user's core image and the device
1039 The method involves setting up a character-type special file
1040 corresponding to the raw device
1046 non-shared buffer header with the appropriate information
1047 and call the device's strategy routine.
1053 A special-function routine might come in handy, especially for
1068 the device number
1070 and a read-write flag