-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lesson06: Update module source (show real datetime, new string parsing)
Signed-off-by: Oleg.Khokhlov <[email protected]>
- Loading branch information
Showing
3 changed files
with
108 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
bash$ | ||
bash$ ./chkpatch.sh omod6_kern_time.c | ||
WARNING: Prefer kstrto<type> to single variable sscanf | ||
#138: FILE: /home/olegh/gl-kernel-training-2018/06-TimeManagement/omod6_kern_time.c:138: | ||
+ if (sscanf(buf, "%d", &interval) == 1) { | ||
+ cp = strchr(buf, ' '); | ||
+ if (cp) { | ||
+ while (*cp == ' ') | ||
+ cp++; | ||
+ for (n = 0; n < sizeof(LogMessage) - 1; n++) { | ||
+ if (*cp < ' ') | ||
+ break; | ||
+ LogMessage[n] = *cp++; | ||
+ } | ||
+ LogMessage[n] = 0; | ||
+ } | ||
+ } | ||
|
||
total: 0 errors, 1 warnings, 222 lines checked | ||
|
||
NOTE: For some of the reported defects, checkpatch may be able to | ||
mechanically convert to the typical style using --fix or --fix-inplace. | ||
|
||
/home/olegh/gl-kernel-training-2018/06-TimeManagement/omod6_kern_time.c has style problems, please review. | ||
|
||
NOTE: Ignored message types: LONG_LINE LONG_LINE_COMMENT LONG_LINE_STRING | ||
|
||
NOTE: If any of the errors are false positives, please report | ||
them to the maintainer, see CHECKPATCH in MAINTAINERS. | ||
bash$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
bash$ | ||
bash$ | ||
bash$ sudo insmod omod6_kern_time.ko | ||
bash$ cat /sys/class/omod6/ktime | ||
ktime (50320923 ticks, 250 HZ): | ||
1 module call | ||
4 sec from last call | ||
1542138138 sec curr abs time from Epoch (2018.11.13, 19:42:18) | ||
1542138134 sec prev call abs time from Epoch | ||
0 ms - Timer Interval | ||
0 times timer called | ||
bash$ | ||
bash$ | ||
bash$ echo "2000 Hello from module timer!" > /sys/class/omod6/ktime | ||
bash$ | ||
bash$ cat /sys/class/omod6/ktime | ||
ktime (50325075 ticks, 250 HZ): | ||
2 module call | ||
17 sec from last call | ||
1542138155 sec curr abs time from Epoch (2018.11.13, 19:42:35) | ||
1542138138 sec prev call abs time from Epoch | ||
2000 ms - Timer Interval | ||
1 times timer called | ||
bash$ | ||
bash$ | ||
bash$ dmesg | ||
[201578.642960] omod6 Kernel time function test module started. | ||
[201593.096793] omod6 store (2000, 'Hello from module timer!') | ||
[201593.096800] omod6 Timer started (interval=2000) | ||
[201595.113490] omod6 timer[1]: Hello from module timer! (delay = 2020 ms) | ||
bash$ | ||
bash$ | ||
bash$ sudo rmmod omod6_kern_time | ||
bash$ | ||
bash$ |