-
- Weitere Informationen zu diesem Buch:
Inhaltsverzeichnis | Index | Probekapitel | Kolophon | Rezensionen |
Download der Beispiele |
- Weitere Informationen zu diesem Buch:
Third Edition Februar 2005
ISBN 978-0-596-00590-0
Weitere Informationen zu diesem Buch
Inhaltsverzeichnis |
Index |
Probekapitel |
Kolophon |
Rezensionen |
Download der Beispiele |
Index
[ Numbers ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ X ], [ Z ],
Numbers[ Top ]
16-bit ports, 240, 242
32-bit ports, 240
accessing, 240
string functions for, 242
8-bit ports, 240
reading/writing, 240
string functions for, 242
A[ Top ]
abstractions (hardware), 318
access
blocking open requests, 176
character (char) drivers, 6, 43-49
to device files, 173-179
DMA (see DMA)
to drivers, 47
interfaces, 7
I/O memory, 249, 250, 252
ISA memory, 253
kobjects, 365
locking, 121
management, 108
NUMA systems, 216, 417
PCI, 305
configuration space, 315
I/O and memory spaces, 316
policies, 3
ports, 255
different sizes, 240
from user space, 241
restriction of, 144, 174
seqlocks, 127
unaligned data, 300
access_ok function, 142
ACTION variable, 399
adding
devices, 392-395
drivers, 396
locking, 109
VMAs, 426
Address Resolution Protocol (see ARP)
addresses
bounce buffers, 445
bus (see bus addresses)
buses, 443
hardware, 508, 515
hardware (see hardware addresses)
MAC, 504, 532-534
PCI, 303, 452
remapping, 434
resolution (network management), 5
resolving, 532
spaces, generic I/O, 316
types, 413
virtual (conversion), 444
aio_fsync operation, 438
algorithms (lock-free), 123
alignment
of data, 293
unaligned data access, 300
allocating
major device numbers, 46-49
memory, 60-62
by page, 221
allocation, 249, 255
of block drivers, 468
of buffers, 530
of device numbers, 45
of DMA buffers, 442
dynamic allocation of major numbers, 46
of gendisk structures, 468
of I/O ports, 239
of memory, 60-63
boot time, 230, 234
flags, 215, 218, 231
I/O, 249, 255
kmalloc allocation engine, 213-217
lookaside caches, 217-224, 232
per-CPU variables, 228-230
vmalloc allocation function, 224-228
page-oriented functions, 221, 233
of snull drivers, 503
of socket buffers, 522, 530
structures (registration), 55-57
of urbs, 354
alloc_netdev function, 504
alloc_pages interface, 223
alloc_skb function, 530
alloc_tty_driver function, 549
Alpha architecture, porting and, 243
alternatives to locking, 123-130
API (application programming interface)
spinlocks, 117
timers, 198
application programming interface (see API)
applications versus kernel modules, 18-22
architecture
EISA, 323
M68k (porting and), 243
MCA, 322
NuBus, 324
PCI, 302-319
PowerPC (porting and), 244
S/390, 402
SBus, 324
SPARC, 244
Super-H, 244
VLB, 323
x86 (interrupt handlers on), 268
zSeries, 402
arguments
cache, 218
flags, 213
interrupt handlers, 272
ioctl method, 141
kmalloc size, 216
sfile, 87
ARM architecture, porting and, 243
ARP (Address Resolution Protocol), 504
Ethernet and, 532
IFF_NOARP flag and, 504, 509
overriding, 533
arrays
bi_io_vec, 482
block drivers, 468
memory maps, 417
parameters (declaration of), 37
quantum sets (memory), 61
asm directory, 19
assignment
dynamic allocation of major numbers, 46
of hardware addresses, 515
of IP numbers, 499
of parameter values, 35-37
asynchronous DMA, 441
asynchronous I/O, 437-440
asynchronous notification, 169-171
asynchronous running of timers, 197
asynctest program, 169
atomic context (spinlocks), 118
atomic variables, 124
atomic_add operation, 125
atomic_dec operation, 125
atomic_dec_and_test operation, 125
atomic_inc operation, 125
atomic_inc_and_test operation, 125
atomic_read operation, 125
atomic_set operation, 125
atomic_sub operation, 125
atomic_sub_and_test operation, 125
atomic_t count field (memory), 417
attributes
binary (kobjects), 374
buses, 380
data (firmware), 407
default (kobjects), 372
deleting, 374, 381
devices, 383, 407
drivers, 386
loading (firmware), 407
nondefault (kobjects), 373
authorization, 8
autodetection, 264
automatic, IRQ number detection, 264
B[ Top ]
back-casting kobject pointers, 365
barriers
memory, 237, 238, 255
requests, 485
base module parameter, 247
baud rates (tty drivers), 562
BCD (binary-coded decimal) forms, 346
bEndpointAddress field (USB), 330
bibliography, 575
big-endian byte order, 293
bi_io_vec array, 482
binary attributes (kobjects), 374
binary-coded decimal (BCD) forms, 346
bin_attribute structure, 374
bInterval field (USB), 331
bio structure, 482, 487
bitfields (ioctl commands), 137, 180
bits
clearing, 269
operations, 126
specifications, 246
BLK_BOUNCE_HIGH symbol, 480
blk_cleanup_queue function, 479
blkdev_dequeue_request function, 479
blk_queue_hardsect_size function, 470
blk_queue_segment_boundary function, 481
block devices, 7
block drivers
command pre-preparation, 491
functions, 494-496
operations, 471-474
registration, 465-470
request processing, 474-491
TCQ, 492-493
block_fsync method, 167
blocking
I/O, 147-162, 176
open method, 176
operations, 151
release method, 176
bmAttributes field (USB), 330
BogoMips value, 195
boot time (memory allocation), 230, 234
booting (PCI), 306
bottom halves
interrupt handlers, 275-278
tasklets and, 276
bounce buffers, 445
block drivers, 480
streaming DMA mappings and, 449
bridges, 303
BSS segments, 419
buffers
allocation of, 530
bounce, 445
block drivers, 480
streaming DMA mappings and, 449
circular, 78, 123
DMA (unmapping), 449
freeing, 531
I/O, 151
large (obtaining), 230, 234
output, 152
overrun errors, 9, 95
for printk function, 78
ring (DMA), 441
socket (see socket buffers)
sockets, 522, 528-532
synchronization, 452
transfers, 448
tty drivers, 558
USB, 338
user space (direct I/O), 436
write-buffering example, 282
bugs (see debugging; troubleshooting)
BULK endpoints (USB), 330
bulk urbs (USB), 343
bus_add_driver function, 396
BUS_ATTR macro, 380
bus_attribute type, 380
buses
addresses, 413, 443
attributes, 380
functions, 409
IEEE1394 (Firewire), 400
iteration, 379
Linux device model, 377-381
match function, 379
methods, 379
PCI (see PCI)
registers, 445
registration, 378
USB (see USB)
bus_for_each_dev function, 380
bus_register function, 378
bus_type structure, 378
busy loops, 191
busy-waiting implementation, 190
bytes
CSIZE bitmask, 561
order, 293
orders, 300
C[ Top ]
caches
argument, 218
coherency issues, 445
lookaside, 217-224, 232
troubleshooting, 237, 425
calling
current process, 21
firmware, 407
ioctl method, 136
ioremap function, 249
memory barriers, 238
perror calls, 93
preparation functions, 492
release, 174
cancellation of urbs, 345
capabilities, restricted operations and, 144
capability.h header file, 144, 181
capable function, 145, 181
CAP_DAC_OVERRIDE capability, 144
single-user access to devices, 175
CAP_NET_ADMIN capability, 144
CAP_SYS_ADMIN capability, 144
CAP_SYS_MODULE capability, 144
CAP_SYS_RAWIO capability, 144
CAP_SYS_TTY_CONFIG capability, 144
card select number (CSN), 321
cardctl utility, 3
carrier signals, 528
cdev structure, 56
change_bit operation, 126
change_mtu method, 513
improving performance using socket buffers, 522
channels, DMA, 454-456
char *buffer field (request structure), 477
char bus_id field, 382
char disk_name field (gendisk), 467
char (character) drivers, 6
access, 43-49
asynchronous notification, 169-171
defining mechanism of, 42
files
access to, 173-179
operations, 49-53
structures, 53
inode structure, 55
I/O, 147-162
ioctl method, 135-147
llseek method, 171
memory usage (scull), 60-63
open method, 58-59
poll method, 163-169
read method, 63-69
readv calls, 69
registration, 55-57
release method, 59
scull (design of), 42
select method, 163-169
testing, 70
version numbers, 43
write method, 63-69
writev calls, 69
char name field (net_device structure), 506
char *name variable (USB), 352
character drivers (see char drivers)
chars_in_buffer function, 558
check_flags method, 52
CHECKSUM_ symbols, 523
circular buffers, 123
DMA ring buffers, 441
implementing interrupt handlers, 270
for printk function, 78
claim_dma_lock function, 457
class register (PCI), 309
classes
devices, 5, 362, 390
functions, 410
interfaces, 391
Linux device model, 387-391
management, 389
modules, 5-8
class_id field, 390
class_simple interface, 388
class_simple_create function, 404
class_simple_device_add function, 404
class_simple_device_remove function, 405
cleanup function, 32
clear_bit operation, 126
clear_dma_ff function, 458
clearing bits on interface boards, 269
clock ticks (see jiffies, values)
clocks, 208
cycles (counting), 186
(see also time)
cloning devices, 177
close function (tty drivers), 553-556
close method, 59
vm_operations_struct structure, 421
cmd field (request structure), 492
coarse-grained locking, 122
code
concurrency in, 20
delaying execution of, 196
execution, 190-196, 209
hello world module, 16-18
inline assembly (example), 187
ISA, 321
kernels (see kernels)
memory (scull), 107
module requirements, 30
runtime, 5
scilluid, 175
sleeps, 158
test system setup, 15
user space programming, 19, 37-39
coherency
caches, 445
DMA, 446
command pre-preparation (block drivers), 491
command-oriented drivers, 146
commands
dmesg, 77
FIOASYNC, 141
FIOCLEX, 141
FIONBIO, 141
FIONCLEX, 141
FIOQSIZE, 141
F_SETFL fcntl, 169
F_SETOWN, 169
gdb, 99
ifconfig
net_device structure and, 506
opening network drivers, 515-516
snull interfaces, 501
ioctl, 137, 140
creating, 180
customizing for networking, 535
implementation, 145
printk (see printk function)
SIOCDEVPRIVATE, 535
strace, 91
wc, 92
(see also functions)
communication with user space, 362
compilers
gcc, 188
optimizations, 236
compiling
char drivers, 70
modules, 23-25
complete function (urbs), 345
complete module, 115
completion
of DMA, 458
request functions, 486
semaphores, 114-116
urbs, 345
concurrency
alternatives to locking, 123-130
controlling transmission, 518
debugging, 21
in kernel programming, 20
locking
adding, 109
traps, 121-123
management, 107-109
scull (troubleshooting memory), 107
semaphores
completion, 114-116
implementation, 110-114
spinlocks, 116-121
transmission, 518
CONFIG_ACPI_DEBUG option, 75
CONFIG_DEBUG_DRIVER option, 75
CONFIG_DEBUG_INFO option, 74
CONFIG_DEBUG_KERNEL option, 73
CONFIG_DEBUG_PAGEALLOC option, 74
CONFIG_DEBUG_SLAB option, 73
CONFIG_DEBUG_SPINLOCK option, 74
CONFIG_DEBUG_SPINLOCK_SLEEP option, 74
CONFIG_DEBUG_STACKOVERFLOW option, 74
CONFIG_DEBUG_STACK_USAGE option, 74
CONFIG_IKCONFIG option, 75
CONFIG_IKCONFIG_PROC option, 75
CONFIG_INIT_DEBUG option, 74
CONFIG_INPUT_EVBUG option, 75
CONFIG_KALLSYMS option, 74
CONFIG_MAGIC_SYSRQ option, 74
CONFIG_PROFILING option, 75
CONFIG_SCSI_CONSTANTS option, 75
configuration
cdev structure, 56
char drivers, 45
dynamic allocation of major numbers, 46
internal representation of device numbers, 44
major/minor numbers, 43
(see also char drivers)
coherent DMA mappings, 446
critical sections, 109
DMA controllers, 456-459
drivers, 35-37
ether_setup function, 507-514
interrupt handlers, 259-269
kernels, 73-75
line settings (tty drivers), 560-566
multicasting, 539
net_device structure, 502
network devices, 512
parameter assignment, 35-37
PCI, 306
accessing configuration space, 315
registers, 308
serial lines, 565
single-page streaming mappings, 450
snull drivers, 498-502
streaming DMA mappings, 448
test system setup, 15
timeouts, 193
USB interfaces, 332
version dependency, 26
CONFIG_USB_DYNAMIC_MINORS configuration option, 353
connections
Firewire, 400
IP numbers, 500
network drivers to kernels, 502-514
PCI (see PCI)
/proc file hierarchies, 86
USB (see USB)
(see also hotplugs)
connectors (ISA), 323
console_loglevel variable, 77
debugging system hangs, 97
consoles
messages (redirecting), 77
wrong font on, 147
const char *dev_name functions, 260
const char *name field (PCI registration), 311
const char *name function, 348
const struct pci_device_id *id_table field (PCI registration), 311
const struct usb_device_id *id_table function, 348
constructor function (kmem_cache_create), 218
CONTROL endpoints (USB), 329
control functions (queues), 480
control urbs (USB), 343
controllers (PCI), 318
controlling
transmission concurrency, 518
urbs (USB), 354
by writing control sequences, 146
conventional memory, I/O registers, 236
(see also memory)
conversion (virtual addresses), 444
copying (cross-space), 64
core files, 99
counters
jiffies, 184
reference (kobjects), 366
registers, 186
TSC, 186
counts (interrupts), 566
CPU modalities (levels), 20
create_module system call, 226
create_proc_read_entry function, 86
creating
queues, 479
urbs (USB), 341
critical sections, 109
cross-space copying, 64
CRTSCTS bitmask, 561
CSIZE bitmask, 561
CSN (card select number), 321
CSTOPB bitmask, 561
current process, 21, 40
current time, retrieving, 188-190
current.h header file, 21
currentime file (jit module), 189
custom
data types, 291
ioctl methods for networking, 535
cycles_t type, 187
D[ Top ]
daemons
klogd, 17, 77
syslogd, 79
data
explicitly sizing, 290
physical packet transport, 501
transferring with DMA, 440-459
unaligned, portability and, 293
data attribute (firmware), 407
data functions (USB), 358
data structures, 49
file operations, 49-53
portability of, 294
data types
for explicitly sizing data, 290
inptr_t (C99 standard), 289
int, 289
interface-specific, 291
loose typing for I/O functions, 292
mixing different, 289
portability and, 288-292
standard C types, 288
u8, u16, u32, u64, 290
uint8_t/unit32_t, 290
dataalign program, 294
datasize program, 288
dd utility and scull driver example, 61
deadline schedulers (I/O), 478
deadlocks, avoiding, 117
(see also locking)
debugging, 73-105
concurrency, 21
using a debugger, 99-105
using Dynamic Probes, 105
interrupt handlers, 273
with ioctl method, 90
using kdb kernel debugger, 101-103
kernels
monitoring, 91
by printing, 75-82
by querying, 82-91
support, 73-75
using kgdb, 103
levels (implementation of), 81
using LTT, 105
locked keyboard, 97
by printing, 81
by querying, 91
system faults, 93-98
system hangs, 96
using User-Mode Linux, 104
(see also troubleshooting)
declaration of array parameters, 37
DECLARE_TASKLET macro, 276
default attributes (kobjects), 372
default_attrs field (kobjects), 372
DEFAULT_CONSOLE_LOGLEVEL, 77
DEFAULT_MESSAGE_LOGLEVEL, 77
delaying execution of code, 190-196, 209
deleting
attributes, 374, 381
devices, 395
drivers, 396
mappings (DMA), 448
/proc files, 86
queues, 479
symbolic links, 375
del_timer_sync function, 200
dentry field (file structure), 54
dependency
platform, 27
version, 26
dereferencing memory addresses, 289
descriptors (USB), 358
design
concurrency, 107-109
policy-free drivers, 3
of scull, 42
(see also configuration)
desktops
PCI (see PCI)
USB (see USB)
destroying urbs (USB), 341
destructor function (kmem_cache_create), 218
/dev directory, 43
/dev nodes, 6
char devices and, 43
dynamic major number allocation, 46
/dev/random device, 260
/dev/urandom device, 260
/dev tree, 403
dev_alloc_skb function, 530
development community (kernel), joining, 12
development kernels, 10
device attribute (firmware), 407
DEVICE variable, 402
deviceID register (PCI), 309
devices
access to files, 173-179
adding, 392-395
allocation of numbers, 45
attributes, 383
block (see block drivers)
caching problems, 425
char drivers (see char drivers)
character (see char drivers)
classes of, 5-8, 362, 390
cloning, 177
concurrency, 107-109
control operations, 5
deleting, 395
DMA and, 440-459
drivers, 385
dynamic, 397
dynamic allocation of major numbers, 46
FIFO, 43
file operations on, 49
files, 43
functions, 409
hotpluggable, 362
identifying type with ls command, 43
initialization, 503
input (hotplugging), 401
internal representation of numbers, 44
ioctl method, 135-147
ISA, 320
iteration, 379
Linux device model, 362-364, 381-387
buses, 377-381
classes, 387-391
firmware, 405-407
hotplug events, 375
hotplugging, 397-405
kobjects, 364-371
lifecycles, 391-397
low-level sysfs operations, 371-375
methods, 511
names of, 46
network, 400
network drivers, 497
numbers (printing), 82
operations, 513
reading and writing, 63
reading data from, 166
registration, 382, 502
SCSI, 402
scullpipe (example), 153-162
scullsingle, 174
seeking, 171
single-open, 173
structures (embedding), 383
truncating on open, 59
USB (see USB)
version (see versions, numbering)
writing
control sequences to, 146
data to, 166
(see also drivers)
dev_id pointer (installing shared handlers), 278
dev_kfree_skb function, 524, 531
dev_mc_list structure, 538
DEVPATH variable, 399
dev_t i_rdev (inode structure field), 55
direct I/O, 435-440
implementation, 460
(see also I/O)
direct memory access (see DMA)
directories
/dev, 43
entries (file structure), 54
of kernel headers, 19
misc-progs source, 77, 162
/proc file hierarchy connections, 86
/proc/tty/driver, 547
sysfs
low-level operations, 371-375
tty driver, 552
USB, 333-335
tty drivers, 566
*dir_notify method, 52
disable_dma function, 458
disable_irq function, 279
disabling
interrupt handlers, 273
packet transmissions, 518
print statements, 79
disclosure of data, 9
disconnect function (USB), 349, 353
disks
files versus open files, 53
freeing, 468
registration, 466
distribution, writing drivers for, 28
DMA (direct memory access), 440-459, 461
block requests and, 489
configuring controller, 456-459
for ISA memory, 454-459
mappings (scatter-gather), 450
PCI devices and, 453
registering usage, 455
ring buffers, 441
dma_addr_t setup_dma field (USB), 338
dma_addr_t transfer_dma field (USB), 338
DMA_BIDIRECTIONAL symbol, 448, 461
DMAC (DMA controller), 454
DMA-capable memory zone, 215
SLAB_CACHE_DMA flag and, 218
dma_free_coherent function, 447
DMA_FROM_DEVICE symbol, 448, 461
dma.h header file, 455
DMA_NONE symbol, 448, 461
dma_spin_lock, 457
DMA_TO_DEVICE symbol, 448, 461
dmesg command, 77
do_close function, 556
do_gettimeofday function, 188
do_ioctl method, 513, 535
do_IRQ function, 268
do-it-yourself probing, 266
double underscore (_ _) functions, 22
double-address cycle mappings (PCI), 452
doubly linked lists (portability), 299, 300
down function, 111
DRIVER_ATTR macro, 386
drivers
adding, 396
asynchronous notification and, 170
attributes, 386
block (see block drivers)
char (see char drivers)
command-oriented, 146
configuring, 35-37
deleting, 396
devices, 385
file operations, 49
FireWire, 7
functions, 409
I2O, 7
ioctl numbers for, 137
iteration, 379
lddbus, 379
mechanism, 42
policy versus, 2
separation from policies, 2-4
modules, 7
monitoring with preprocessor, 79-81
network, 497
connecting to kernels, 502-514
functions, 542-545
interrupt handlers for, 523
ioctl commands, 535
link state (changes in), 528
MAC addresses (resolution of), 532-534
multicasting, 537-540
opening, 515-516
snull, 498-502
statistics, 536
sbull
initialization, 468
request method, 475
SCSI, 7
scull (see scull)
scullc (example), 219
scullp (example), 223
scullv (example), 227, 233
security issues, 8
short (example), 246
accessing I/O memory, 252
implementing interrupt handlers, 270
installing interrupt handlers, 261
probing, 266
shortprint, 282-286
structures (embedding), 386
tty, 546-550
buffers, 558
directories, 566
functions, 573
line settings, 560-566
pointers, 553-560
struct termios, 550-553
tty_driver structure, 567
tty_operations structure, 569
tty_struct structure, 571
USB (see USB)
user-space, 37
version (see versions, numbering)
driver_unregister function, 397
dynamic devices, 397
Dynamic Probes debugging tool, 105
E[ Top ]
EBUSY error, 176
EISA (Extended ISA), 323
elevators (I/O), 478
elv_next_request function, 476, 479, 492
embedding
device structures, 383
driver structures, 386
kobjects, 365
enable_dma function, 458
enable_irq function, 279
enabling
configuration for kernels, 73-75
interrupt handlers, 273
PCI drivers, 314
endless loops, preventing, 97
end-of-file
poll method and, 165
seeking relative to, 172
endpoints
interfaces, 331
USB, 328
entropy pool and SA_SAMPLE_RANDOM flag, 260
errno.h header file, 33
error handling during initialization, 32
errors
buffer overrun, 95
codes, 33
handling at module initialization, 32-35
read/write, 65
values (pointers), 295
(see also troubleshooting)
/etc/networks file, 500
/etc/syslog.conf file, 79
ETH_ALEN macro, 515
Ethernet
address resolution, 532
ARP and, 532
non-Ethernet headers, 534
non-Ethernet interfaces, 507
snull interfaces, 501
ether_setup function, 504, 507-514
eth_header method, 512
Ethtool, 541
events
hotplug, 375
race conditions, 107
exclusive waits, 159
execution
asynchronous (interrupt mode), 197
of code (delaying), 190-196, 209
modes, 20
shared interrupt handlers, 279
threads, 109
experimental kernels, 10
exporting symbols, 28-29
EXPORT_SYMBOL macro, 32, 41
EXPORT_SYMBOL_GPL macro, 41
extended buses, 325
Extended ISA (EISA), 323
F[ Top ]
fast interrupt handlers, 268
FASYNC flag, 52, 169
fasync method, 52
fasync_helper function, 170, 182
fasync_struct structure, 170
faults, 19, 93-98
faulty module (oops messages), 94
faulty_read function, 96
faulty_write function, 96
fcntl system call, 141, 169
fcntl.h header file, 151
fc_setup function, 507
fdatasync system call, 167
FDDI networks, configuring interfaces, 507
fddi_setup function, 507
f_dentry pointer, 54
f_flags field (file structure), 54
O_NONBLOCK flag, 141, 151
fiber channel devices, initializing, 507
FIFO (first-in-first-out) devices, 43
poll method and, 165
File System header (fs.h), 71
file_operations structure, 49, 54
declaring using tagged initialization, 53
mmap method and, 424
files
access to, 173-179
capability.h header file, 144, 181
devices, 43
/etc/networks, 500
flags, 54
inode structure, 55
interrupts, 262
ioctl. header file, 179
kmsg, 78
ksyms, 32
modes, 53
net_int c, 507
open, 53
operations, 49-53
poll.h header file, 163, 182
/proc, 84
stat, 263
structure, 53
structures, 49
uaccess.h header file, 180
filesystems, 4
char drivers, 43-49
modules, 8
nodes, 4, 7
/proc, 86-90
installing interrupt handlers, 262
shared interrupts and, 280
sysfs, 409
filp pointer, 53
in ioctl method, 136
in read/write methods, 63
filp->f_op, 54
filter hotplug operation, 376
fine-grained locking, 122
FIOASYNC command, 141
FIOCLEX command, 141
FIONBIO command, 141
FIONCLEX command, 141
FIOQSIZE command, 141
FireWire, 400
drivers, 7
firmware
calling, 407
functions, 411
interfaces, 405
Linux device model, 405-407
PCI boot time configuration, 307
first-in-first-out (FIFO) devices (see FIFO devices)
flags
argument, 213
FASYNC, 169
file, 54
GFP_ATOMIC, 214, 222
GFP_COLD, 215
GFP_DMA, 215
GFP_HIGH, 215
GFP_HIGHMEM, 215
GFP_HIGHUSER, 214
GFP_KERNEL, 221
GFP_NOFAIL, 215
GFP_NOFS, 214
GFP_NOIO, 215
GFP_NORETRY, 215
GFP_NOWARN, 215
GFP_REPEAT, 215
GFP_USER, 214
GTP_KERNEL, 214
IFF_ALLMULTI, 509
IFF_AUTOMEDIA, 510
IFF_BROADCAST, 509
IFF_DEBUG, 509
IFF_DYNAMIC, 510
IFF_LOOPBACK, 509
IFF_MASTER, 510
IFF_MULTICAST, 509
IFF_NOARP, 504, 509
IFF_NOTRAILERS, 510
IFF_POINTTOPOINT, 509
IFF_PORTSEL, 510
IFF_PROMISC, 509
IFF_RUNNING, 510
IFF_SLAVE, 510
IFF_UP, 509
media_change, 473
memory allocation, 215, 218, 231
for net_device structure, 509
O_NONBLOCK (f_flags field), 166
PACKET_HOST, 530
PG_locked, 417
POLLERR, 164
POLLHUP, 164
POLLIN, 164
POLLOUT, 164
POLLPRI, 164
POLLRDBAND, 164
POLLRDNORM, 164
POLLWRBAND, 164
POLLWRNORM, 164
resource (PCI), 317
SA_INTERRUPT, 260, 286
SA_SAMPLE_RANDOM, 260
SA_SHIRQ, 260, 278
SLAB_CACHE_DMA, 218
SLAB_CTOR_CONSTRUCTOR, 218
SLAB_HWCACHE_ALIGN, 218
SLAB_NO_REAP, 218
TTY_DRIVER_NO_DEVFS, 553
TTY_DRIVER_REAL_RAW, 553
TTY_DRIVER_RESET_TERMIOS, 552
VM_IO, 421
Wall, 291
flips (tty drivers), 559
flow of data (tty drivers), 556
flush method, 51
close system call and, 60
flush operation, 51
flushing pending output, 167
f_mode field (file structure), 53
fonts (incorrect on console), 147
f_op pointer, 54
fops pointers, 49
forms (BCD), 346
f_pos field (file structure), 54
read_proc function and, 84
fragmentation, 442
free command, 70
free_dma function, 455
freeing
buffers, 531
device numbers, 45
disks, 468
DMA pools, 447
semaphores, 111
free_irq function, 279
free_netdev functions, 505
free_pages function, 222
F_SETFL command, 141
fcntl system call and, 169
F_SETFL fcntl command, 169
F_SETOWN command, 169
fcntl system call and, 169
fs.h header file, 71, 179
asynchronous notification and, 170
blocking/nonblocking operations, 151
fsync method, 51, 167
full class interfaces, 389
functions
access_ok, 142
alloc_netdev, 504
alloc_skb, 530
alloc_tty_driver, 549
blk_cleanup_queue, 479
blkdev_dequeue_request, 479
blk_queue_hardsect_size, 470
blk_queue_segment_boundary, 481
block drivers, 494-496
bus_add_driver, 396
buses, 409
bus_for_each_dev, 380
bus_register, 378
calling from modules/applications, 18
capable, 145, 181
chars_in_buffer, 558
claim_dma_lock, 457
classes, 410
class_simple_create, 404
class_simple_device_add, 404
class_simple_device_remove, 405
cleanup, 32
clear_dma_ff, 458
close (tty drivers), 553-556
complete (urbs), 345
const char *dev_name, 260
const char *name, 348
const struct usb_device_id*id_table, 348
constructor (kmem_cache_create), 218
create_proc_read_entry, 86
del_timer_sync, 200
dev_alloc_skb, 530
devices, 409
dev_kfree_skb, 524, 531
disable_dma, 458
disable_irq, 279
disconnect (USB), 349, 353
dma_free_coherent, 447
do_close, 556
do_gettimeofday, 188
do_IRQ, 268
double underscore (_ _), 22
down, 111
drivers, 409
driver_unregister, 397
elv_next_request, 476, 479, 492
enable_dma, 458
enable_irq, 279
ether_setup, 504, 507-514
fasync_helper, 170, 182
faulty_read, 96
faulty_write, 96
fc_setup, 507
fddi_setup, 507
firmware, 411
free_dma, 455
free_irq, 279
free_netdev, 505
free_pages, 222
get_cycles, 187
get_dma_residue, 458
get_fast_time, 189
get_free_page, 221
get_free_pages, 214, 221, 225
get_page, 427
get_unaligned, 293
get_user, 143, 180
get_user_pages, 435
get_zeroed_page, 221
handle_IRQ_event, 269
hello world module, 16
hippi_setup, 508
in_atomic, 198
inb, 240
inb_p, 242
in_interrupt, 198
initialization, 31-35
inl, 240
insb, 242
inserting schedules, 97
insl, 242
insw, 242
int pci_enable_device, 314
int printk_ratelimit(void), 81
int seq_escape, 88
int seq_path, 89
int seq_printf, 88
int seq_putc, 88
int seq_puts, 88
int (USB), 348
inw, 240
ioctl (tty drivers), 564
ioremap, 226, 249, 256
ioremap_nocache, 250
iounmap, 225, 250
irqreturn_t, 260
isa_readb, 254
kfree_skb, 531
kill_fasync, 170, 182
kmalloc, 61
allocation engine, 213-217
performance degradation issues, 222
kmap, 418
kmap_skb_frag, 532
kmem_cache_alloc, 218
kmem_cache_create, 217
kmem_cache_t type, 217
list_add, 297
list_add_tail, 297
list_del, 297
list_empty, 297
list_move, 297
list_splice, 297
locking, 121
match (buses), 379
mod_timer, 200, 202
module_init, 31
netif_carrier_off, 528
netif_carrier_ok, 528
netif_carrier_on, 528
netif_start_queue, 515
netif_stop_queue, 516, 518
netif_wake_queue, 518
network drivers, 542-545
open (tty drivers), 553-556
outb, 240
outb_p, 242
outl, 240
outsb, 242
outsl, 242
outsw, 242
outw, 240
page-oriented allocation, 221, 233
pci_map-sg, 451
pci_remove_bus_device, 395
pci_resource_, 317
pfn_to_page, 417
poll_wait, 163, 182
printk, 17, 76-82
circular buffers for, 78
logging messages from, 78
seq_file interface (avoiding in), 88
turning debug messages on/off, 79
probe (USB), 350
probe_irq_off, 265
probe_irq_on, 265
put_unaligned, 293
put_user, 143, 180
queues, 479
rdtscl, 187
read (tty drivers), 558
read_proc, 85
register_blkdev, 465
register_chrdev, 404
register_netdev, 503
relaease_dma_lock, 457
release (kobjects), 367
remap_pfn_range, 424
remove_proc_entry, 86
request (block drivers), 474-491
request_dma, 455
request_firmware, 406
SAK, 97
sbull_request, 469
schedule, 181
execution of code (delaying), 193
preventing endless loops with, 97
schedule_timeout, 194
scull
open method, 58-59
release method, 59
scull_cleanup, 179
scull_getwritespace, 158
semaphores (see semaphores)
set_dma_addr, 457
set_dma_count, 457
set_dma_mode, 457
set_mb, 238
set_multicast_list, 539
set_rmb, 238
set_termios, 560
set_wmb, 238
sg_dma_address, 462
sg_dma_len, 462
show, 386
skb_headlen, 532
skb_headroom, 531
skb_is_nonlinear, 532
skb_pull, 532
skb_push, 531
skb_put, 531
skb_reserve, 531
skb_tailroom, 531
sleep_on, 162
acting on socket buffers, 530
spinlocks, 119
struct module *owner, 348
sysfs filesystem, 409
sys_syslog, 77
tasklet_schedule, 276
tiny_close, 556
tiocmget, 562
tiomset, 562
tr_configure, 508
tty drivers, 573
tty_driver (pointers), 553-560
tty_get_baud_rate, 562
tty_register_driver, 549
unregister_netdev, 505
unsigned int irq, 260
unsigned long flags, 260
unsigned long pci_resource_end, 317
unsigned long pci_resource_start, 317
unsigned pci_resource_flags, 317
up, 111
urbs_completion, 345
usb_alloc_urb, 342
usb_bulk_msg, 356
usb_control_msg, 357
usb_fill_bulk_urb, 343
usb_fill_control_urb, 343
usb_fill_int_urb, 342
usb_get_descriptor, 358
usb_kill_urb, 345
usb_register_dev, 352
usb_set_intfdata, 351
usb_string, 359
usb_submit_urb, 344
usb_unlink_urb, 345
vfree, 225
virt_to_page, 417
vmalloc allocation, 224-228
void, 348
void barrier, 237
void blk_queue_bounce_limit, 480
void blk_queue_dma_alignment, 481
void blk_queue_hardsect_size, 481
void blk_queue_max_hw_segments, 480
void blk_queue_max_phys_segments, 480
void blk_queue_max_sectors, 480
void blk_queue_max_segment_size, 480
void blk_start_queue, 480
void blk_stop_queue, 480
void mb, 237
void read_barrier_depends, 237
void rmb, 237
void smp_mb, 238
void smp_rmb, 238
void smp_wmb, 238
void tasklet_disable, 204
void tasklet_disable_nosync, 204
void tasklet_enable, 204
void tasklet_hi_schedule, 204
void tasklet_kill, 204
void tasklet_schedule, 204
void wmb, 237
void*dev_id, 260
wait_event_interruptible_timeout, 194
wake-up, 150, 181
wake_up, 159, 181
wake_up_interruptible, 181
wake_up_interruptible_sync, 181
wake_up_sync, 181
workqueues, 206
write (tty drivers), 556
xmit_lock, 514
G[ Top ]
gcc compiler, 188
gdb commands, 99, 103
gendisk structure, 467
general distribution, writing drivers for, 28
General Public License (GPL), 11
generic DMA layers, 444
generic I/O address spaces, 316
geographical addressing, 305
get_cycles function, 187
get_dma_residue function, 458
get_fast_time function, 189
get_free_page function, 221
get_free_pages function, 214, 221, 225
get_kernel_syms system call, 25
get_page function, 427
get_stats method, 512, 536
get_unaligned function, 293
get_user function, 143, 180
get_user_pages function, 435
get_zeroed_page function, 221
GFP_ATOMIC flag, 214
page-oriented allocation functions, 221
preparing for allocation failure, 222
GFP_COLD flag, 215
GFP_DMA flag, 215
gfp.h header file, 214
GFP_HIGH flag, 215
GFP_HIGHMEM flag, 215
GFP_HIGHUSER flag, 214
GFP_KERNEL flag, 214, 221
GFP_NOFAIL flag, 215
GFP_NOFS flag, 214
GFP_NOIO flag, 215
GFP_NORETRY flag, 215
GFP_NOWARN flag, 215
GFP_REPEAT flag, 215
GFP_USER flag, 214
global information (net_device structure), 506
global memory areas, 43
global messages (enabling/disabling), 79
GNU General Public License (GPL), 11
goto statement, 33
GPL (GNU General Public License), 11
group, device, 47
H[ Top ]
hacking kernels options, 73-75
handle_IRQ_event function, 269
hangs (system), 96-98
hard_header method, 512, 532
hard_start_transmit method, 516
hard_start_xmit method, 512, 517
hardware
addresses, 508
assignment of, 515
modification of, 513
DMA, 440, 444
headers, 533
adding before transmitting packets, 531
building, 512
encapsulating information, 534
ioctl method, 135-147
ISA, 320
management, 235-254, 255
net_device structure, 506
PCI (abstractions), 318
removable media (supporting), 472
header_cache method, 513
header_cache_update method, 514
headers
Ethernet (see Ethernet)
files, 19, 29
hardware, 533
non-Ethernet, 534
hello world module, 16-18
hierarchies
kobjects, 368
ksets, 370
/proc file connections, 86
(see also filesystems)
high memory, 216, 415
HIPPI drivers, preparing fields for, 508
hippi_setup function, 508
hostnames (snull interfaces), 500
hotplugs
devices, 362
events, 375
Linux device model, 397-405
scripts, 403
hubs (USB), 334
hung system, 96
hyperthreaded processors, avoiding deadlocks, 117
HZ (time frequency) symbol, 183, 292
I[ Top ]
I2O drivers, 7
IA-64 architecture
porting and, 243
/proc/interrupts file, snapshot of, 263
IEEE1394 bus (Firewire), 400
ifconfig command
net_device structure and, 506
opening network drivers, 515-516
snull interfaces, 501
IFF_ symbols, 509, 538
IFF_ALLMULTI flag, 509
IFF_AUTOMEDIA flag, 510
IFF_BROADCAST flag, 509
IFF_DEBUG flag, 509
IFF_DYNAMIC flag, 510
IFF_LOOPBACK flag, 509
IFF_MASTER flag, 510
IFF_MULTICAST flag, 509
IFF_NOARP flag, 504, 509
IFF_NOTRAILERS flag, 510
IFF_POINTOPOINT flag, 509
IFF_PORTSEL flag, 510
IFF_PROMISC flag, 509
IFF_RUNNING flag, 510
IFF_SLAVE flag, 510
IFF_UP flag, 509
if.h header file, 509, 535
ifreq structure, 535
implementation
asynchronous I/O, 437
busy-waiting, 190
of classes, 5
of debugging levels, 81
direct I/O, 460
of files in /proc filesystems, 84
interrupt handlers, 269-275
ioctl commands, 145
ISA (PCI), 319-322
llseek method, 171
mmap, 412-416, 460
multicasting, 539
of policies, 3
removable media (supporting), 472
semaphores, 110-114
timers, 201
in_atomic function, 198
inb function, 240
inb_p function, 242
infinite loops, preventing, 97
information leakage, 9
in_interrupt function, 198
init scripts and loading/unloading modules, 48
init.h header file, 39
initialization
completions (semaphores), 115
devices, 503
gendisk structure, 468
interrupt handlers, 261
kobjects, 366
modules, 31-35
mutexes, 110
net_device structure, 503
PCI, 306
reader/writer semaphores, 113
registers (PCI), 308
sbull drivers, 468
seqlocks, 128
struct usb_driver structure, 349
structures (registration), 55-57
INIT_LIST_HEAD macro, 296
inl function, 240
inline assembly code (example), 187
inode pointer in ioctl method, 136
inode structure, 55
input devices (hotplugging), 401
input files, enabling asynchronous notification from, 169
input module, 28
input pins, 235, 245
reading values from parallel port, 248
insb function, 242
insl function, 242
insmod program, 5, 17, 25
assigning parameter values, 36
dynamically allocating major numbers, 48
modprobe program versus, 29
testing modules using, 17
installation
interrupt handlers, 259-269, 278
mainline kernels, 15
insw function, 242
int actual_length field (USB), 339
int data type, 289
int error_count field (USB), 341
int field
net_device structure, 506
PCI registration, 312
int flags field (gendisk), 467
int function (USB), 348
int interval field (USB), 341
int major field (gendisk), 467
int minor field (USB), 332
int minor_base variable (USB), 353
int minors field (gendisk), 467
int number_of_packets field (USB), 341
int pci_enable_device function, 314
int printk_ratelimit(void) function, 81
int seq_escape function, 88
int seq_path function, 89
int seq_printf function, 88
int seq_putc function, 88
int seq_puts function, 88
int start_frame field (USB), 341
int status field (USB), 339
int transfer_buffer_length field (USB), 338
interactive kernel debugger (kdb), 101-103
INTERFACE variable, 401
interfaces
alloc_pages, 223
block drivers
command pre-preparation, 491
functions, 494-496
operations, 471-474
registration, 465-470
request processing, 474-491
TCQ, 492-493
classes, 391
class_simple, 388
cleanup function, 32
configuration (USB), 332
firmware, 405
flags for net_device structure, 509
full class, 389
interface-specific data types, 291
ksets, 370
loopback, 498
MII, 540
networks, 7
non-Ethernet, 507
older
char device registration, 57
/proc file implementation, 85
parallel ports (see parallel ports)
PCI, 302-319
reader/writer semaphores, 114
seq_file, 87-90
snull, 498-502
spinlocks, 117
timers, 198
USB, 331
version dependency, 26
VLB, 323
interface-specific data types, 291
internal functions (locking), 121
internal representation of device numbers, 44
Internet protocol (IP), 498
interrupt handlers
autodetecting IRQ numbers, 264
sharing interrupts, 281
interrupt mode
and asynchronous execution, 197
tasklets, 202-204
interrupt request lines (see IRQs)
interruptible sleeps, 157
interrupts
counts, 566
file, 262
handlers
implementation of, 269-275
installation of, 259-269
I/O, 281-286
management, 286
for network drivers, 523
preparing parallel ports, 259
/proc files for, 262
registration, 286
sharing, 278-281
tasklets, 276
top and bottom halves, 275-278
installation at, 261
mitigation of, 525
for network drivers, 523
PCI, 317
reports, 261
shared interrupts and, 280
timers, 183
tty drivers, 556
urbs, 342
intervals of time (data type portability), 292
intptr_t type (C99 standard), 289
inw function, 240
I/O, 167
asynchronous, 437-440
blocking, 147-162
direct, 435-440, 460
flushing pending, 167
generic address spaces, 316
hardware management, 235-254
interrupt handlers, 281-286
mapping, 249, 255
memory (access), 249
pausing, 242
PCI, 305, 316
regions, 429
registers, 236
scatter/gather, 520
schedulers, 478
string operations, 241
transferring data with DMA, 440-459
I/O Memory Management Unit (see IOMMU)
I/O ports, parallel (see parallel ports)
I/O registers versus RAM, 236
_IOC_DIRBITS macro, 180
_IOC_NRBITS macro, 180
_IOC_SIZEBITS macro, 180
_IOC_TYPEBITS macro, 180
ioctl commands (creating), 180
ioctl function (tty drivers), 564
ioctl method, 51, 135-147
using bitfields to define commands, 137
block drivers, 473
controlling devices without, 146
customizing for networking, 535
debugging with, 90
network devices and, 513
TIOCLINUX command, 77
ioctl.h header file, 137, 179
setting up command numbers, 138
ioctl-number.txt file, 137
IOMMU (I/O memory management unit), 413, 445
ioremap function, 226, 249, 256
ioremap, 225
ioremap_nocache function, 250
iounmap function, 225, 250
IP (Internet protocol), 498
IP numbers, resolving to physical addresses, 532
ip_summed field (sk_buff), 522, 530
irq argument (interrupt number), 260
irq.h header file, 267
irqreturn_t function, 260
IRQs (interrupt request lines)
autodetecting, 264
statistics on, 263
ISA
bus master DMA, 454
devices, DMA for, 454-459
I/O (pausing devices), 242
memory (access), 253
below IMB, 252-254
DMA for, 454-459
PCI, 319-322
isa_readb function, 254
ISOCHRONOUS endpoints (USB), 330
isochronous urbs (USB), 344
iteration of buses, 379
J[ Top ]
jiffies
in busy-waiting implementation, 191
counters, 184
no solution for short delays, 195
values, 184, 514
jit (just in time) module
current time (retrieving), 189
delaying code execution, 191
jitbusy program, 191
joysticks (hotplugging), 401
just in time (jit) module (see jit module)
K[ Top ]
kcore file, 99
kdataalign program, 294
kdatasize module, 289
kdb kernel debugger, 101-103
KERN_ALERT macro, 76
KERN_CRIT macro, 76
KERN_DEBUG macro, 76
kernel-assisted probing, 265
kernels
applications (comparisons to), 18-22
capabilities and restricted operations, 144
code requirements, 30
concurrency, 20
adding locking, 109
alternatives to locking, 123-130
locking traps, 121-123
management of, 107-109
semaphore completion, 114-116
semaphore implementation, 110-114
current process and, 21
data structures, 49
data types in
assigning explicit sizes to, 290
interface-specific, 291
linked lists, 295-299
portability, 292-295
standard C types, 288
debuggers, 99-105
development community, joining, 12
developmental (experimental), 10
exclusive waits, 160
filesystem modules, 8
handling system faults (see system faults)
headers, 19
inode structure, 55
interrupts
implementing handlers, 269-275
installing handlers, 259-269
introduction to, 1
kgdb patch and, 103
linked lists, 295-299
Linux device model, 362-364
buses, 377-381
classes, 387-391
devices, 381-387
firmware, 405-407
hotplugging, 375, 397-405
kobjects, 364-371
lifecycles, 391-397
low-level sysfs operations, 371-375
loading modules into (see loading, modules)
logical addresses, 413
mainline (installation of), 15
messages, 18
modules
loading, 25-28
unloading, 25
monitoring, 91
multicasting support, 538
network driver connections, 502-514
platform dependency, 27
printing, 75-82
querying, 82-91
security, 8
sources, 575
space, 19
splitting role of, 4-5
support, 73-75
symbols, 28-29
system hangs, 96
tasklets, 202-204, 211
test system setup, 15
time, 208
measurement of lapses, 183-188
retrieving current time, 188-190
timers, 196-202, 210
USB
sysfs directory trees, 333-335
transfers without urbs, 356-359
urbs, 335-346
writing, 346-355
versions
dependency, 26
numbering, 10-11
viewing, 5
virtual addresses, 414, 434
VMAs, 419-422
workqueues, 205-208, 211
(see also modules)
kernel_ulong_t driver_info field (USB), 347
KERNEL_VERSION macro, 27
KERN_EMERG macro, 76
KERN_ERR macro, 76
KERN_INFO macro, 76
KERN_NOTICE macro, 76
KERN_WARNING macro, 76
keyboards
debugging when locked, 97
hotplugging, 401
keys (magic SysRq), 97
kfree, 61
kfree_skb function, 531
kgdb patch, 103
kill_fasync function, 170, 182
killing urbs, 345
klogd daemon, 17, 77
logging messages, 78, 79
kmalloc
flags argument, 213
returning virtual addresses, 225
versus vmalloc, 225
kmalloc function, 61
allocation engine, 213-217
performance degradation issues, 222
kmap function, 418
kmap_skb_frag function, 532
kmem_cache_alloc function, 218
kmem_cache_create function, 217
kmem_cache_t type function, 217
kmsg file, 78
kobjects, 364-371
hotplug event generation, 375
low-level sysfs operations, 371-375
nondefault attributes, 373
release functions, 367
store method, 373
symbolic links, 375
kset_hotplug_ops structure, 376
ksets, 368
operations on, 370
subsystems, 370
ksyms file, 32
L[ Top ]
lapses of time, measurement of, 183-188
laptop docking stations, 402
large buffers, obtaining, 230, 234
large file implementations (/proc files), 87
layers
generic DMA, 444
modularization, 28
lddbus driver, 379
ldd_driver structure, 386
LEDs, soldering to output pins, 247
levels
CPU (modalities), 20
debugging, 81
message priority (see loglevels)
libraries, 19
license terms, 11
lifecycles
Linux device model, 391-397
objects, 363
urbs, 335
limitations of debug messages (prink function), 81
line settings (tty drivers), 560-566
line status register (LSR), 564
link state (changes in), 528
linked lists, 295-299
traversal of, 298
linking libraries, 18
links (symbolic), 375
Linux
license terms, 11
version numbering, 10
Linux device model, 362-364
buses, 377-381
classes, 387-391
devices, 381-387
firmware, 405-407
hotplugging, 397-405
kobjects, 364-371
hotplug events, 375
low-level sysfs operations, 371-375
lifecycles, 391-397
Linux Documentation Project web site, 576
Linux Trace Toolkit (LTT), 105
linux-kernel mailing list, 12, 299
LINUX_VERSION_CODE macro, 27, 40
list_add function, 297
list_add_tail function, 297
list_del function, 297
list_empty function, 297
list_entry macro, 297
list_for_each macro, 299
list.h header file, 299
list_head data structure, 299
list_move function, 297
lists, linked, 295-299
lists (PCI), 326
list_splice function, 297
little-endian byte order, 293
llseek method, 50, 171
loadable modules, 5
loading
attribute (firmware), 407
drivers, 46
modules, 25-28
dynamically assigned device numbers, 47
parameters, 35-37
races, 35
local0 (IP number), 499
LocalTalk devices, setting up fields for, 507
lock method, 52
locked keyboard (debugging), 97
lock-free algorithms, 123
locking, 108
adding, 109
alternatives to, 123-130
atomic variables, 124
rules for, 122
seqlocks, 127
traps, 121-123
lockmeter tool, 123
loff_t f_pos (struct file field), 54
loff_t (long offset), 50, 54
LOG_BUF_LEN circular buffer, 78
logging messages (printk function), 78
logical addresses, 413
logical units (USB), 332
login process, 173
loglevels, 76
message priorities, 17
long data type, 289
long delays (of code execution), 190
lookaside caches, 217-224, 232
loopback interfaces, 498
loops
busy, 191
endless, 97
software, 195
loops_per_jiffy value, 196
low memory, 415
low-level sysfs operations, 371-375
ls command, identifying device type, 43
LSR (line status register), 564
ltalk_setup, 507
ltalk_setup function, 507
LTT (Linux Trace Toolkit), 105
M[ Top ]
M68k architecture (porting and), 243
MAC (medium access control) addresses, 504, 508
resolution of, 532-534
set_mac_address method and, 513
macros
BUS_ATTR, 380
completion, 115
DECLARE_TASKLET, 276
DIVER_ATTR, 386
hello world module, 16
INIT_LIST_HEAD, 296
internal representation of device numbers, 44
ioctl commands (creating), 180
KERN_ALERT, 76
KERN_CRIT, 76
KERN_DEBUG, 76
KERN_EMERG, 76
KERN_ERR, 76
KERN_INFO, 76
KERN_NOTICE, 76
KERN_WARNING, 76
list_entry, 297
list_for_each, 299
MINOR, 71
MODULE_DEVICE_TABLE, 311
page_address, 417
PAGE_SHIFT, 415
PCI_DEVICE, 310
PCI_DEVICE_CLASS, 310
RELEVANT_IFLAG, 560
sg_dma_address, 451
sg_dma_len, 451
symbols, 29
UBS_DEVICE_VER, 347
USB_DEVICE, 347
USB_DEVICE_INFO, 347
USB_INTERFACE_INFO, 347
version dependency, 26
wait queues, 156
wait-event, 149
magic SysRq key, 97
mailing list, linux-kernel, 12
mainline kernels, installation of, 15
major device numbers, 44
dynamic allocation of, 46-49
MAJOR macro, 71
major numbers
char drivers, 43-49
dynamic allocation of, 46
make command, 24
makefiles, 24
printk function, 80
management, 4
classes, 389
concurrency, 107-109
alternatives to locking, 123-130
locking traps, 121-123
fragmentation, 442
hardware (I/O ports and I/O memory), 235-254
interrupt handlers, 286
memory, 4, 412-416
direct I/O, 435-440
DMA, 440-459, 461
mapping, 416-418
mmap device operations, 422-434
page tables, 418
process memory maps, 422
scull, 60-63, 107
VMAs, 419-422
networks, 5
physical memory, 216
power, 362
process, 4
security, 8
tasklets, 202-204
manual sleeps, 156
mapper program, 430
mapping
deleting, 448
DMA, 445
I/O, 249, 255
memory, 416-418
mmap device operations, 422-434
process memory maps, 422
PCI double-address cycle, 452
registers, 445, 450
scatter-gather DMA, 450
scatterlists and, 450
single-page streaming, 450
software-mapped memory, 250
streaming DMA configuration, 448
video memory, 423
match function (buses), 379
MCA (Micro Channel Architecture), 322
mdelay, 196
measurement of time lapses, 183-188
Media Independent Interface (MII), 540
media_changed method, 472
medium access control addresses (see MAC addresses)
memory
allocation, 60-62
boot time, 230, 234
flags, 215, 218, 231
I/O, 249, 255
kmalloc allocation engine, 213-217
lookaside caches, 217-224, 232
by page, 221
per-CPU variables, 228-230
performance degradation issues, 222
vmalloc allocation function, 224-228
barriers, 237, 238, 255
block drivers, 468
DMA (see DMA)
global areas, 43
hardware, 506
high, 415
I/O, 235-254, 255
ISA
access, 253
memory range, 252-254
limitations on, 415
locking, 109
low, 415
management, 4, 412-416
direct I/O, 435-440
DMA, 440-459, 461
fragmentation, 442
mapping, 416-418
mmap device operations, 422-434
page tables, 418
process memory maps, 422
VMAs, 419-422
modules (loading), 25
page size and portability, 292
PCI, 305, 316
persistence, 43
pools, 220, 232
remapping RAM, 430
scull
design of, 43
troubleshooting, 107
usage, 60-63
software-mapped (and ioremap function), 250
user space, 437
verifying user-space addresses, 142
versus I/O registers, 236
zones, 215
memory management
DMA, 440-459
theory of, 422
VMAs, 422
messages
consoles, 77
debug
disabling, 79
limitation of (printk function), 81
globally enabling/disabling, 79
kernels, 18
logging, 78
oops, 94-96
priorities (loglevels) of, 17, 76
methods, 88
block_fsync, 167
buses, 379
change_mtu, 513
check_flags, 52
close, 59, 421
devices, 511
*dir_notify, 52
do_ioctl, 513, 535
fasync, 52
flush, 51, 60
fsync, 51, 167
get_stats, 512, 536
hard_header, 512, 532
hard_start_transmit, 516
hard_start_xmit, 512, 517
header_cache, 513
header_cache_update, 514
ioctl, 51, 135-147
block drivers, 473
customizing for networking, 535
debugging with, 90
inode pointer in, 136
llseek, 50, 171
lock, 52
media_changed, 472
mmap, 51
next, 87
nopage, 422, 427, 431
open, 51, 58-59
block drivers, 471
blocking, 176
for network devices, 511
private_data and, 54
requesting DMA channels, 455
restricting simultaneous users and, 175
for single-open devices, 174
vm_operations_struct structure, 421
operations
aio_fsync, 438
atomic_add, 125
atomic_dec, 125
atomic_dec_and_test, 125
atomic_inc, 125
atomic_inc_and_test, 125
atomic_read, 125
atomic_set, 125
atomic_sub, 125
atomic_sub_and_test, 125
bit, 126
block drivers, 466
blocking/nonblocking, 151
change_bit, 126
clear_bit, 126
devices, 513
files, 49-53
filter hotplug, 376
flush, 51
hotplugs, 376
mmap devices, 422-434
set_bit, 126
spinlocks, 120
string, 241, 255
sysrq, 98
test_and_change_bit, 127
test_and_clear_bit, 127
test_and_set_bit, 127
test_bit, 127
vector, 69
poll, 51, 163-169, 513
poll_controller, 542
populate, 422
pread, 65
proc_read, 84
pwrite, 65
read, 50, 63-69
arguments to, 65
code for, 67
configuring DMA controllers, 456
f_pso field (file structure) and, 54
oops messages, 95
poll method and, 166
rules for interpreting return values, 66
strace command and, 92
readdir, 50
readv, 52
rebuild_header, 512
release, 51, 59
block drivers, 471
blocking, 176
cloning devices, 179
kobjects, 367
revalidate, 473
sbull ioctl, 473
select, 163-169
select, poll method and, 51
set_config, 512
set_mac_address, 513
set_multicast_list, 510, 513, 538
show
kobjects, 373
seq_file interface, 88
start, 87
stop, 512
store (kobjects), 373
strace command and, 92
struct module *owner, 50
tx_timeout, 512
unsigned long, 52
write, 50, 63-69
code for, 68
f_pos field (file structure) and, 54
interpreting rules for return values, 68
oops messages, 94
poll method and, 166
writev, 52, 69
mice
asynchronous notification, 170
hotplugging, 401
Micro Channel Architecture (MCA), 322
microsecond resolution, 189
MII (Media Independent Interface), 540
minor device numbers, 44
MINOR macro, 71
minor numbers, char drivers, 43-49
MIPS processor
inline assembly code and, 187
porting and, 243
misc-progs directory, 77, 162
mitigation of interrupts, 525
MKDEV macro, 71
mlock system call, 39
mmap
device operations, 422-434
implementation, 412-416, 460
(see also memory management)
mmap method, 51
usage count and, 426
vm_area_struct structure and, 420
modalities (levels), CPU, 20
models (Linux device), 362-364
buses, 377-381
classes, 387-391
devices, 381-387
firmware, 405-407
hotplugging, 375, 397-405
kobjects, 364-371
lifecycles, 391-397
low-level sysfs operations, 371-375
modes
device modes, 47
file modes, 53
interrupt
asynchronous execution, 197
tasklets, 202-204
mode_t f_mode (struct file field), 53
mode_t mode variable (USB), 353
modprobe utility, 25, 29
assigning parameter values, 36
insmod program versus, 29
mod_timer function, 200, 202
modularization, layered, 28
MODULE_ALIAS macro, 41
MODULE_AUTHOR macro, 41
MODULE_DESCRIPTION macro, 41
MODULE_DEVICE_TABLE macro, 41, 311
module.h header file, 40
module_init function, 31
module_param macro, 36, 41
modules, 5
applications, 18-22
authorization, 8
base module parameter, 247
classes, 5-8
code requirements, 30
compiling, 23-25
complete, 115
current process and, 21
dynamic module assignment, 47
dynamic number assignment, 47
faulty (oops messages), 94
files, 40
filesystem, 8
header files of, 19
hello world, 16-18
initialization, 31-35
initializing, 31-35
kdatasize, 289
license terms, 11
loading, 18, 25-28
insmod program and, 25
races, 35
using init scripts, 48
parameters, 35-37
platform dependency, 27
SCSI, 7
security (see security)
short, 265
stacking, 28
symbols, 28-29
test system setup, 15
unloading, 18, 25, 505
user-space programming, 37-39
version dependency, 26
monitoring
kernels (debugging by), 91
preprocessor for, 79-81
mremap system calls, 427, 430
MSR register, 565
MTU, network devices and, 513
multicasting
IFF_MULTICAST flag and, 509
network drivers, 537-540
mutexes, 109
initialization, 110
mutual exclusion, 108
N[ Top ]
name field (buses), 378
NAME variable, 401
naming
IP numbers, 499
sysfs directory tree (USB), 334
native DMA, 454-459
natural alignment of data items, 294
nbtest program, 162
net_device structure, 502, 506-507
device methods of, 514
interface flags for, 509
net_device_stats structure, 505, 536
netif_carrier_off function, 528
netif_carrier_ok function, 528
netif_carrier_on function, 528
netif_start_queue function, 515
netif_stop_queue function, 516, 518
netif_wake_queue function, 518
net_init.c file, 507
netpoll, 541
network devices, 400
network drivers, 497
functions, 542-545
interrupt handlers for, 523
ioctl commands, 535
kernel connections, 502-514
link state (changes in), 528
MAC addresses (resolution of), 532-534
methods of, 514
multicasting, 537-540
opening, 515-516
snull, 498-502
statistics, 536
networks, 5
interfaces, 7
management, 5
next method, 87
nonblocking operations, 151
nondefault attributes (kobjects), 373
non-Ethernet headers, 534
non-Ethernet interfaces, 507
nonpreemption and concurrency, 21
nonretryable requests, 486
nonuniform memory access (NUMA) systems (see NUMA systems)
nopage method, 422, 427
mremap system call with, 427
preventing extension of mapping, 430
remapping RAM, 431
normal memory zone, 215
notification (asynchronous), 169-171
nr_frags field, 520
NR_IRQS symbol, 267
NuBus, 324
NUMA (nonuniform memory access) systems, 216, 417
numbering versions (see versions, numbering)
numbers
devices (printing), 82
interrupt, 260
IP (assignment of), 499
major and minor, 43-49
PFN, 415
root hubs (USB), 334
versions, 10-11
O[ Top ]
objects
kobjects, 364-371
hotplug event generation, 375
low-level sysfs operations, 371-375
(see also kobjects)
lifecycles, 363
sharing, 108
octets, 498
older interfaces
char device registration, 57
/proc file implementation, 85
O_NDELAY flag (f_flags field), 151
O_NONBLOCK flag (f_flags field), 54, 141, 151
read/write methods and, 166
oops messages, 94-96
open files, 53
open function (tty drivers), 553-556
open method, 51, 58-59
block drivers, 471
blocking, 176
for network devices, 511
private_data and, 54
requesting DMA channels, 455
restricting simultaneous users and, 175
for single-open devices, 174
vm_operations_struct structure, 421
opening network drivers, 515-516
operations
aio_fsync, 438
atomic_add, 125
atomic_dec, 125
atomic_dec_and_test, 125
atomic_inc, 125
atomic_inc_and_test, 125
atomic_read, 125
atomic_set, 125
atomic_sub, 125
atomic_sub_and_test, 125
bit, 126
block drivers, 466, 471-474
blocking, 151
change_bit, 126
clear_bit, 126
devices, 513
files, 49-53
filter operation, 376
flush, 51
hotplugs, 376
on ksets, 370
low-level sysfs, 371-375
methods
buses, 379
close, 421
nopage, 422
open, 421
populate, 422
(see also methods)
mmap devices, 422-434
nonblocking, 151
set_bit, 126
snull interfaces, 500
spinlocks, 120
string, 241, 255
sysrq, 98
test_and_change_bit, 127
test_and_clear_bit, 127
test_and_set_bit, 127
test_bit, 127
tty_operations structure, 569
vector, 69
VMAs (adding), 426
optimizations, compiler, 236
options (configuration), 73-75
ordering locking (rules for), 122
O_RDONLY flag (f_flags field), 54
O_SYNC flag (f_flags field), 54
outb function, 240
outb_p function, 242
outl function, 240
output
buffers, 152
flushing pending, 167
pins, 235, 245, 247
outsb function, 242
outsl function, 242
outsw function, 242
outw function, 240
overriding ARP, 533
overruns (buffers), 95
P[ Top ]
packages, upgrading, 10
PACKET_BROADCAST flag, 530
PACKET_HOST flag, 530
PACKET_MULTICAST flag, 530
PACKET_OTHERHOST flag, 530
packets
management, 5
multicasting, 538
reception, 523
reception of, 501, 521
transmission, 501, 516-520
page frame number (PFN), 415
page_address macro, 417
page.h header file, 292
page-oriented allocation functions, 221, 233
pages
allocators, 224
faults caused by invalid pointers, 94
physical addresses, 415
size and portability, 292
tables, 418
I/O memory and, 249
nopage VMA method, 427
PAGE_SHIFT macro, 415
PAGE_SHIFT symbol, 292
PAGE_SIZE symbol, 292, 423
Parallel Line Internet Protocol (see PLIP)
parallel ports, 245-248
interrupt handlers
disabling, 274
preparing for, 259
stacking driver modules, 28
parameters
assigning values, 36
base module, 247
modules, 35-37
param.h header file, 183
PARENB bitmask, 561
PARODD bitmask, 561
partial data transfers
read method, 66
write method, 68
passwords, 9
pausing I/O, 242
PC parallel interface, 245
PCI (Peripheral Component Interconnect), 226
devices
adding, 392-395
deleting, 395
DMA, 453
double-address cycle mappings, 452
drivers
adding, 396
deleting, 396
EISA, 323
extended buses, 325
interfaces, 302-319
ISA, 319-322
lists, 326
MCA, 322
NuBus, 324
PC/104 and PC/104+, 322
SBus, 323
searching, 326
VLB, 323
pci_bus_type variable, 392
PCI_CLASS variable, 400
PCI_DEVICE macro, 310
PCI_DEVICE_CLASS macro, 310
PCI_DMA_FROMDEVICE symbol, 449
PCI_DMA_TODEVICE symbol, 449
PCI_ID variable, 400
pci_map_sg function, 451
pci_remove_bus_device function, 395
pci_resource_ functions, 317
PCI_SLOT_NAME variable, 400
PCI_SUBSYS_ID variable, 400
PDEBUG/PDEBUGG symbols, 80
pending output, flushing, 167
per-CPU variables, 228-230
performance
allocating socket buffers, 522
degrading by allocating too much memory, 222
memory barriers and, 238
mmap method, 423
output buffers and, 152
string operations and, 241
Peripheral Component Interconnect (see PCI)
peripherals (DMA), 440-459
perror calls, 93
persistence of memory, 43
PFN (page frame number), 415
pfn_to_page function, 417
PG_locked flag, 417
PG_reserved flag, 417
PHYS variable, 401
physical addresses, 413
pages, 415
(see also addresses)
physical memory, management of, 216
(see also memory)
pins
9/10 of parallel connector, 259
interrupts (generating), 271
output, 235, 245, 247
pipes (scull), 43
platform dependency, 11, 27
for modules, 27
porting and, 242
/proc/stat file, 263
PLIP (Parallel Line Internet Protocol)
using Ethernet headers, 533
interrupt handling differences, 523
plug and play (PnP), 321
PnP (plug and play), 321
pointers
data type portability, 295
inode in ioctl method, 136
kobject, 365
scull, 61
tty_driver function, 553-560
Point-to-Point Protocol (PPP) and interrupt handling differences, 523
policies
controlling devices by printing and, 147
memory, 4
allocation (scull), 60, 63
security, 8
separation from mechanism, 2-4
policy, driver, 2-4
poll method, 51, 163-169, 513
poll_controller method, 542
POLLERR flag, 164
poll.h header file, 163, 182
POLLHUP flag, 164
POLLIN flag, 164
POLLOUT flag, 164
POLLPRI flag, 164
POLLRDBAND flag, 164
POLLRDNORM flag, 164
poll_table structure, 163, 167
poll_table_entry structure, 167
poll_wait function, 163, 182
POLLWRBAND flag, 164
POLLWRNORM flag, 164
pools
DMA, 447
memory, 220, 232
populate method, 422
portability, 292-299
data types and, 288-292
porting and, 242
ports
access, 255
accessing different sizes, 240
I/O, 235-254, 255
parallel, 245-248
disabling interrupt handlers, 274
preparing for interrupt handlers, 259
platform dependency and, 242
(see also connections; parallel ports)
POS (Programmable Option Select), 322
power management, 362
PowerPC architecture (porting and), 244
PPP (Point-to-Point Protocol) and interrupt handling differences, 523
pread method, 65
precision, temporal, 189
predefined commands, ioctl method, 140
(see also commands)
preemption and concurrency, 21
preprocessor, using to monitor driver, 79-81
printing
controlling devices by, 147
to debug code, 81
device numbers, 82
from gdb debugger, 99
interface-specific data, 291
kernels, 75-82
_t data items, 291
printk function, 17, 76-82
circular buffers for, 78
debugging with, 78
logging messages from, 78
seq_file interface (avoiding in), 88
turning debug messages on/off, 79
priorities, 76
allocation, 214
memory, 213
message (see loglevels)
private_data field (file structure), 54
privileged operations, 144
probe function (USB), 350
probe_irq_off function, 265
probe_irq_on function, 265
Probes, Dynamic, 105
probing, 264
do-it-yourself, 266
for IRQ numbers, 264
kernel-assisted, 265
PCI, 313
/proc filesystem, 86-90
installing interrupt handlers, 262
removing /proc entries, 86
shared interrupts and, 280
/proc/devices file, 46
processes
current, 21
kernel timers for, 202
kernels (splitting), 4-5
login, 173
managing, 4
memory maps, 422
opening devices for each process, 173
sleeps, 147-162
processor-specific registers, 186
/proc/interrupts file, 262, 280
/proc/kcore file, 99
/proc/kmsg file, 78
/proc/*/maps, 420
/proc/modules file, 40
proc_read method, 84
/proc/slabinfo file, 219
/proc/stat file, 263
/proc/sys/kernel/printk file, reading console loglevel with, 77
/proc/tty/driver/ directory, 547
PRODUCT variable, 401
Programmable Option Select (POS), 322
programming
concurrency in, 20
hello world module, 16-18
ISA, 321
module requirements, 30
test system setup, 15
user space, 19, 37-39
programming drivers (see writing, drivers)
programs, 3
asynctest, 169
dataalign, 294
datasize, 288
insmod, 5
jitbusy, 191
mapper, 430
nbtest, 162
obtaining, 12
rmmod, 5
/sbin/hotplug utility, 398
setconsole, 77
setterm, 147
tcpdump, 501
tracing, 105
tunelp, 3
(see also applications versus kernel modules)
public kernel symbols, 28-29
put_unaligned function, 293
put_user function, 143, 180
pwrite method, 65
Q[ Top ]
quantums/quantum sets (memory), 61
querying kernels, 82-91
querying to debug, 91
queues
control functions, 480
creating/deleting, 479
functions, 479
network drivers, 515
request function, 475
request method, 478
TCQ, 492-493
transmissions, 518
wait, 149, 156, 181
workqueues, 205-208, 211, 277
R[ Top ]
race conditions, 21
kernel timers and, 198
module loading, 35
sequences, 107
RAM (random access memory)
remapping, 430
versus I/O registers, 236
random access memory (see RAM)
random numbers, 260
rates, limitations of, 81
RCU (read-copy-update), 129
rdtscl function, 187
read function (tty drivers), 558
read method, 50, 63-69
arguments to, 65
code for, 67
configuring DMA controllers, 456
f_pos field (file structure) and, 54
oops messages, 95
poll method and, 166
return values, rules for interpreting, 66
strace command and, 92
read-copy-update (RCU), 129
readdir method, 50
reader/writer semaphores, 113
reader/writer spinlocks, 120
reading
blocking/nonblocking operations, 151
from a device, 63-67
read-only /proc files, creating, 84
read_proc function, 85
readv calls, 69
readv method, 52
read/write instructions, reordering, 236
read/write position, changing, 50
rebuild_header method, 512
reception of packets, 501, 521-523
recovery, error, 33
redirecting console messages, 77
reentrant
calls, 97
code, 21
reference counters (kobjects), 366
regions
generic I/O address spaces, 316
I/O memory management, 429
register_blkdev function, 465
register_chrdev function, 404
register_netdev function, 503
registers
counters, 186
I/O, 236
LSR, 564
mapping, 445, 450
MSR, 565
PCI, 308, 325
class, 309
deviceID, 309
subsystem deviceID, 309
subsystem vendorID, 309
vendorID, 309
processor-specific, 186
scatterlists (and mapping), 450
registration
block drivers, 465-470
buses, 378
char drivers, 55-57
cleanup function, 32
devices, 382, 502
disks, 466
DMA usage, 455
interrupt handlers, 286
module-loading races, 35
PCI drivers, 311
struct usb_driver structure, 349
tiny_tty_driver variable, 551
tracking, 33
tty drivers, 549
USB drivers, 348
release calls, 174
release functions (kobjects), 367
release method, 51, 59
block drivers, 471
blocking, 176
cloning devices, 179
kobjects, 367
release_dma_lock function, 457
releasing spinlocks, 120
RELEVANT_IFLAG macro, 560
remap_pfn_range function, 424
remapping
kernel virtual addresses, 434
RAM, 430
(see also mapping)
remote0 (IP number), 499
removable media (supporting), 472
remove_proc_entry function, 86
reordering read/write instructions, 236
repatch program, 575
reports (interrupts), 261
request_dma function, 455
request_firmware function, 406
requests
blocking, 176
processing, 474-491
state of (processing), 483
requeuing/rescheduling tasks, 198
requirements, code, 30
resolution of time, 189
resolving Ethernet addresses, 532
resource flags (PCI), 317
restriction of access, 174
retrieval of current time, 188-190
return values
interrupt handlers, 272
switch statements, 140
revalidate method, 473
ring buffers (DMA), 441
RISC processor and inline assembly code, 187
rmmod program, 5, 17
dynamically allocating major numbers, 48
testing modules using, 17
roles
of device drivers, 2-4
kernels, 4-5
root hubs (USB), 334
routing, network management, 5
rq_data_dir field (request structure), 477
rules
locking, 121
ordering, 122
running (see execution)
runtime, code, 5
rwsems (reader/writer semaphores), 113
S[ Top ]
S/390 architecture, 402
porting and, 244
SA_INTERRUPT flag, 260, 286
SAK (secure attention key) function, 97
sample programs, obtaining, 12
SA_SAMPLE_RANDOM flag, 260, 286
SA_SHIRQ flag, 260, 278, 286
/sbin/hotplug utility, 398
sbull drivers
initialization, 468
request method, 475
sbull ioctl method, 473
sbull_request function, 469
SBus, 324
scatter/gather
DMA mappings, 450
I/O, 520
scatterlists
mapping, 450
structure, 462
sched.h header file, 40, 184
schedule function, 181
execution of code (delaying), 193
preventing endless loops with, 97
schedulers (I/O), 478
schedule_timeout function, 194
scheduling kernel timers, 196-202
scripts (hotplug), 403
SCSI
devices, 402
modules, 7
scull, 42, 47
char drivers, 70
concurrency (see concurrency)
design of, 42
device registration, 56
drivers (example), 80, 138
file operations, 49-53
inode structure, 55
locking (adding), 109
memory
troubleshooting, 107
usage, 60-63
next method, 87
open method, 58-59
pointers, 61
race conditions, 107
read method, 63-69
read_proc method, 85
readv calls, 69
release method, 59
semaphores, 112
show method, 88
stop method, 88
write method, 63-69
writev calls, 69
scull driver (example), 42
scullc driver (example), 219
scull_cleanup function, 179
scull_getwritespace function, 158
scullp
example, 223
mmap implementations, 431
scullpipe devices (example), 153-162
scullsingle device, 174
sculluid code, 175
scullv driver (example), 227, 233
searching PCI drivers, 326
sectors (size of), 470
sector_t bi_sector field (bio structure), 482
sector_t capacity field (gendisk), 467
sector_t sector field (request structure), 476
secure attention key (SAK) function, 97
security, 8
seeking devices, 171
select method, 163-169
poll method and, 51
semaphores, 109
completion, 114-116
implementation, 110-114
reader/writer, 113
unlocking, 110
sendfile system, 52
sendpage system, 52
seq_file interface, 87-90
seqlocks, 127
SEQNUM variable, 399
sequences (race conditions), 107
serial line configuration, 565
serial_icounter_struct structure, 566
set_bit operation, 126
set_config method, 512
setconsole program, 77
set_dma_addr function, 457
set_dma_count function, 457
set_dma_mode function, 457
set_mac_address method, 513
set_mb function, 238
set_multicast_list function, 539
set_multicast_list method, 510, 513
set_rmb function, 238
setterm program, 147
set_termios function, 560
set_wmb function, 238
sfile argument, 87
sg_dma_address function, 462
sg_dma_address macro, 451
sg_dma_len function, 462
sg_dma_len macro, 451
sharing
code, 108
interrupt handlers, 278-281
queues, 207
short delays, 195-196
sleeps, 196
short driver (example), 246
accessing I/O memory, 252
implementing interrupt handlers, 270
installing interrupt handlers, 261
probing, 266
short module, 265
shortprint drivers, 282-286
show function, 386
show method
kobjects, 373
seq_file interface, 88
shutdown, 31, 362
shutting down modules (see unloading, modules)
SIGIO signal, 169
signal handling, 154
Simple Character Utility for Loading Localitie (see scull)
Simple Hardware Operations and Raw Tests (see short driver)
simple sleeping, 149
single-open devices, 173
single-page streaming mappings, 450
SIOCDEVPRIVATE commands, 535
SIOCSIFADDR command, 535
SIOCSIFMAP command, 535
size
data explicitly, 290
explicit, 290
kmalloc argument, 216
pages, 292
ports, 240
of sectors, 470
skb_headlen function, 532
skb_headroom function, 531
skb_is_nonlinear functions, 532
skb_pull function, 532
skb_push function, 531
skb_put function, 531
skb_reserve function, 531
skb_tailroom function, 531
sk_buff structure
fields for, 529
transmitting packets, 516
skbuff.h header file, 516
SLAB_CACHE_DMA flag, 218
SLAB_CTOR_ATOMIC flag, 218
SLAB_CTOR_CONSTRUCTOR flag, 218
SLAB_HWCACHE_ALIGN flag, 218
SLAB_NO_REAP flag, 218
sleep_on function, 162
sleeps
locking, 110
manual, 156
processes, 147-162
short delays, 196
spinlocks, 118
slow downs (avoiding), 82
slow interrupt handlers, 268
SMP (symmetric multiprocessor) systems, 21
snullnet0 (IP number), 499
socket buffers, 516, 528-532
allocation, 522
software
loops, 195
versions (see versions, numbering)
(see also applications versus kernel modules)
software-mapped I/O memory (ioremap function), 250
SPARC architecture, 244
SPARC64 platform (data alignment), 294
special files, 43
spinlocks
dma_spin_lock, 457
hard_start_xmit function, 518
releasing, 120
xmit_lock function, 514
splitting kernels, 4-5
stacking modules, 28
standard C data types, 288
start method, 87
stat file, 263
state of request processing, 483
statements
goto, 33
printk (see printk function)
switch
with ioctl method, 136
return values, 140
static functions (locking), 121
static numbers, assignment of, 46
statistics
on caches, 219
on interrupts, 263
on network drivers, 536
on network interfaces, 504, 512, 536
status information, 514
stop method, 88, 512
store method (kobjects), 373
strace command, 91
strace tool, 162
streaming
DMA mappings, 446, 448
single-page mappings, 450
string operations, 241, 255
struct block_device_operations *fops field (gendisk), 467
struct bus_type *bus field, 382
struct cdev *i_cdev (inode structure field), 55
struct dentry *f_dentry (struct file field), 54
struct device fields, 381
struct device *parent field, 381
struct device_driver *driver field, 382
struct device_driver structure, 385
struct file, 53
struct file_operations *f_op (struct file field), 54
struct file_operations *fops variable (USB), 353
struct kobject kobj field, 381
struct module *owner function, 348
struct module *owner method, 50
struct net_device *next field (net_device structure), 506
struct pci_device_id structure (PCI), 309
struct request structure, 476
struct request_queue *queue field (gendisk), 467
struct scull_qset structure, 62
struct termios structure (tty drivers), 550-553
struct timeval pointer, 188
struct tty_flip_buffer structure, 559
struct urb structure, 336
struct usb_device *dev field (USB), 336
struct usb_device_id structure (USB), 346
struct usb_driver structure, 349
struct usb_host_interface *altsetting field (USB), 331
struct usb_host_interface *cur_altsetting field (USB), 332
struct usb_interface structure, 351
struct usb_iso_packet_descriptor iso_frame_desc field (USB), 341
structures
bin_attribute, 374
bio, 482, 487
bus_type, 378
cdev configuration, 56
data, 49, 49-53
devices, 383
dev_mc_list, 538
drivers, 386
file_operations (mmap method and), 424
gendisk, 467
ifreq, 535
kobjects, 364-371
kset_hotplug_ops, 376
ldd_driver, 386
net_device, 502, 506-507
net_device_stats, 505, 536
registration, 55-57
scatterlist, 462
serial_icounter_struct, 566
sk_buff, 529
struct device_driver, 385
struct request, 476
struct scull_qset, 62
struct termios (tty drivers), 550-553
struct tty_flip_buffer, 559
struct urb, 336
struct usb_driver, 349
struct usb_interface, 351
tty_driver, 567
tty_operations, 569
tty_struct, 571
vm_area_struct, 420
vm_operations_struct, 421
submission of urbs, 344, 354
SUBSYSTEM variable, 399
subsystems, 368
classes, 391
deviceID register (PCI), 309
firmware, 407
ksets, 370
memory management, 4
module stacking, 29
USB (see USB)
vendorID register (PCI), 309
Super-H architecture, 244
supervisor mode, 20
support
Ethtool, 541
kernels (debugging), 73-75
MII, 540
multicasting, 538
swappers, 193
switch statements
return values, 140
with ioctl method, 136
symbolic links (kobjects), 375
symbols, 28-29
BLK_BOUNCE_HIGH, 480
bytes, 300
CHECKSUM, 523
DMA_BIDIRECTIONAL, 448
DMA_FROM_DEVICE, 448
DMA_NONE, 448
DMA_TO_DEVICE, 448, 461
IFF_, 538
NR_IRQS, 267
PAGE_SIZE, 423
PCI_DMA_FROMDEVICE, 449
PCI_DMA_TODEVICE, 449
PDEBUG/PDEBUGG, 80
symbol table, 28-29
symmetric multiprocessor (SMP) systems, 21
synchronization
DMA buffers, 452
semaphores, 114
sysfs directory
trees (USB), 333-335
tty driver, 552
sysfs filesystem, 409
low-level operations, 371-375
syslogd daemon, 79
sysrq operations, 98
sysrq.txt file, 97
sys_syslog function, 77
system calls, 25
system faults
debugging, 93-98
handling, 19
system hangs, 96-98
system shutdown, 362
T[ Top ]
_t data types, 291
table pages, 418
I/O memory and, 249
nopage VMA method, 427
tables, symbols, 28-29
tagged command queuing (TCQ), 492-493
tagged initialization formats, 53
tasklets, 202-204, 211
interrupt handlers, 276
tasklet_schedule function, 276
tcpdump program, 501
TCQ (tagged command queueing), 492-493
tearing down single-page streaming mappings, 450
templates, scull (design of), 42
terminals, selecting for messages, 77
termios userspace functions, 560
test system setup, 15
test_and_change_bit operation, 127
test_and_clear_bit operations, 127
test_and_set_bit operation, 127
test_bit operation, 127
testing
block drivers, 468
char drivers, 70
hello world modules, 17
scullpipe drivers, 162
thread execution, 109
throughput (DMA), 440-459
time, 208
boot (PCI), 306
current time (retrieving), 188-190
execution of code (delaying), 190-196, 209
HZ (time frequency), 183, 292
intervals of (data type portability), 292
kernel timers, 202
lapses (measurement of), 183-188
tasklets, 202-204
time intervals in the kernel, 292
workqueues, 205-208
timeouts
configuration, 193
scheduling, 194
transmission (see transmission timeouts)
timer.h header file, 198
timer_list structure, 198
timers, 202
interrupts, 183
kernels, 196-202, 210
timestamp counter (TSC), 186
tiny_close function, 556
tiny_tty_driver variable, 551
TIOCLINUX command, 77
tiocmget function, 562
tiocmset functions, 562
token ring networks, setting up interfaces for, 508
tools
debuggers, 99-105
Ethtool, 541
kernels (enabling configuration options), 73-75
lockmeter, 123
/sbin/hotplug utility, 398
strace, 162
timers, 196-202
(see also debugging; utilities)
top halves (interrupt handlers), 275-278
tracing programs, 105
tracking
registration, 33
struct scull_qset (structure), 62
transfers
buffers, 448
DMA, 440-459, 461
USB without urbs, 356-359
transistor-transistor logic (TTL) levels, 245
transmission concurrency, controlling, 518
transmission of packets, 501, 516-520
transmission timeouts, 504, 519
tx_timeout method and, 512
watchdog_timeo field and, 514
traps (locking), 121-123
traversal of linked lists, 298
tr_configure function, 508
trees
/dev, 403
sysfs (USB and), 333-335
tty drivers, 548
troubleshooting, 73
caches, 237, 425, 445
DMA hardware, 444
fragmentation, 442
locking, 121-123
memory (scull), 107
porting problems, 242
system hangs, 96
values, 295
wrong font on console, 147
truncating devices on open, 59
TSC (timestamp counter), 186
TTL (transistor-transistor logic) levels, 245
tty drivers, 546-550
buffers, 558
directories, 566
functions, 573
line settings, 560-566
pointers, 553-560
struct termios, 550-553
sysfs directories, 552
tty_driver structure, 567
tty_operations structure, 569
tty_struct structure, 571
tty_driver structure, 567, 569, 571
TTY_DRIVER_NO_DEVFS flag, 553
TTY_DRIVER_REAL_RAW flag, 553
TTY_DRIVER_RESET_TERMIOS flag, 552
tty_get_baud_rate function, 562
tty_register_driver function, 549
tunelp program, 3
turning messages on/off, 79
tx_timeout method, 512, 519
TYPE variable, 401
types
addresses, 413
bus_attribute, 380
module parameter support, 36
PCI driver support, 325
U[ Top ]
u16 bcdDevice_hi field (USB), 346
u16 bcdDevice_lo field (USB), 346
u16 idProduct field (USB), 346
u16 idVendor field (USB), 346
u16 match_flags field (USB), 346
u8 bDeviceClass field (USB), 347
u8 bDeviceProtocol field (USB), 347
u8 bDeviceSubClass field (USB), 347
u8 bInterfaceClass field (USB), 347
u8 bInterfaceProtocol field (USB), 347
u8 bInterfaceSubClass field (USB), 347
u8, u16, u32, u64 data types, 290
uaccess.h header file, 64, 72, 142, 180
udelay, 196
uint8_t/uint32_t types, 290
uintptr_t type (C99 standard), 289
unaligned data, 293
access, 300
unaligned.h header file, 293
unidirectional pipes (USB endpoints), 329
uniprocessor systems, concurrency in, 21
universal serial bus (see USB)
Unix
filesystems, 4
interfaces (access to), 7
unlinking urbs, 345
unloading
modules, 18, 25, 505
USB drivers, 349
unlocking semaphores, 110
unmapping, DMA buffers, 449
(see also mapping)
unregistering facilities, 33
unregister_netdev function, 505
unshielded twisted pair (UTP), 510
unsigned char *setup_packet field (USB), 338
unsigned int bi_size field (bio structure), 482
unsigned int f_flags (struct file field), 54
unsigned int irq function, 260
unsigned int pipe field (USB), 336
unsigned int transfer_flags field (USB), 337
unsigned long bi_flags field (bio structure), 482
unsigned long flags field (memory), 417
unsigned long flags function, 260
unsigned long method, 52
unsigned long nr_sectors field (request structure), 476
unsigned long pci_resource_end function, 317
unsigned long pci_resource_flags function, 317
unsigned long pci_resource_start function, 317
unsigned long state field (net_device structure), 506
unsigned num_altsetting field (USB), 332
unsigned short bio_hw_segments field (bio structure), 482
unsigned short bio_phys_segments field (bio structure), 482
unsigned type, 240
up function, 111
updates, RCU, 129
urandom device, 260
urbs
cancellation of, 345
interrupts, 342
killing, 345
submitting, 344
unlinking, 345
USB, 335-346
creating/destroying, 341
struct urb structure, 336
submitting, 354
transfers without, 356-359
urbs_completion function, 345
usage count, 426
decremented by release method, 59
incremented by open method, 58
nopage method and, 432
USB request blocks (see urbs)
USB (universal serial bus), 7, 327-332
configurations, 332
hotplugging, 401
stacking, 28
sysfs directory tree, 333-335
transfers without urbs, 356-359
urbs, 335-346
writing, 346-355
usb_alloc_urb function, 342
usb_bulk_msg function, 356
usb_control_msg function, 357
usbcore module, 28
USB_DEVICE macro, 347
USB_DEVICE_INFO macros, 347
USB_DEVICE_VER macro, 347
usb_fill_bulk_urb function, 343
usb_fill_control_urb function, 343
usb_fill_int_urb function, 342
usb_get_descriptor function, 358
USB_INTERFACE_INFO macro, 347
usb_kill_urb function, 345
usb_register_dev function, 352
usb_set_intfdata function, 351
usb_string function, 359
usb_submit_urb function, 344
usb_unlink_urb function, 345
user mode, 20
user programs, 3
user space, 19
capabilities/restrictions in, 144
communication with, 362
direct I/O, 435-440
explicitly sizing data in, 290
I/O port access from, 241
programming, 19, 37, 39
retrieving datum from, 143
transferring to/from kernel space, 63
tty drivers, 560-566
writing drivers in, 37
user virtual addresses, 413
User-Mode Linux, 104
utilities, 3
insmod, 17
modprobe, 25, 29
rmmod, 17
(see also programs)
utility fields (net_device structure), 514
UTP (unshielded twisted pair), 510
UTS_RELEASE macro, 27
V[ Top ]
values
BogoMips, 195
errors, 295
jiffies, 184, 514
loops_per_jiffy, 196
return
interrupt handlers, 272
switch statements, 140
variables
ACTION, 399
atomic, 124
char*name (USB), 352
console_loglevel, 77
DEVICE, 402
DEVPATH, 399
int minor_base (USB), 353
INTERFACE, 401
mode_t mode (USB), 353
NAME, 401
pci_bus_type, 392
PCI_CLASS, 400
PCI_ID, 400
PCI_SLOT_NAME, 400
PCI_SUBSYS_ID, 400
per-CPU, 228-230
PHYS, 401
PRODUCT, 401
SEQNUM, 399
struct file_operations *fops (USB), 353
SUBSYSTEM, 399
tiny_tty_driver, 551
TYPE, 401
vector operations, char drivers, 69
vendorID register (PCI), 309
VERIFY_ symbols, 142, 180
version dependency, 26
version.h header file, 26, 40
versions
dependency, 26
numbering, 10-11
char drivers, 43
major device numbers, 44
minor device numbers, 44
older char device registration, 57
VESA Local Bus (VLB), 323
vfree function, 225
video memory (mapping), 423
viewing kernels, 5
virt_to_page function, 417
virtual addresses, 414
conversion, 444
remapping, 434
(see also addresses)
virtual memory, 413
(see also memory)
virtual memory area (see VMA)
VLB (VESA Local Bus), 323
VMA (virtual memory area), 419-422, 426
vmalloc allocation function, 224-228
vmalloc.h header file, 225
vm_area_struct structure, 420
VM_IO flag, 421
vm_operations_struct structure, 421
VM_RESERVED flag, 421
void barrier function, 237
void blk_queue_bounce_limit function, 480
void blk_queue_dma_alignment function, 481
void blk_queue_hardsect_size function, 481
void blk_queue_max_hw_segments function, 480
void blk_queue_max_phys_segments function, 480
void blk_queue_max_sectors function, 480
void blk_queue_max_segment_size function, 480
void blk_start_queue function, 480
void blk_stop_queue function, 480
void *context field (USB), 339
void *dev_id function, 260
void *driver_data field, 382
void field (PCI registration), 312
void function, 348
void mb function, 237
void *private_data field (gendisk), 467
void *private_data (struct file field), 54
void read_barrier_depends function, 237
void *release field, 382
void rmb function, 237
void smp_mb functions, 238
void smp_read_barrier_depends function, 238
void smp_rmb function, 238
void smp_wmb function, 238
void tasklet_disable function, 204
void tasklet_disable_nosync function, 204
void tasklet_enable function, 204
void tasklet_hi_schedule function, 204
void tasklet_kill function, 204
void tasklet_schedule function, 204
void *transfer_buffer field (USB), 338
void *virtual field (memory), 417
void wmb function, 237
W[ Top ]
wait queues, 149, 156, 181
delaying code execution, 194
poll table entries and, 167
putting processes into, 182
wait_event macro, 149
wait_event_interruptible_timeout function, 194
wake_up function, 150, 159, 181
wake_up_interruptible function, 181
wake_up_interruptible_sync function, 181
wake_up_sync function, 181
Wall flag, 291
watchdog_timeo field (net_device structure), 514, 519
wc command, 92
wMaxPacketSize field (USB), 331
workqueues, 205-208, 211
interrupt handlers, 277
WQ_FLAG_EXCLUSIVE flag set, 160
write function (tty drivers), 556
write method, 50, 63-69
code for, 68
configuring DMA controller, 456
f_pos field (file structure) and, 54
oops messages, 94
poll method and, 166
return values, rules for interpreting, 68
select method and, 166
strace command and, 92
write system, 50
write-buffering example, 282
writev calls, 69
writev method, 52
writing, 73
blocking/nonblocking operations, 151
control sequences to devices, 146
to a device, 63-66, 68
drivers
in user space, 37
role of, 2-4
version numbering, 10
UBS drivers, 346-355
X[ Top ]
x86 architecture
interrupt handling on, 268
porting and, 243
xmit_lock function, 514
xtime variable, 189
Z[ Top ]
zero-order limitations, 432
zones (memory), 215
zSeries architecture, 402
Zurück zu Linux Device Drivers