-
Notifications
You must be signed in to change notification settings - Fork 33
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
Opokornyi #126
base: ostap.pokornyi
Are you sure you want to change the base?
Opokornyi #126
Conversation
01_git/scissors.c
Outdated
{ | ||
printf("\nYou chose %c and I choose %c, You win !\n\n", input_from_user, machine_chose); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
03_module/hello.c
Outdated
MODULE_LICENSE("GPL"); | ||
|
||
module_init(hello_init); | ||
module_exit(hello_exit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
01_git/scissors.c
Outdated
@@ -0,0 +1,68 @@ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#include<time.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ROCK ... SCISSORS
03_module/hello.c
Outdated
#include <linux/init.h> | ||
#include <linux/kernel.h> | ||
|
||
int a = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be static
03_module/hello.c
Outdated
MODULE_LICENSE("GPL"); | ||
|
||
module_init(hello_init); | ||
module_exit(hello_exit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use monilith code style
len += strlen(curr_msg->data); | ||
} | ||
|
||
return len; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strlen(buf)
04_basic_struct/kobj.c
Outdated
|
||
static void hello_exit(void) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line
KERNELDIR ?= /home/oporoknyi/Desktop/build/buildroot-2021.02.7/output/build/linux-5.10.7 #WARNING relative path | ||
|
||
obj-m := kobj.o | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHONY
@@ -0,0 +1,64 @@ | |||
# delete temporary files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#/bin/bash
sleep 1 | ||
# check if Ctrl-C pressed and exit | ||
trap 'cleanup' INT | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
…ous read of it, userspace application which returns absolute time in user space
} | ||
printf("\n"); | ||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
//switch off cursor | ||
printf("\033[?25l"); | ||
|
||
while (1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not use endless loop
01_git, 03_module are done