Skip to content

Opokornyi#126

Open
opokornyi wants to merge 5 commits into
Kernel-GL-HRK:ostap.pokornyifrom
opokornyi:opokornyi
Open

Opokornyi#126
opokornyi wants to merge 5 commits into
Kernel-GL-HRK:ostap.pokornyifrom
opokornyi:opokornyi

Conversation

@opokornyi
Copy link
Copy Markdown

01_git, 03_module are done

Comment thread 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

Comment thread 03_module/hello.c Outdated
MODULE_LICENSE("GPL");

module_init(hello_init);
module_exit(hello_exit); No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

Comment thread 01_git/scissors.c Outdated
@@ -0,0 +1,68 @@
#include <stdio.h>
#include <stdlib.h>
#include<time.h>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include <time.h>

Comment thread 01_git/scissors.c Outdated

const char arr[3] = {'r', 'p', 's'};

int machine_rand(void) {
Copy link
Copy Markdown

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

Comment thread 01_git/scissors.c
Comment thread 01_git/scissors.c
Comment thread 01_git/scissors.c Outdated
#include <stdlib.h>
#include<time.h>

const char arr[3] = {'r', 'p', 's'};
Copy link
Copy Markdown

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};

Comment thread 01_git/scissors.c Outdated
{
result = -1;
}
else if (input_user == 'r' && arr[machine_choice_int] == 's')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ROCK ... SCISSORS

Comment thread 03_module/hello.c Outdated
#include <linux/init.h>
#include <linux/kernel.h>

int a = 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be static

Comment thread 03_module/hello.c Outdated
MODULE_LICENSE("GPL");

module_init(hello_init);
module_exit(hello_exit); No newline at end of file
Copy link
Copy Markdown

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);

Comment thread 04_basic_struct/kobj.c Outdated
char *buf)
{
struct msg_obj *curr_msg;
struct list_head * listptr;
Copy link
Copy Markdown

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

Comment thread 04_basic_struct/kobj.c
len += strlen(curr_msg->data);
}

return len;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strlen(buf)

Comment thread 04_basic_struct/kobj.c Outdated

static void hello_exit(void)
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line

Comment thread 04_basic_struct/Makefile
KERNELDIR ?= /home/oporoknyi/Desktop/build/buildroot-2021.02.7/output/build/linux-5.10.7 #WARNING relative path

obj-m := kobj.o

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHONY

@opokornyi opokornyi added Ready for review and removed Change requested change requested labels Dec 23, 2021
Comment thread 02_bash/hwdetect
@@ -0,0 +1,64 @@
# delete temporary files
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#/bin/bash

Comment thread 02_bash/hwdetect
sleep 1
# check if Ctrl-C pressed and exit
trap 'cleanup' INT
done No newline at end of file
Copy link
Copy Markdown

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
Comment thread 05_timers/App/main.c
}
printf("\n");
return 0;
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

Comment thread 05_timers/App/main.c
//switch off cursor
printf("\033[?25l");

while (1) {
Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants