Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK07: Update kenel module with procfs API #135

Open
wants to merge 14 commits into
base: Ivan.Stepanenko
Choose a base branch
from

Conversation

istepanenko
Copy link

Existing "wimbledone" module already has sysfs interface
"/sys/kernel/wimbledon/list". By reading and wrinting this
file "show" and "store" callbacks are called and counted.

With this update the module creates a folder "wimbeldon" and
child files:

  • "/proc/wimbeldon/nshow"
    Returns amount of show callbacks (cat /sys/kernel/wimbledon/list)

  • "/proc/wimbeldon/nstore"
    Returns amount of store callbacks (echo >> /sys/kernel/wimbledon/list)

  • "/proc/wimbeldon/auth_name"
    Returns module author name

Output from the orange board is attached.

Signed-off-by: Ivan Stepanenko [email protected]

istepanenko and others added 14 commits November 21, 2021 19:36
The game logic is defined in "rock_paper_scissors" module.
Additional task printing md5 checksum of computer's choice before human's move is added.

$ make clean all && ./rock-paper-scissors
/bin/rm -rf *.o a.out rock-paper-scissors
gcc -c rock_paper_scissors.c -I.
gcc -c main.c -I.
gcc rock_paper_scissors.o main.o -o rock-paper-scissors -I. -lcrypto
Random choice: s md5: 03c7c0ace395d80182db07ae2c30f034
Please choose: rock (r) - paper (p) - scissors (s)
r
You choose rock, I choose scissors
You win: rock beats scissors

Signed-off-by: Ivan Stepanenko <[email protected]>
It uses optional script arugment to define polling folder with default value "/dev".
The script is polling that folder and uses "diff" utility to detect changes
in the output. Here is the script run with current target folder and new
1, 2 files playing role of new devices.

$ ./hwdetect.sh .
Polling folder: .
> ./1 2021-11-21 22:25:33.907655100 +0200
> ./2 2021-11-21 22:25:40.335717754 +0200

Signed-off-by: Ivan Stepanenko <[email protected]>
…r_scissors_solution

TASK1: Add rock-paper-scissors game
…detector_solution

TASK02 Add hot plugged hardware detector script
Add description for module task

Signed-off-by: Serhii Perederii <[email protected]>
Add home task for lection Basic Data structures

Signed-off-by: Oleksandr Posukhov <[email protected]>
On read from the “list” attr. it shows content of the linked list.
On write to the “list” attr. it adds new string to the linked list.

Since the list items separator is not specified - content is shown as it
was inserted including line endings. This gives flexibility of using
"echo" with "-n" argument and without.

Signed-off-by: Ivan Stepanenko <[email protected]>
The module accepts two integer parameters n1 and n2 and provides:
 - A sum of parameters upon the module load
 - A substration of parameters upon the module unload

Signed-off-by: Ivan Stepanenko <[email protected]>
Add descriptions of tasks for lesson 5.

Signed-off-by: Yevgen Kovalyov <[email protected]>
First read of the "last_abs_time" attribute returns -1
next reads return epoch time of the previous read
    cat /sys/kernel/time_attr_presenter/last_abs_time
    -1
    cat /sys/kernel/time_attr_presenter/last_abs_time
    1639337982.183260522

First read of the "last_relative_time" attribute returns -1
next reads return time passed since previous read
    cat /sys/kernel/time_attr_presenter/last_relative_time
    -1
    cat /sys/kernel/time_attr_presenter/last_relative_time
    0.636000000

Signed-off-by: Ivan Stepanenko <[email protected]>
Useed clock_gettime() from time.h and different clock ids.
Provided dump files with results.

Signed-off-by: Ivan Stepanenko <[email protected]>
Add task for implementation of procFS API

Signed-off-by: Oleksandr Posukhov <[email protected]>
Existing "wimbledone" module already has sysfs interface
"/sys/kernel/wimbledon/list". By reading and wrinting this
file "show" and "store" callbacks are called and counted.

With this update the module creates a folder "wimbeldon" and
child files:
* "/proc/wimbeldon/nshow"
  Returns amount of show callbacks (cat /sys/kernel/wimbledon/list)

* "/proc/wimbeldon/nstore"
  Returns amount of store callbacks (echo >> /sys/kernel/wimbledon/list)

* "/proc/wimbeldon/auth_name"
  Returns module author name

Output from the orange board is attached.

Signed-off-by: Ivan Stepanenko <[email protected]>
@alexposukhov
Copy link
Contributor

Please rebase this task to main branch

@alexposukhov
Copy link
Contributor

Please fix all checkpatch isuues

@alexposukhov alexposukhov added Change requested change requested and removed Ready for review labels Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Change requested change requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants