aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Brattlof <hello@bryanbrattlof.com>2020-07-15 15:58:18 -0400
committerBryan Brattlof <hello@bryanbrattlof.com>2020-07-15 15:58:18 -0400
commitc38be28ac40510ff224609e8f47209ca4ca62b8c (patch)
tree68f432b5247857880ed1bddb8d6a8c4f802ae914
parent0e535bf82f1cc4baa415b02dc0bc168cc19ab709 (diff)
downloadeudyptula-challenge-c38be28ac40510ff224609e8f47209ca4ca62b8c.tar.gz
eudyptula-challenge-c38be28ac40510ff224609e8f47209ca4ca62b8c.tar.bz2
task 12: add task readme
-rw-r--r--readme.rst6
-rw-r--r--tasks/12/readme81
2 files changed, 85 insertions, 2 deletions
diff --git a/readme.rst b/readme.rst
index 8324c3b..bf4fbbe 100644
--- a/readme.rst
+++ b/readme.rst
@@ -1,5 +1,5 @@
-The Edyptula Challenge
-######################
+The Eudyptula Challenge
+#######################
From the website: http://eudyptula-challenge.org/
@@ -34,3 +34,5 @@ Here are the links to each task's readme:
10. Submit a Patch: `task <https://git.bryanbrattlof.com/eudyptula-challenge/tree/tasks/10/readme>`__
11. A Driver Patch: `task <https://git.bryanbrattlof.com/eudyptula-challenge/tree/tasks/11/readme>`__
+
+12. Linked Lists in Kernel Space: `task <https://git.bryanbrattlof.com/eudyptula-challenge/tree/tasks/12/readme>`__
diff --git a/tasks/12/readme b/tasks/12/readme
new file mode 100644
index 0000000..e18cb3c
--- /dev/null
+++ b/tasks/12/readme
@@ -0,0 +1,81 @@
+Task 12
+=======
+
+Nice job with the driver patch. That took some work in finding the
+proper place to modify, and demonstrates a great skill in tracking down
+issues when you can't get a specific piece of hardware working.
+
+Now let's step back from drivers (they are boring things), and focus on
+the kernel core. To do that, we need to go way back to the basics --
+stuff you would learn in your "intro to data structures" class, if you
+happened to take one.
+
+Yes, I'm talking about linked lists.
+
+The kernel has a unique way of creating and handling linked lists, that
+is quite different than the "textbook" way of doing so. But, it turns
+out to be faster, and simpler, than a "textbook" would describe, so
+that's a good thing.
+
+For this task, write a kernel module, based on your cleaned up one from
+task 04, that does the following:
+
+ - You have a structure that has 3 fields:
+
+ char name[20];
+ int id;
+ bool busy;
+
+ name this structure "identity".
+
+ - Your module has a static variable that points to a list of these
+ "identity" structures.
+
+ - Write a function that looks like:
+
+ int identity_create(char *name, int id)
+
+ that creates the structure "identity", copies in the 'name' and 'id'
+ fields and sets 'busy' to false. Proper error checking for out of
+ memory issues is required. Return 0 if everything went ok; an error
+ value if something went wrong.
+
+ - Write a function that looks like:
+
+ struct identity *identity_find(int id);
+
+ that takes a given id, iterates over the list of all ids, and
+ returns the proper 'struct identity' associated with it. If the
+ identity is not found, return NULL.
+
+ - Write a function that looks like:
+
+ void identity_destroy(int id);
+
+ that given an id, finds the proper 'struct identity' and removes it
+ from the system.
+
+ - Your module_init() function will look much like the following:
+
+ struct identity *temp;
+
+ identity_create("Alice", 1);
+ identity_create("Bob", 2);
+ identity_create("Dave", 3);
+ identity_create("Gena", 10);
+
+ temp = identity_find(3);
+ pr_debug("id 3 = %s\n", temp->name);
+
+ temp = identity_find(42);
+ if (temp == NULL)
+ pr_debug("id 42 not found\n");
+
+ identity_destroy(2);
+ identity_destroy(1);
+ identity_destroy(10);
+ identity_destroy(42);
+ identity_destroy(3);
+
+ Bonus points for properly checking return values of the above
+ functions. \ No newline at end of file