Skip to main content.

5.8.1. Proc, workqueue, Irq

Task:

Write a small module that creates a proc entry that can be read or written. Text written is rot13 scrambled and can be read back with the same proc entry.

Tips:

static void rot_buf(char *buf, int rotate)
{
        int x;

        for (x=0; buf[x] != '\0'; x++) {
                if (islower (buf[x]))
                        buf[x] = ((buf[x] + rotate - 'a') % 26) + 'a';
                else if (isupper (buf[x]))
                        buf[x] = ((buf[x] + rotate - 'A') % 26) + 'A';
                else if (isdigit (buf[x]))
                        buf[x] = ((buf[x] + rotate - '0') % 10) + '0';
        }
}

5.7.9. Porting of Linux 1. Denx Training Topics
Prev Home