1 |
1275 |
phoenix |
This file is a registry of magic numbers which are in use. When you
|
2 |
|
|
add a magic number to a structure, you should also add it to this
|
3 |
|
|
file, since it is best if the magic numbers used by various structures
|
4 |
|
|
are unique.
|
5 |
|
|
|
6 |
|
|
It is a *very* good idea to protect kernel data structures with magic
|
7 |
|
|
numbers. This allows you to check at run time whether (a) a structure
|
8 |
|
|
has been clobbered, or (b) you've passed the wrong structure to a
|
9 |
|
|
routine. This last is especially useful --- particularly when you are
|
10 |
|
|
passing pointers to structures via a void * pointer. The tty code,
|
11 |
|
|
for example, does this frequently to pass driver-specific and line
|
12 |
|
|
discipline-specific structures back and forth.
|
13 |
|
|
|
14 |
|
|
The way to use magic numbers is to declare then at the beginning of
|
15 |
|
|
the structure, like so:
|
16 |
|
|
|
17 |
|
|
struct tty_ldisc {
|
18 |
|
|
int magic;
|
19 |
|
|
...
|
20 |
|
|
};
|
21 |
|
|
|
22 |
|
|
Please follow this discipline when you are adding future enhancements
|
23 |
|
|
to the kernel! It has saved me countless hours of debugging,
|
24 |
|
|
especially in the screwy cases where an array has been overrun and
|
25 |
|
|
structures following the array have been overwritten. Using this
|
26 |
|
|
discipline, these cases get detected quickly and safely.
|
27 |
|
|
|
28 |
|
|
Theodore Ts'o
|
29 |
|
|
31 Mar 94
|
30 |
|
|
|
31 |
|
|
The magic table is current to Linux 2.1.55.
|
32 |
|
|
|
33 |
|
|
Michael Chastain
|
34 |
|
|
|
35 |
|
|
22 Sep 1997
|
36 |
|
|
|
37 |
|
|
Now it should be up to date with Linux 2.1.112. Because
|
38 |
|
|
we are in feature freeze time it is very unlikely that
|
39 |
|
|
something will change before 2.2.x. The entries are
|
40 |
|
|
sorted by number field.
|
41 |
|
|
|
42 |
|
|
Krzysztof G. Baranowski
|
43 |
|
|
|
44 |
|
|
29 Jul 1998
|
45 |
|
|
|
46 |
|
|
Magic Name Number Structure File
|
47 |
|
|
===========================================================================
|
48 |
|
|
PG_MAGIC 'P' pg_{read,write}_hdr include/linux/pg.h
|
49 |
|
|
MKISS_DRIVER_MAGIC 0x04bf mkiss_channel drivers/net/mkiss.h
|
50 |
|
|
RISCOM8_MAGIC 0x0907 riscom_port drivers/char/riscom8.h
|
51 |
|
|
APM_BIOS_MAGIC 0x4101 apm_user arch/i386/kernel/apm.c
|
52 |
|
|
CYCLADES_MAGIC 0x4359 cyclades_port include/linux/cyclades.h
|
53 |
|
|
FASYNC_MAGIC 0x4601 fasync_struct include/linux/fs.h
|
54 |
|
|
PTY_MAGIC 0x5001 (none at the moment)
|
55 |
|
|
drivers/char/pty.c
|
56 |
|
|
PPP_MAGIC 0x5002 ppp include/linux/if_ppp.h
|
57 |
|
|
SERIAL_MAGIC 0x5301 async_struct include/linux/serial.h
|
58 |
|
|
SSTATE_MAGIC 0x5302 serial_state include/linux/serial.h
|
59 |
|
|
SLIP_MAGIC 0x5302 slip drivers/net/slip.h
|
60 |
|
|
STRIP_MAGIC 0x5303 strip drivers/net/strip.c
|
61 |
|
|
X25_ASY_MAGIC 0x5303 x25_asy drivers/net/x25_asy.h
|
62 |
|
|
SIXPACK_MAGIC 0x5304 sixpack drivers/net/hamradio/6pack.h
|
63 |
|
|
AX25_MAGIC 0x5316 ax_disp drivers/net/mkiss.h
|
64 |
|
|
ESP_MAGIC 0x53ee esp_struct drivers/char/esp.h
|
65 |
|
|
TTY_MAGIC 0x5401 tty_struct include/linux/tty.h
|
66 |
|
|
TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h
|
67 |
|
|
TTY_LDISC_MAGIC 0x5403 tty_ldisc include/linux/tty_ldisc.h
|
68 |
|
|
SPECIALIX_MAGIC 0x0907 specialix_port drivers/char/specialix_io8.h
|
69 |
|
|
CG_MAGIC 0x090255 ufs_cylinder_group include/linux/ufs_fs.h
|
70 |
|
|
RPORT_MAGIC 0x525001 r_port drivers/char/rocket_int.h
|
71 |
|
|
GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str drivers/scsi/gdth_ioctl.h
|
72 |
|
|
NBD_REQUEST_MAGIC 0x12560953 nbd_request include/linux/nbd.h
|
73 |
|
|
SLAB_RED_MAGIC2 0x170fc2a5 (any) mm/slab.c
|
74 |
|
|
BAYCOM_MAGIC 0x19730510 baycom_state drivers/net/baycom_epp.c
|
75 |
|
|
ISDN_X25IFACE_MAGIC 0x1e75a2b9 isdn_x25iface_proto_data
|
76 |
|
|
drivers/isdn/isdn_x25iface.h
|
77 |
|
|
ECP_MAGIC 0x21504345 cdkecpsig include/linux/cdk.h
|
78 |
|
|
LSMAGIC 0x2a3b4d2a ls drivers/fc4/fc.c
|
79 |
|
|
LSOMAGIC 0x2a3c4e3c lso drivers/fc4/fc.c
|
80 |
|
|
WANPIPE_MAGIC 0x414C4453 sdla_{dump,exec} include/linux/wanpipe.h
|
81 |
|
|
CODA_CNODE_MAGIC 0x47114711 coda_inode_info include/linux/coda_fs_i.h
|
82 |
|
|
ISDN_ASYNC_MAGIC 0x49344C01 modem_info include/linux/isdn.h
|
83 |
|
|
ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s include/linux/isdn.h
|
84 |
|
|
STLI_BOARDMAGIC 0x4bc6c825 stlibrd include/linux/istallion.h
|
85 |
|
|
SLAB_C_MAGIC 0x4f17a36d kmem_cache_s mm/slab.c
|
86 |
|
|
ROUTER_MAGIC 0x524d4157 wan_device include/linux/wanrouter.h
|
87 |
|
|
SLAB_RED_MAGIC1 0x5a2cf071 (any) mm/slab.c
|
88 |
|
|
STL_PORTMAGIC 0x5a7182c9 stlport include/linux/stallion.h
|
89 |
|
|
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state include/linux/hdlcdrv.h
|
90 |
|
|
EPCA_MAGIC 0x5c6df104 channel include/linux/epca.h
|
91 |
|
|
PCXX_MAGIC 0x5c6df104 channel drivers/char/pcxx.h
|
92 |
|
|
LO_MAGIC 0x68797548 nbd_device include/linux/nbd.h
|
93 |
|
|
STL_PANELMAGIC 0x7ef621a1 stlpanel include/linux/stallion.h
|
94 |
|
|
NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h
|
95 |
|
|
STL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.h
|
96 |
|
|
SLAB_MAGIC_ALLOC 0xa5c32f2b kmem_slab_s mm/slab.c
|
97 |
|
|
SLAB_MAGIC_DESTROYED 0xb2f23c5a kmem_slab_s mm/slab.c
|
98 |
|
|
STLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.h
|
99 |
|
|
CCB_MAGIC 0xf2691ad2 ccb drivers/scsi/ncr53c8xx.c
|