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

Opokornyi #126

Open
wants to merge 5 commits into
base: ostap.pokornyi
Choose a base branch
from
Open

Conversation

opokornyi
Copy link

01_git, 03_module are done

{
printf("\nYou chose %c and I choose %c, You win !\n\n", input_from_user, machine_chose);
}
}
Copy link

Choose a reason for hiding this comment

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

newline

MODULE_LICENSE("GPL");

module_init(hello_init);
module_exit(hello_exit);
Copy link

Choose a reason for hiding this comment

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

newline

@@ -0,0 +1,68 @@
#include <stdio.h>
#include <stdlib.h>
#include<time.h>
Copy link

Choose a reason for hiding this comment

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

#include <time.h>


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

int machine_rand(void) {
Copy link

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 Show resolved Hide resolved
01_git/scissors.c Show resolved Hide resolved
#include <stdlib.h>
#include<time.h>

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

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

{
result = -1;
}
else if (input_user == 'r' && arr[machine_choice_int] == 's')
Copy link

Choose a reason for hiding this comment

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

ROCK ... SCISSORS

#include <linux/init.h>
#include <linux/kernel.h>

int a = 0;
Copy link

Choose a reason for hiding this comment

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

may be static

MODULE_LICENSE("GPL");

module_init(hello_init);
module_exit(hello_exit);
Copy link

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

char *buf)
{
struct msg_obj *curr_msg;
struct list_head * listptr;
Copy link

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;
Copy link

Choose a reason for hiding this comment

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

strlen(buf)


static void hello_exit(void)
{

Copy link

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

Copy link

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
@@ -0,0 +1,64 @@
# delete temporary files
Copy link

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
Copy link

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

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) {
Copy link

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