Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Book Note: Linux Device Driver Dos and Don'ts

Book Note: Linux Device Driver Dos and Don'ts
http://janitor.kernelnewbies.org/docs/driver-howto.html
what a hardened (robust) device
driver should mean and how it should be implemented and measured.
1.3 Robust device drivers
-Follows the Linux CodingStyle.
-Efficient in managing faults and handling, reporting and recovering from errors.
 (Also not panic() happy.)
-Complies with latest Linux kernel APIs and interfaces.
 (Uses the new device driver model, kobjects and sysfs.)
-Properly manages resources (memory, semaphores, interrupts, etc.).
-Uses kernel-provided "C" I/O functions instead of assembly code.
2.0 Where do I start?
3.0 OK, I'm ready...
3.1 Efficient error handling, reporting and recovery:
1)<printk()>
you should always check printk() calls to include appropriate KERN_* constant.
2)<goto>
3) <Enumerated return codes> <return EWHATEVER should be return -EWHATEVER>
4) <No need to panic()>
Rather, the device driver should try to recover, re-initialize, or finally simply
        return an appropriate error code, release allocated resources, log a message and
        exit gracefully.
3.2.1 Module interface changes
<Initialization and cleanup>
<Module Reference Count macros>
You no longer need to adjust your own module reference count
-Reference counting from other modules:
;A Golden Rule: if you are calling through a function pointer into a (different) module,
        you must hold a reference to that module.
        Otherwise you risk sleeping in the module while it is unloaded.
You can get a reference to a module by using:
            try_module_get(owner);
        and you don't have to check if OWNER != NULL, this is done by try_module_g


Ïà¹ØÎĵµ£º

[ת]linux tr

ͨ¹ýʹÓà tr£¬Äú¿ÉÒԷdz£ÈÝÒ×µØÊµÏÖ sed µÄÐí¶à×î»ù±¾¹¦ÄÜ¡£Äú¿ÉÒÔ½« tr ¿´×÷Ϊ sed µÄ£¨¼«Æä£©¼ò»¯µÄ±äÌ壺Ëü¿ÉÒÔÓÃÒ»¸ö×Ö·ûÀ´Ìæ»»ÁíÒ»¸ö×Ö·û£¬»òÕß¿ÉÒÔÍêÈ«³ýȥһЩ×Ö·û¡£ÄúÒ²¿ÉÒÔÓÃËüÀ´³ýÈ¥ÖØ¸´×Ö·û¡£Õâ¾ÍÊÇËùÓÐ tr ËùÄܹ»×öµÄ¡£
trÓÃÀ´´Ó±ê×¼ÊäÈëÖÐͨ¹ýÌæ»»»òɾ³ý²Ù×÷½øÐÐ×Ö·ûת»»¡£trÖ÷ÒªÓÃÓÚɾ³ýÎļþÖÐ ......

¼¸ÖÖlinuxÄÚºËÎļþµÄÇø±ð

vmlinux  ±àÒë³öÀ´µÄ×îԭʼµÄÄÚºËÎļþ£¬Î´Ñ¹Ëõ¡£
zImage   ÊÇvmlinux¾­¹ýgzipѹËõºóµÄÎļþ¡£
bzImage bz±íʾ“big zImage”£¬²»ÊÇÓÃbzip2ѹËõµÄ¡£Á½ÕߵIJ»Í¬Ö®´¦ÔÚÓÚ£¬zImage½âѹËõÄں˵½µÍ¶ËÄÚ´æ(µÚÒ»¸ö640K)£¬bzImage½âѹËõÄں˵½¸ß¶ËÄÚ´æ(1MÒÔÉÏ)¡£Èç¹ûÄں˱ȽÏС£¬ÄÇô²ÉÓÃzImage»òbzI ......

Linux Äں˱à³Ìѧϰ


Linux 
Äں˱à³Ìѧϰ
³£³£ÓÐÈËÎÊ£ºÎÒÏëѧϰÄںˣ¬ÐèҪʲô»ù´¡Âð£¿Linus Torvalds
±¾ÈËÊÇÕâÑù»Ø´ðµÄ£ºÄã±ØÐëʹÓùý
Linux
¡£ Õâ¸ö
……
»¹ÊÇÓеãÌ«·ºÁ˰ɣ¬ÎÒÏëÏÂÃæ¼¸¸ö»ù´¡¿ÉÄÜ»¹ÊÇÐèÒªµÄ£¬¾¡¹Ü²»Ò»¶¨±ØÐ裺
1, ¹ØÓÚ²Ù×÷ϵͳÀíÂÛµÄ×î³õ¼¶µÄ֪ʶ¡£²»ÐèҪͨ¶Á²¢Àí½â¡¶²Ù×÷ϵͳ¸ÅÄ ......

Ìá¸ßLinux¹ÜÀíЧÂʵÄÈý¸ö¼¼ÇÉ


¹ÜÀíÔ±ÏëÒªÌá¸ßLinux¹ÜÀíЧÂÊÊÇÒª×ñѭһЩ¹ÜÀí¼¼Çɵģ¬ÕâÀï¼òµ¥½éÉÜÓйØLinux¹ÜÀíЧÂʵÄÈý¸ö¼¼ÇÉ£ºÐ¶ÔØÎÞÏìÓ¦µÄ DVD Çý¶¯Æ÷¡¢»Ö¸´³öÏÖÎÊÌâµÄÆÁÄ»¡¢ÆÁĻЭ×÷¡£ÏàÐÅËûÃÇ»á¶Ô¹ÜÀíԱЧÂÊÓÐÌá¸ß¡£
¼¼ÇÉ 1£ºÐ¶ÔØÎÞÏìÓ¦µÄ DVD Çý¶¯Æ÷
ÍøÂçÐÂÊֵľ­Àú£º°´Ï·þÎñÆ÷£¨ÔËÐлùÓÚ Redmond µÄ²Ù×÷ϵͳ£©DVD Çý¶¯Æ÷É쵀 Eject °´Å¥Ê±£¬ ......

½«Linux´úÂëÒÆÖ²µ½WindowsµÄ¼òµ¥·½·¨(1)

Ò»£®Ç°ÑÔ
¡¡¡¡LinuxÓµÓзḻ¸÷ÖÖÔ´´úÂë×ÊÔ´,µ«ÊǴ󲿷ִúÂëÔÚWindowsƽ̨Çé¿öÊÇÎÞ·¨Õý³£±àÒëµÄ¡£Windowsƽ̨¸ù±¾ÎÞ·¨Ö±½ÓÀûÓÃÕâЩԴ´úÂë×ÊÔ´¡£Èç¹ûÏëҪʹÓÃÍêÕûµÄ´úÂ룬¾ÍÒª×öÒÆÖ²¹¤×÷¡£ÒòΪC/C++ LibraryµÄ²»Í¬ºÍÆäËûµÄһЩԭÒò£¬ÒÆÖ²C/C++´úÂëÊÇÒ»ÏîÀ§ÄѵŤ×÷¡£±¾ÎĽ«ÒÔÒ»¸öʵ¼ÊµÄÀý×Ó£¨Tar£©À´ËµÃ÷ÈçºÎ°ÑLinux´úÂëÒÆÖ² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ