Conversation
01_git/scissors.c
Outdated
| { | ||
| printf("\nYou chose %c and I choose %c, You win !\n\n", input_from_user, machine_chose); | ||
| } | ||
| } No newline at end of file |
03_module/hello.c
Outdated
| MODULE_LICENSE("GPL"); | ||
|
|
||
| module_init(hello_init); | ||
| module_exit(hello_exit); No newline at end of file |
01_git/scissors.c
Outdated
| @@ -0,0 +1,68 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include<time.h> | |||
01_git/scissors.c
Outdated
|
|
||
| const char arr[3] = {'r', 'p', 's'}; | ||
|
|
||
| int machine_rand(void) { |
There was a problem hiding this comment.
optional size might be reduced to uint8_t
01_git/scissors.c
Outdated
| #include <stdlib.h> | ||
| #include<time.h> | ||
|
|
||
| const char arr[3] = {'r', 'p', 's'}; |
There was a problem hiding this comment.
static const char ROCK = 'r';
static const char PAPER = 'p';
static const char SCISSORS = 's';
static const char arr[3] = {ROCK, PAPER, SCISSORS};
01_git/scissors.c
Outdated
| { | ||
| result = -1; | ||
| } | ||
| else if (input_user == 'r' && arr[machine_choice_int] == 's') |
03_module/hello.c
Outdated
| #include <linux/init.h> | ||
| #include <linux/kernel.h> | ||
|
|
||
| int a = 0; |
03_module/hello.c
Outdated
| MODULE_LICENSE("GPL"); | ||
|
|
||
| module_init(hello_init); | ||
| module_exit(hello_exit); No newline at end of file |
There was a problem hiding this comment.
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#1: FILE: /air/Documents/trainings/linux/kernel/pro-camp/2021/03_module/hello.c:1:
+#include <linux/module.h>
ERROR: trailing whitespace
#6: FILE: /air/Documents/trainings/linux/kernel/pro-camp/2021/03_module/hello.c:6:
+int a = 0; $
ERROR: do not initialise globals to 0
#6: FILE: /air/Documents/trainings/linux/kernel/pro-camp/2021/03_module/hello.c:6:
+int a = 0;
ERROR: do not initialise globals to 0
#7: FILE: /air/Documents/trainings/linux/kernel/pro-camp/2021/03_module/hello.c:7:
+int b = 0;
WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...
#14: FILE: /air/Documents/trainings/linux/kernel/pro-camp/2021/03_module/hello.c:14:
- printk(KERN_WARNING "\na + b = %i\n", a + b);
WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...
#20: FILE: /air/Documents/trainings/linux/kernel/pro-camp/2021/03_module/hello.c:20:
- printk(KERN_WARNING "\na - b = %i\n", (a < b)?(b - a):(a - b));
WARNING: adding a line without newline at end of file
#27: FILE: /air/Documents/trainings/linux/kernel/pro-camp/2021/03_module/hello.c:27:
+module_exit(hello_exit);
04_basic_struct/kobj.c
Outdated
| char *buf) | ||
| { | ||
| struct msg_obj *curr_msg; | ||
| struct list_head * listptr; |
| len += strlen(curr_msg->data); | ||
| } | ||
|
|
||
| return len; |
04_basic_struct/kobj.c
Outdated
|
|
||
| static void hello_exit(void) | ||
| { | ||
|
|
| KERNELDIR ?= /home/oporoknyi/Desktop/build/buildroot-2021.02.7/output/build/linux-5.10.7 #WARNING relative path | ||
|
|
||
| obj-m := kobj.o | ||
|
|
| @@ -0,0 +1,64 @@ | |||
| # delete temporary files | |||
| sleep 1 | ||
| # check if Ctrl-C pressed and exit | ||
| trap 'cleanup' INT | ||
| done No newline at end of file |
…ous read of it, userspace application which returns absolute time in user space
| } | ||
| printf("\n"); | ||
| return 0; | ||
| } No newline at end of file |
| //switch off cursor | ||
| printf("\033[?25l"); | ||
|
|
||
| while (1) { |
01_git, 03_module are done