Chapter 2 : Character Device Driver

  1. Write a Linux kernel module to implement a character device driver along with module parameters
    register_chrdev_region
    unregister_chrdev_region
    cdev_init
    cdev_add
    cdev_del
    
  2. Write a character device driver with proc entry support; Use below APIs
    proc_root_init
    proc_flush_pid
    proc_symlink
    proc_mkdir
    proc_create_mount_point
    _proc_mkdir
    proc_mkdir_data
    proc_mkdir_mode
    proc_create_seq_private
    proc_create_seq_data
    proc_create_seq
    proc_create_single
    proc_create_single_data
    proc_create
    proc_create_data
    proc_set_size
    proc_set_user
    proc_get_parent_data
    proc_remove
    remove_proc_entry
    remove_proc_subtree
    proc_create_net_data
    proc_create_net
    proc_create_net_single
    
  3. Write a character device driver with sys entry support; Use below APIs
    sysfs_create_link
    sysfs_remove_link
    sysfs_create_file
    sysfs_remove_file
    sysfs_attr_init
    
    
  4. Write a character device driver which uses kernel threads
    kthread_create
    kthread_should_stop
    wake_up_process
    
  5. Write a character device driver which uses tasklets
    tasklet_init
    tasklet_disable
    tasklet_kill
    tasklet_hi_schedule
    tasklet_schedule
    
  6. Write a character device driver which uses timers
    DEFINE_TIMER
    add_timer
    mod_timer
    del_timer
    del_timer_sync
    
    
  7. Write a character device driver which uses work queues
    INIT_WORK
    schedule_work
    schedule_delayed_work
    queue_work
    queue_delayed_work
    mod_delayed_work
    
    flush_work
    flush_delayed_work
    cancel_work_sync
    cancel_delayed_work
    cancel_delayed_work_sync
    
    create_workqueue
    create_freezable_workqueue
    create_singlethread_workqueue
    
  8. Write a character device driver which implements stack, queues, circular queues; Use below APIs * “./app insert”, application command to insert a node * “./app delete”, application command to delete a node * “./app display”, application command to display the list

    list_add
    list_add_tail
    list_del
    list_del_init
    list_move
    list_move_tail
    list_empty
    list_splice
    list_splice_init
    list_for_each
    list_for_each_entry
    list_for_each_entry_reverse
    list_for_each_entry_safe
    list_for_each_entry_safe_reverse
    
  9. Write a character device driver which uses all of below mentioned kfifo apis
    kfifo_alloc
    kfifo_init
    DECLARE_KFIFO
    INIT_KFIFO
    kfifo_in
    kfifo_out
    kfifo_out_peek
    kfifo_size
    kfifo_len
    kfifo_avail
    kfifo_is_empty
    kfifo_is_full
    kfifo_free
    
  10. Write a character device driver which uses mutex
    DEFINE_MUTEX
    mutex_init
    mutex_lock
    mutex_lock_interruptible
    mutex_unlock
    mutex_destroy
    
  11. Write a character device driver which uses semaphore
    DEFINE_SEMAPHORE
    up
    down
    down_interruptible
    down_killable
    down_trylock
    down_timeout
    
  12. Write a character device driver which uses spin_locks
    DEFINE_SPINLOCK
    spin_lock
    spin_unlock
    spin_lock_bh
    spin_unlock_bh
    spin_lock_irq
    spin_unlock_irq
    spin_lock_irqsave
    spin_unlock_irqrestore
    
  13. Write a character device driver which uses wait_queues
    DEFINE_WAIT
    add_wait_queue
    remove_wait_queue
    init_waitqueue_head
    init_waitqueue_head
    
    wait_event
    wait_event_timeout
    wait_event_interruptible
    wait_event_interruptible_timeout
    wait_event_idle
    wait_event_idle_exclusive
    wait_event_idle_timeout
    wait_event_idle_exclusive_timeout
    wait_event_interruptible_locked
    wait_event_interruptible_locked_irq
    wait_event_interruptible_exclusive_locked
    wait_event_interruptible_exclusive_locked_irq
    wait_event_killable
    wait_event_killable_timeout
    wait_event_lock_irq_cmd
    wait_event_lock_irq
    wait_event_interruptible_lock_irq_cmd
    wait_event_interruptible_lock_irq
    wait_event_interruptible_lock_irq_timeout
    wait_event_lock_irq_timeout
    
    wake_up
    wake_up_nr
    wake_up_all
    wake_up_locked
    wake_up_all_locked
    wake_up_interruptible
    wake_up_interruptible_nr
    wake_up_interruptible_all
    wake_up_interruptible_sync
    
  14. Write a character device driver which uses completions
    DECLARE_COMPLETION
    init_completion
    
    wait_for_completion
    wait_for_completion_timeout
    wait_for_completion_io
    wait_for_completion_io_timeout
    
    complete
    complete_all
    
  15. Write a character device driver which uses atomic operations
    atomic_read
    atomic_write
    atomic_add_return_relaxed
    atomic_sub_return_relaxed
    atomic_fetch_add_relaxed
    atomic_fetch_sub_relaxed
    atomic_andnot
    atomic_fetch_and_relaxed
    atomic_fetch_andnot_relaxed
    atomic_fetch_or_relaxed
    atomic_fetch_xor_relaxed
    atomic_cmpxchg
    atomic_xchg
    
  16. Write a character device driver which uses time_xxxx apis
    time_after
    time_before
    time_after_eq
    time_before_eq
    time_in_range
    time_in_range_open
    time_after64
    time_before64
    time_after_eq64
    time_before_eq64
    time_in_range64
    
  17. Write a character device driver which uses delay apis
    udelay
    ndelay
    mdelay
    
  18. Write a character device driver which uses RCU
    rcu_read_lock
    rcu_read_unlock
    rcu_assign_pointer
    rcu_dereference
    rcu_dereference_rtnl
    rcu_access_pointer
    synchronize_rcu
    
  19. Write a character device driver in which two kernel threads are exchanging data continuously

  20. Write a character device driver in which 2 tasklets, 2 workqueues, 2 threads, 2 timers are inserting, deleting nodes in a linked list continuously