05fd4a8d2c4c0507b4a4ad7a41d4f87515c98b0b — Bryan Brattlof 3 years ago 2a8cb71
task 8: add task readme
2 files changed, 46 insertions(+), 0 deletions(-)

M readme.rst
A tasks/08/readme
M readme.rst => readme.rst +2 -0
@@ 26,3 26,5 @@ Here are the links to each task's readme:
6. Miscellaneous Character Drivers: `task <https://git.bryanbrattlof.com/eudyptula-challenge/tree/tasks/06/readme>`__

7. Building Linux-Next: `task <https://git.bryanbrattlof.com/eudyptula-challenge/tree/tasks/07/readme>`__

8. Working with debugfs: `task <https://git.bryanbrattlof.com/eudyptula-challenge/tree/tasks/08/readme>`__

A tasks/08/readme => tasks/08/readme +44 -0
@@ 0,0 1,44 @@
Task 08

We will come back to the linux-next kernel in a later exercise, so don't
go and delete that directory, you'll want it around.  But enough of
building kernels, let's write more code!

This task is much like the 06 task with the misc device, but this time
we are going to focus on another user/kernel interface, debugfs.  It is
rumored that the creator of debugfs said that there is only one rule for
debugfs use, "There are no rules when using debugfs."  So let's take
them up on that offer and see how to use it.

debugfs should be mounted by your distro in /sys/kernel/debug/, if it
isn't, then you can mount it with the line:

    mount -t debugfs none /sys/kernel/debug/

Make sure it is enabled in your kernel, with the CONFIG_DEBUG_FS option,
you will need it for this task.

The task, in specifics is:

  - Take the kernel module you wrote for task 01, and modify it to be
    create a debugfs subdirectory called "eudyptula".  In that
    directory, create 3 virtual files called "id", "jiffies", and "foo".

  - The file "id" operates just like it did for example 06, use the same
    logic there, the file must be readable and writable by any user.

  - The file "jiffies" is to be read only by any user, and when read,
    should return the current value of the jiffies kernel timer.

  - The file "foo" needs to be writable only by root, but readable by
    anyone.  When writing to it, the value must be stored, up to one
    page of data.  When read, which can be done by any user, the value
    must be returned that is stored it it.  Properly handle the fact
    that someone could be reading from the file while someone else is
    writing to it (oh, a locking hint!)

  - When the module is unloaded, all of the debugfs files are cleaned
    up, and any memory allocated is freed.

  - Provide some "proof" this all works.
\ No newline at end of file