'magic' value Device Driver
问题 what is the 'magic' value in tty_driver struct struct tty_driver { int magic; /* magic number for this structure */ struct kref kref; /* Reference management */ struct cdev cdev; struct module *owner; const char *driver_name; .... .... I don't understand why is it called 'magic' 回答1: Magic numbers often refer to specific constants that identify a structure, file type or software. In this case, the tty_driver's magic number is apparently always defined like this: #define TTY_DRIVER_MAGIC