17.8.2. seq_file

Writing trivial read File operations is repetitive and error prone. The seq_file API makes the process much easier for those trivial cases:

./seq_file.sh
echo $?

Outcome: the test passes:

0

Sources:

In this example we create a debugfs file that behaves just like a file that contains:

0
1
2

However, we only store a single integer in memory and calculate the file on the fly in an iterator fashion.

Bibliography: