tailieunhanh - LINUX DEVICE DRIVERS 3rd edition phần 9

Cách đơn giản nhất để ngăn chặn sự mở rộng của bản đồ là để thực hiện một phương pháp nopage đơn giản mà luôn luôn gây ra một tín hiệu xe buýt được gửi đến quá trình đứt gãy. Phương pháp này sẽ giống như thế này: Như chúng ta đã thấy, phương pháp nopage được gọi là chỉ khi quá trình dereferences một địa chỉ nằm trong một VMA được biết đến nhưng mà hiện nay vẫn không có trang vào bảng hợp lệ | Quick Reference include linux int register_blkdev unsigned int major const char name int unregister_blkdev unsigned int major const char name register_blkdev registers a block driver with the kernel and optionally obtains a major number. A driver can be unregistered with unregister_blkdev. struct block_device_operations Structure that holds most of the methods for block drivers. include linux struct gendisk Structure that describes a single block device within the kernel. struct gendisk alloc_disk int minors void add_disk struct gendisk gd Functions that allocate gendisk structures and return them to the system. void set_capacity struct gendisk gd sector_t sectors Stores the capacity of the device in 512-byte sectors within the gendisk structure. void add_disk struct gendisk gd Adds a disk to the kernel. As soon as this function is called your disk s methods can be invoked by the kernel. int check_disk_change struct block_device bdev Akernel function that checks for a media change in the given disk drive and takes the required cleanup action when such a change is detected. include linux request_queue_t blk_init_queue request_fn_proc request spinlock_t lock void blk_cleanup_queue request_queue_t Functions that handle the creation and deletion of block request queues. struct request elv_next_request request_queue_t queue void end_request struct request req int success elv_next_request obtains the next request from a request queue end_request may be used in very simple drivers to mark the completion of or part of a request. void blkdev_dequeue_request struct request req void elv_requeue_request request_queue_t queue struct request req Functions that remove a request from a queue and put it back on if necessary. void blk_stop_queue request_queue_t queue void blk_start_queue request_queue_t queue If you need to prevent further calls to your request method a call to blk_stop_queue does the trick. A call to blk_start_queue is necessary to cause your

TỪ KHÓA LIÊN QUAN