Skip to content

Commit 39c0d60

Browse files
committed
Add LICENCE, CONTRIBUTING.md
Also rework the README a bit, and remove lines in `wm.c` that were added by mistake previously.
1 parent 022fc79 commit 39c0d60

File tree

4 files changed

+106
-15
lines changed

4 files changed

+106
-15
lines changed

CONTRIBUTING.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Contributions are much appreciated!
2+
3+
## Table of contents
4+
5+
+ [Reporting bugs](#reporting-bugs)
6+
+ [Proposing features or improvements](#proposing-features-or-improvements)
7+
+ [Contributing pull requests](#contributing-pull-requests)
8+
+ [Coding guidelines](#coding-guidelines)
9+
10+
## Reporting bugs
11+
12+
+ Open one issue per bug
13+
+ Specify the distro you're using, in particular if it's a build system bug
14+
+ Provide steps to reproduce the bug
15+
+ Provide the expected behavior if it's unclear
16+
17+
## Proposing features or improvements
18+
19+
Please do! Developers tend to develop blind spots after a while, new ideas are welcome. Even if the proposed feature was on the roadmap already, it doesn't hurt to open an issue for it, plus it can be expanded on there.
20+
21+
## Contributing pull requests
22+
23+
+ Make sure there is a corresponding issue in the tracker, create one if needed
24+
+ If you need help, ask
25+
+ Even if you don't, the project owner will pop up after a while with unsolicited advice
26+
+ Read the **coding guidelines** in the [next section](#coding-guidelines) of this page
27+
+ Consult this project's wiki, there are rare cases where it may help
28+
+ Open your PR to get feedback
29+
+ feel free to open it early as a work-in-progress
30+
+ It'll get merged once approved!
31+
+ Intermediate commits may be squashed into one when merging if they're not directly related to the purpose of the PR: you can rebase your branch yourself if you wish to clean its commits yourself
32+
33+
## Coding guidelines
34+
35+
Readability is considered important; try to keep the coding style uniform. Here are the guidelines in use:
36+
37+
+ indent using four spaces
38+
+ use snake_case at all times
39+
+ curly braces on the same line in all cases: `if (foo) {`, etc...
40+
+ put a space before curly braces
41+
+ curly braces for single line `if`s `for`s and `while`s
42+
+ a space between keywords and their parentheses: `if ()`, `for ()`
43+
+ except when they behave like functions: `sizeof()`, `offsetof()`
44+
+ spaces around arithmetic operators: `a + b % c == 0`
45+
+ pointers' `*` are put close to the type: `type_t* ptr = NULL`;
46+
+ a blank line before and after control structures:
47+
```c
48+
int blah = bar();
49+
50+
if (blah) {
51+
...;
52+
}
53+
54+
...;
55+
```
56+
+ except when the previous line is also a control structure, e.g. nested loops, an `if` within a loop, etc...
57+
+ no extra blank lines otherwise, or trailing whitespace
58+
+ use sized `ints` within the kernel: `uint32_t`, `uint8_t` etc... or their signed versions if needed
59+
+ prefer lines that fit within 80-90 columns if possible
60+
61+
Example taken from [kernel/src/misc/wm/wm.c](https://github.com/29jm/SnowflakeOS/blob/022fc799b6841aa1365b28ac53832bb2f1cefc2f/kernel/src/misc/wm/wm.c#L406-L419):
62+
```c
63+
/* Return the window iterator corresponding to the given id, NULL if none match.
64+
*/
65+
list_t* wm_get_window(uint32_t id) {
66+
list_t* iter;
67+
wm_window_t* win;
68+
69+
list_for_each(iter, win, &windows) { // counts as a `for` loop
70+
if (win->id == id) {
71+
return iter;
72+
}
73+
}
74+
75+
return NULL;
76+
}
77+
```

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2015-2020 Johan Manuel, et. al.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ A hobby OS to help me learn about kernel stuff, to eventually get into linux ker
2121

2222
I aim to make the code readable and well-organized. A blog follows the development of this project, here https://jmnl.xyz/.
2323

24-
## Dependencies
24+
## Building & running
2525

26-
### Packages
26+
### Dependencies
2727

2828
Install the following packages:
2929

@@ -67,17 +67,18 @@ If your distro provides you with a cross compiler, you may want to save time and
6767

6868
You may edit `HOST`, or hardcode the executables names directly.
6969

70-
## Running SnowflakeOS
70+
### Running SnowflakeOS
7171

7272
Run either
7373

7474
make qemu # or
7575
make bochs
7676

77-
to test SnowflakeOS.
77+
to test SnowflakeOS in a VM.
7878

79-
## Installing SnowflakeOS
79+
Testing this project on real hardware is possible. You can copy `SnowflakeOS.iso` to an usb drive using `dd`, like you would when making a live usb of another OS, and boot it directly.
80+
Note that this is rarely ever tested, who knows what it'll do :) I'd love to hear about it if you try this, on which hardware, etc...
8081

81-
Testing this project on real hardware is possible. You can copy `SnowflakeOS.iso` to an usb drive using `dd`, like you would when making a live usb of another OS, and boot it directly.
82+
## Contributing
8283

83-
Note that this is rarely ever tested, who knows what it'll do :) I'd love to hear about it if you try this, on which hardware, etc...
84+
Contributions are most welcome, in any form! Consult `CONTRIBUTING.md` and this project's wiki for guidance.

kernel/src/misc/wm/wm.c

-8
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ uint32_t wm_open_window(fb_t* buff, uint32_t flags) {
6767
wm_assign_z_orders();
6868
wm_raise_window(win);
6969

70-
char str[20] = "/wm/";
71-
itoa(win->id, str+strlen(str), 10);
72-
fs_open(str, O_CREAT);
73-
7470
return win->id;
7571
}
7672

@@ -90,10 +86,6 @@ void wm_close_window(uint32_t win_id) {
9086
}
9187

9288
wm_refresh_partial(rect);
93-
94-
char str[20] = "/wm/";
95-
itoa(win_id, str+strlen(str), 10);
96-
fs_unlink(str);
9789
} else {
9890
printke("close: failed to find window of id %d", win_id);
9991
}

0 commit comments

Comments
 (0)