?? magic-number.txt
字號:
This file is a registry of magic numbers which are in use. When youadd a magic number to a structure, you should also add it to thisfile, since it is best if the magic numbers used by various structuresare unique.It is a *very* good idea to protect kernel data structures with magicnumbers. This allows you to check at run time whether (a) a structurehas been clobbered, or (b) you've passed the wrong structure to aroutine. This last is especially useful --- particularly when you arepassing pointers to structures via a void * pointer. The tty code,for example, does this frequently to pass driver-specific and linediscipline-specific structures back and forth.The way to use magic numbers is to declare then at the beginning ofthe structure, like so:struct tty_ldisc { int magic; ...};Please follow this discipline when you are adding future enhancementsto the kernel! It has saved me countless hours of debugging,especially in the screwy cases where an array has been overrun andstructures following the array have been overwritten. Using thisdiscipline, these cases get detected quickly and safely. Theodore Ts'o 31 Mar 94The magic table is current to Linux 2.1.55. Michael Chastain <mailto:mec@shout.net> 22 Sep 1997Now it should be up to date with Linux 2.1.112. Becausewe are in feature freeze time it is very unlikely thatsomething will change before 2.2.x. The entries aresorted by number field. Krzysztof G. Baranowski <mailto: kgb@knm.org.pl> 29 Jul 1998Magic Name Number Structure File===========================================================================PG_MAGIC 'P' pg_{read,write}_hdr include/linux/pg.hMKISS_DRIVER_MAGIC 0x04bf mkiss_channel drivers/net/mkiss.hRISCOM8_MAGIC 0x0907 riscom_port drivers/char/riscom8.hAPM_BIOS_MAGIC 0x4101 apm_user arch/i386/kernel/apm.cCYCLADES_MAGIC 0x4359 cyclades_port include/linux/cyclades.hFASYNC_MAGIC 0x4601 fasync_struct include/linux/fs.hPTY_MAGIC 0x5001 (none at the moment) drivers/char/pty.cPPP_MAGIC 0x5002 ppp include/linux/if_ppp.hSERIAL_MAGIC 0x5301 async_struct include/linux/serial.hSSTATE_MAGIC 0x5302 serial_state include/linux/serial.hSLIP_MAGIC 0x5302 slip drivers/net/slip.hSTRIP_MAGIC 0x5303 strip drivers/net/strip.cX25_ASY_MAGIC 0x5303 x25_asy drivers/net/x25_asy.hSIXPACK_MAGIC 0x5304 sixpack drivers/net/hamradio/6pack.hAX25_MAGIC 0x5316 ax_disp drivers/net/mkiss.hESP_MAGIC 0x53ee esp_struct drivers/char/esp.hTTY_MAGIC 0x5401 tty_struct include/linux/tty.hTTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.hTTY_LDISC_MAGIC 0x5403 tty_ldisc include/linux/tty_ldisc.hSPECIALIX_MAGIC 0x0907 specialix_port drivers/char/specialix_io8.hCG_MAGIC 0x090255 ufs_cylinder_group include/linux/ufs_fs.hRPORT_MAGIC 0x525001 r_port drivers/char/rocket_int.hGDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str drivers/scsi/gdth_ioctl.hNBD_REQUEST_MAGIC 0x12560953 nbd_request include/linux/nbd.hSLAB_RED_MAGIC2 0x170fc2a5 (any) mm/slab.cBAYCOM_MAGIC 0x19730510 baycom_state drivers/net/baycom_epp.cISDN_X25IFACE_MAGIC 0x1e75a2b9 isdn_x25iface_proto_data drivers/isdn/isdn_x25iface.hECP_MAGIC 0x21504345 cdkecpsig include/linux/cdk.hLSMAGIC 0x2a3b4d2a ls drivers/fc4/fc.cLSOMAGIC 0x2a3c4e3c lso drivers/fc4/fc.cWANPIPE_MAGIC 0x414C4453 sdla_{dump,exec} include/linux/wanpipe.hCODA_CNODE_MAGIC 0x47114711 coda_inode_info include/linux/coda_fs_i.hISDN_ASYNC_MAGIC 0x49344C01 modem_info include/linux/isdn.hISDN_NET_MAGIC 0x49344C02 isdn_net_local_s include/linux/isdn.hSTLI_BOARDMAGIC 0x4bc6c825 stlibrd include/linux/istallion.hSLAB_C_MAGIC 0x4f17a36d kmem_cache_s mm/slab.cROUTER_MAGIC 0x524d4157 wan_device include/linux/wanrouter.hSLAB_RED_MAGIC1 0x5a2cf071 (any) mm/slab.cSTL_PORTMAGIC 0x5a7182c9 stlport include/linux/stallion.hHDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state include/linux/hdlcdrv.hEPCA_MAGIC 0x5c6df104 channel include/linux/epca.hPCXX_MAGIC 0x5c6df104 channel drivers/char/pcxx.hLO_MAGIC 0x68797548 nbd_device include/linux/nbd.hSTL_PANELMAGIC 0x7ef621a1 stlpanel include/linux/stallion.hNBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.hSTL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.hSLAB_MAGIC_ALLOC 0xa5c32f2b kmem_slab_s mm/slab.cSLAB_MAGIC_DESTROYED 0xb2f23c5a kmem_slab_s mm/slab.cSTLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.hCCB_MAGIC 0xf2691ad2 ccb drivers/scsi/ncr53c8xx.c
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -