kernelthread.com

Linux Loadable Kernel Module

The Towers of Hanoi as a Linux Loadable Kernel Module.

The module upon being loaded creates a file /proc/hanoi. To get a list of moves for a Hanoi puzzle with N disks, write N to /proc/hanoi. That is, simply do:

echo N > /proc/hanoi

N must be a positive integer between 1 and 9, both inclusive (the limits are compile time options). The file size of /proc/hanoi is modified to N if a valid number is encountered by the module. Thereafter, the list of moves can be read from /proc/hanoi:

cat /proc/hanoi

hanoi-lkm-lnx.tar.gz

Download

hanoi-lkm-lnx.tar.gz