Skip to main content.
Navigation:
DENX
>
Training2
>
LddRot13ProcIrq
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
Training2
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
Training2 Home
Changes
Index
Search
Go
List of pages in Training2
Search
%SECTION0{name=LddRot13ProcIrq}% 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. * Processing shall not be done within the proc write function, but delayed with a workqueue * Take care of race conditions! * No buffering etc. required; only the last written text can be read back. ---++ Tips: * rot algorithm: <verbatim> 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'; } } </verbatim> * c library functions: =include/linux/ctype.h=
5.7.9. Porting of Linux
1. Denx Training Topics
Prev
Home