TAILIEUCHUNG - linux device drivers 2nd edition phần 3

Có nhiều thay đổi với Linux kể từ khi ấn bản đầu tiên của cuốn sách này xuất hiện. Linux chạy trên bộ xử lý nhiều hơn nữa và hỗ trợ một loạt rộng lớn hơn nhiều của phần cứng. Nhiều người trong số các giao diện lập trình nội bộ đã thay đổi đáng kể. Vì vậy, ấn bản thứ hai. | Debugging by Querying says that proc entries associated with device drivers should go in the subdirectory driver scull could place its entry there simply by giving its name as driver scullmem. Entries in proc of course should be removed when the module is unloaded. remove_proc_entry is the function that undoes what create_proc_read_entry did remove_proc_entry scullmem NULL parent dir The alternative method for creating a proc entry is to create and initialize a proc_dir_entry structure and pass it to proc_register_dynamic version or proc_register version which assumes a dynamic file if the inode number in the structure is 0 . As an example consider the following code that scull uses when compiled against headers static int scull_get_info char buf char start off_t offset int len int unused int eof 0 return scull_read_procmem buf start offset len eof NULL struct proc_dir_entry scull_proc_entry namelen 8 name scullmem mode S_IFREG S_IRUGO nlink 1 get_info scull_get_info static void scull_create_proc proc_register_dynamic proc_root scull_proc_entry static void scull_remove_proc proc_unregister proc_root The code declares a function using the get_info interface and fills in a proc_dir_entry structure that is registered with the filesystem. This code provides compatibility across the and kernels with a little support from macro definitions in . It uses the get_info interface because the kernel did not support read_proc. Some more work with ifdef could have made it use read_proc with Linux but the benefits would be minor. 107 Chapter 4 Debugging Techniques The ioctl Method ioctl which we show you how to use in the next chapter is a system call that acts on a file descriptor it receives a number that identifies a command to be performed and optionally another argument usually a pointer. As an alternative to using the proc filesystem you can implement a few ioctl commands tailored for debugging. These commands can

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.