diff options
Diffstat (limited to 'share/misc')
-rw-r--r-- | share/misc/contrib | 189 | ||||
-rw-r--r-- | share/misc/pdn | 14 | ||||
-rw-r--r-- | share/misc/tmpfs | 15 |
3 files changed, 218 insertions, 0 deletions
diff --git a/share/misc/contrib b/share/misc/contrib new file mode 100644 index 0000000..39c9c02 --- /dev/null +++ b/share/misc/contrib @@ -0,0 +1,189 @@ +============================== +Hyra Contribution Guidelines +============================== + +!! C PROGRAMMING STYLE !! + +The .vimrc file that follows this style can be found in +share/misc/vimrc + +Indent width is 4-spaces (NO TABS) + +The typename must go above the function name like so: + +static inline bool +is_power_of_two(uint8_t n) +{ + if (g_foo) { + ... + } + + return ((n & 0x01) == 0); +} + +-- +When defining local variables in functions, they +must be declared at the top: + +static void +foo(void) +{ + uint8_t byte; + uint16_t pair; + uint32_t quad; + uint64_t oct; + + ... +} +-- + +When checking if an integer is 0 or not, *be explicit* unless it is a bool! +Do not do this: + +#define BLAH 1 + +if (!BLAH) { + ... +} + +Do this instead: + +if (BLAH == 0) { + ... +} + +-- or if it is a bool: + +#define BLAH true + +if (!blah) { + ... +} + +-- + +When writing switch statements, no indentation is needed +before the "case" statement, do this: + +switch (v) { +case 0: + ... + break; +case 1: + ... + break; +case 2: + ... + break; +} + +Not this: + + +switch (v) { +case 0: + ... + break; +case 1: + ... + break; +case 2: + ... + break; +} + +-- +Now, only use predefined integer types in sys/cdefs.h like so: + +uint8_t a; +uint16_t b; +uint32_t c; +-- + +All includes must be done with '< >': + +#include <sys/cdefs.h> +-- + + +When including architecture specific things, it would be stupid +to include for another architecture. Only include from machine/ which +points to the architecture specific files for the current architecture. +For example: + +/* AMD64-specific, in sys/include/arch/amd64/lapic.h */ +#include <machine/lapic.h> +-- + +Avoid initializing variables to e.g. 0 unless it seems wise to do so. +Try to avoid this: + +uint8_t foo = 0; +... + +It is best to do this instead: + +uint8_t foo; +... + +foo = some_calculation(); +-- + +One of the only times it is best to do that is when you have +a pointer, like, for example: + +uint8_t *ptr = NULL; +... +-- +The preferred pointer style is: + +void *p = ...; + +-- Not: + +void* p = ...; + +-- or if you have for example, some sort of counter value + that must have a start: + +uint8_t countdown = COUNTDOWN_START; +-- + +!! COMMIT STYLE !! + +Keep commits small if possible. Follow commit good practices. + +- Commit examples - +1) Some manpage update: + docs: man: Describe foo in foobar(9) + +2) Adding a tool in tools/ + build: tools: Create foo + + This commit adds a new script in tools/ + that does x and y ... + +- Kernel commits - +An example of a commit title for a non architecture-specific commit: + kernel: foo: Fix bar in foobar + +An example of an architecture specific commit e.g. for AMD64: +kernel/amd64: foo: Add foo in bar + +- Ready to commit - + +(BE SURE TO TEST IT!! IDEALLY ON REAL HW TOO IF POSSIBLE!) + +* Commit with `git commit -sv` +* Create patch with `git format-patch -1 HEAD` +* Email patch to ian@osmora.org and for better response times, + optionally CC to quinn@osmora.org + +Done! + +------------------------------------------------ +NOTE TO MAINTAINERS + +For those who maintain the Hyra repo, when testing a patch, apply it like so: +`git am -s patchfile.patch`. If all good, create a new patch and email it to +ian@osmora.org diff --git a/share/misc/pdn b/share/misc/pdn new file mode 100644 index 0000000..3187277 --- /dev/null +++ b/share/misc/pdn @@ -0,0 +1,14 @@ +-------------------------------------------- +| Peripheral Description Notation Examples | +-------------------------------------------- + +hba0 at pci0: HBA instance 0 is connected to PCI bus 0 + +... can be more specific (with BDF + slot) + +hba0 at pci0:2922.00.3 + ^ ^ ^ ^ + bus dev func slot + +hba* at pci0: (hba<wildcard>) All HBA instances on PCI bus 0 +hba0 at pci?: (* .. <pci:unknown>) HBA instance 0 on PCI bus ? (could be any) diff --git a/share/misc/tmpfs b/share/misc/tmpfs new file mode 100644 index 0000000..38eac22 --- /dev/null +++ b/share/misc/tmpfs @@ -0,0 +1,15 @@ +---------------------------------------------------- +| Readable + writable in-memory filesystem (tmpfs) | ++--------------------------------------------------+ +| Author: Ian Marco Moffett | ++--------------------------------------------------+ + +------------------------------------------------------------------------------ + + [d] /tmp/ -> [next] -> foo.txt -> [next] -> bar.txt + \ + +> /tmp/noises/ -> [next] -> mrow.txt -> [next] -> squeak.txt + \ + +> /tmp/noises1/ -> [next] -> bark.bin -> [next] -> wrff.txt + +------------------------------------------------------------------------------ |