Skip to content

Commit 3b90c7f

Browse files
committed
teaching: Add collaboration guideline for SO2 assignments
This documents serves as a guideline for working inside a team. It encourages members to use git and PR, work on a common design, split the work into smaller tasks and then doing peer review. The final result should be the code together with git history logs. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
1 parent 8272958 commit 3b90c7f

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
=============
2+
Collaboration
3+
=============
4+
5+
Collaboration is essential in open source world and we encourage you
6+
to pick a team partner to work on selected assignments.
7+
8+
Here is a simple guide to get you started:
9+
10+
1. Use Github / Gitlab
11+
----------------------
12+
13+
Best way to share your work inside the team is to use a version control system (VCS)
14+
in order to track each change. Mind that you must make your repo private and only allow
15+
read/write access rights to team members.
16+
17+
2. Start with a skeleton for the assignment
18+
-------------------------------------------
19+
20+
Add `init`/`exit` functions, driver operations and global structures that you driver might need.
21+
22+
.. code-block:: c
23+
24+
// SPDX-License-Identifier: GPL-2.0
25+
/*
26+
* uart16550.c - UART16550 driver
27+
*
28+
* Author: John Doe <john.doe@mail.com>
29+
* Author: Ionut Popescu <ionut.popescu@mail.com>
30+
*/
31+
struct uart16550_dev {
32+
struct cdev cdev;
33+
/*TODO */
34+
};
35+
36+
static struct uart16550_dev devs[MAX_NUMBER_DEVICES];
37+
38+
static int uart16550_open(struct inode *inode, struct file *file)
39+
{
40+
/*TODO */
41+
return 0;
42+
}
43+
44+
static int uart16550_release(struct inode *inode, struct file *file)
45+
{
46+
/*TODO */
47+
return 0;
48+
}
49+
50+
static ssize_t uart16550_read(struct file *file, char __user *user_buffer,
51+
size_t size, loff_t *offset)
52+
{
53+
/*TODO */
54+
}
55+
56+
static ssize_t uart16550_write(struct file *file,
57+
const char __user *user_buffer,
58+
size_t size, loff_t *offset)
59+
{
60+
/*TODO */
61+
}
62+
63+
static long
64+
uart16550_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
65+
{
66+
/*TODO */
67+
return 0;
68+
}
69+
70+
static const struct file_operations uart16550_fops = {
71+
.owner = THIS_MODULE,
72+
.open = uart16550_open,
73+
.release = uart16550_release,
74+
.read = uart16550_read,
75+
.write = uart16550_write,
76+
.unlocked_ioctl = uart16550_ioctl
77+
};
78+
79+
static int __init uart16550_init(void)
80+
{
81+
/* TODO: */
82+
}
83+
84+
static void __exit uart16550_exit(void)
85+
{
86+
/* TODO: */
87+
}
88+
89+
module_init(uart16550_init);
90+
module_exit(uart16550_exit);
91+
92+
MODULE_DESCRIPTION("UART16550 Driver");
93+
MODULE_AUTHOR("John Doe <john.doe@mail.com");
94+
MODULE_AUTHOR("Ionut Popescu <ionut.popescu@mail.com");
95+
96+
3. Add a commit for each individual change
97+
------------------------------------------
98+
99+
First commit must always be the skeleton file. And the rest of the code should be on top of skeleton file.
100+
Please write a good commit mesage. Explain briefly what the commit does and *why* it is necessary.
101+
102+
Follow the seven rules of writing a good commit message: https://cbea.ms/git-commit/#seven-rules
103+
104+
.. code-block:: console
105+
106+
Commit 3c92a02cc52700d2cd7c50a20297eef8553c207a (HEAD -> tema2)
107+
Author: John Doe <john.doe@mail.com>
108+
Date: Mon Apr 4 11:54:39 2022 +0300
109+
110+
uart16550: Add initial skeleton for ssignment #2
111+
112+
This adds simple skeleton file for uart16550 assignment. Notice
113+
module init/exit callbacks and file_operations dummy implementation
114+
for open/release/read/write/ioctl.
115+
116+
Signed-off-by: John Doe <john.doe@mail.com>
117+
118+
4. Split the work inside the team
119+
---------------------------------
120+
121+
Add `TODOs` with each team member tasks. Try to split the work evenly.
122+
123+
Before starting to code, make a plan. On top of your skeleton file, add TODOs with each member tasks. Agree on global
124+
structures and the overlall driver design. Then start coding.
125+
126+
5. Do reviews
127+
-------------
128+
129+
Create Pull Requests with your commits and go through review rounds with your team members. You can follow `How to create a PR` `video <https://www.youtube.com/watch?v=YvoHJJWvn98>`_.
130+
131+
6. Merge the work
132+
-----------------
133+
134+
The final work is the result of merging all the pull requests. Following the commit messages
135+
one should clearly understand the progress of the code and how the work was managed inside the team.
136+
137+
.. code-block:: console
138+
139+
f5118b873294 uart16550: Add uart16550_interrupt implementation
140+
2115503fc3e3 uart16550: Add uart16550_ioctl implementation
141+
b31a257fd8b8 uart16550: Add uart16550_write implementation
142+
ac1af6d88a25 uart16550: Add uart16550_read implementation
143+
9f680e8136bf uart16550: Add uart16550_open/release implementation
144+
3c92a02cc527 uart16550: Add skeleton for SO2 assignment #2

Documentation/teaching/so2/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Operating Systems 2
4141
:caption: Assignments
4242
:maxdepth: 1
4343

44+
assign-collaboration.rst
4445
assign0-kernel-api.rst
4546
assign1-kprobe-based-tracer.rst
4647
assign2-driver-uart.rst

0 commit comments

Comments
 (0)