mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
Merge pull request #33 from seuros/main
refactor: adopt current style(9) license header order (copyright before SPDX)
This commit is contained in:
commit
fec6128126
174 changed files with 727 additions and 644 deletions
|
|
@ -238,10 +238,10 @@ Now create `myfirst.c`, the actual driver source. This first version is **minima
|
||||||
Here's the skeleton:
|
Here's the skeleton:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3614,11 +3614,11 @@ The `myfirst` driver at the end of Chapter 15 uses every primitive Part 3 introd
|
||||||
The companion source under `examples/part-03/ch15-more-synchronization/stage4-final/` includes the complete `myfirst_sync.h`. For reference, here is a full version that can be used as a template.
|
The companion source under `examples/part-03/ch15-more-synchronization/stage4-final/` includes the complete `myfirst_sync.h`. For reference, here is a full version that can be used as a template.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* myfirst_sync.h: the named synchronisation vocabulary of the
|
* myfirst_sync.h: the named synchronisation vocabulary of the
|
||||||
* myfirst driver.
|
* myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -495,7 +495,7 @@ Chapter 16's file layout was `myfirst.c` for the driver lifecycle, `myfirst_hw.c
|
||||||
Create `myfirst_sim.c` alongside the Chapter 16 files. The first version is small:
|
Create `myfirst_sim.c` alongside the Chapter 16 files. The first version is small:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* myfirst_sim.c -- Chapter 17 simulated hardware backend.
|
* myfirst_sim.c -- Chapter 17 simulated hardware backend.
|
||||||
*
|
*
|
||||||
* Adds a callout that drives autonomous register changes, a
|
* Adds a callout that drives autonomous register changes, a
|
||||||
|
|
@ -3873,11 +3873,11 @@ If you want to go deeper into the topics Chapter 17 touched, the following are g
|
||||||
The complete `myfirst_sim.h` as it stands at the end of Chapter 17, for quick reference. The source is also in `examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h`.
|
The complete `myfirst_sim.h` as it stands at the end of Chapter 17, for quick reference. The source is also in `examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h`.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* myfirst_sim.h -- Chapter 17 simulation API.
|
* myfirst_sim.h -- Chapter 17 simulation API.
|
||||||
*
|
*
|
||||||
* The simulation layer turns the Chapter 16 static register block into
|
* The simulation layer turns the Chapter 16 static register block into
|
||||||
|
|
|
||||||
|
|
@ -501,11 +501,11 @@ The priority values are negative by convention so that the numerically lowest va
|
||||||
Putting it all together, here is the Chapter 18 Stage 1 driver, presented as a single self-contained file that grows out of the Chapter 17 skeleton. The file name is `myfirst_pci.c`; it is new in Chapter 18 and lives alongside the existing `myfirst.c`, `myfirst_hw.c`, and `myfirst_sim.c`.
|
Putting it all together, here is the Chapter 18 Stage 1 driver, presented as a single self-contained file that grows out of the Chapter 17 skeleton. The file name is `myfirst_pci.c`; it is new in Chapter 18 and lives alongside the existing `myfirst.c`, `myfirst_hw.c`, and `myfirst_sim.c`.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* myfirst_pci.c -- Chapter 18 Stage 1 PCI probe/attach skeleton.
|
* myfirst_pci.c -- Chapter 18 Stage 1 PCI probe/attach skeleton.
|
||||||
*
|
*
|
||||||
* At this stage the driver only probes, attaches, and detaches.
|
* At this stage the driver only probes, attaches, and detaches.
|
||||||
|
|
@ -597,11 +597,11 @@ MODULE_VERSION(myfirst, 1);
|
||||||
The companion header, `myfirst_pci.h`:
|
The companion header, `myfirst_pci.h`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* myfirst_pci.h -- Chapter 18 PCI interface for the myfirst driver.
|
* myfirst_pci.h -- Chapter 18 PCI interface for the myfirst driver.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -2643,11 +2643,11 @@ Reading this file after writing Chapter 18's driver is a short exercise in patte
|
||||||
### The Top of the File
|
### The Top of the File
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 Marcel Moolenaar All rights reserved.
|
* Copyright (c) 2006 Marcel Moolenaar All rights reserved.
|
||||||
* Copyright (c) 2001 M. Warner Losh <imp@FreeBSD.org>
|
* Copyright (c) 2001 M. Warner Losh <imp@FreeBSD.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
...
|
...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -696,11 +696,11 @@ macros in earlier chapters; here we are focusing on how they
|
||||||
arrange themselves on the page.
|
arrange themselves on the page.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Your Name <you@example.com>
|
* Copyright (c) 2026 Your Name <you@example.com>
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Redistribution and use in source and binary forms, with or
|
* Redistribution and use in source and binary forms, with or
|
||||||
* without modification, are permitted provided that the
|
* without modification, are permitted provided that the
|
||||||
* following conditions are met:
|
* following conditions are met:
|
||||||
|
|
@ -785,9 +785,9 @@ MODULE_VERSION(mydev, 1);
|
||||||
MODULE_DEPEND(mydev, pci, 1, 1, 1);
|
MODULE_DEPEND(mydev, pci, 1, 1, 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
Several things are worth noticing. The copyright header uses the
|
Several things are worth noticing. The copyright header opens
|
||||||
`/*-` opening marker, which the automatic licence-harvesting
|
with a plain `/*` comment, states the copyright first, and then
|
||||||
script recognises. The SPDX line names the licence explicitly.
|
names the licence explicitly with the SPDX line.
|
||||||
The indentation is tabs, not spaces, as mandated by `style(9)`.
|
The indentation is tabs, not spaces, as mandated by `style(9)`.
|
||||||
The function declarations are tab-separated, also per `style(9)`.
|
The function declarations are tab-separated, also per `style(9)`.
|
||||||
The `DRIVER_MODULE` and related macros appear at the bottom, in
|
The `DRIVER_MODULE` and related macros appear at the bottom, in
|
||||||
|
|
@ -888,14 +888,13 @@ as a panic message.
|
||||||
|
|
||||||
#### Copyright Header Form
|
#### Copyright Header Form
|
||||||
|
|
||||||
The copyright header uses the `/*-` opening marker. This marker
|
The copyright header is a multi-line comment starting in column 1
|
||||||
is magic. An automated tool harvests licences from the tree by
|
with a plain `/*`. Older files open with `/*-`, a marker that a
|
||||||
looking for multi-line comments that start in column 1 with `/*-`.
|
licence-harvesting tool once relied on; `style(9)` no longer asks
|
||||||
Using the marker flags the block as a licence; using a regular
|
for the dash in new code. The first significant lines are one or
|
||||||
`/*` does not. Immediately after `/*-`, the next significant line
|
more `Copyright` lines. After the copyright lines comes
|
||||||
should be `SPDX-License-Identifier:` followed by the SPDX licence
|
`SPDX-License-Identifier:` followed by the SPDX licence code,
|
||||||
code, such as `BSD-2-Clause`. Then come one or more `Copyright`
|
such as `BSD-2-Clause`. Then, optionally, the licence text.
|
||||||
lines. Then the licence text.
|
|
||||||
|
|
||||||
#### Function Declarations and Definitions
|
#### Function Declarations and Definitions
|
||||||
|
|
||||||
|
|
@ -1204,9 +1203,10 @@ this as a quick self-check before moving on to Section 3.
|
||||||
- File names that do not match the driver. If the driver is
|
- File names that do not match the driver. If the driver is
|
||||||
`mydev`, the main source file is `mydev.c`, not `main.c` or
|
`mydev`, the main source file is `mydev.c`, not `main.c` or
|
||||||
`driver.c`.
|
`driver.c`.
|
||||||
- Missing or incorrect copyright header. The header uses `/*-` as
|
- Missing or incorrect copyright header. The header opens with
|
||||||
the opening marker, the SPDX identifier comes first, and the
|
`/*`, the copyright lines come first, the SPDX identifier
|
||||||
licence text matches one of the project's accepted licences.
|
follows them, and the licence text matches one of the project's
|
||||||
|
accepted licences.
|
||||||
- Spaces instead of tabs. `style(9)` is explicit about tabs, and
|
- Spaces instead of tabs. `style(9)` is explicit about tabs, and
|
||||||
the style checker will flag space indentation immediately.
|
the style checker will flag space indentation immediately.
|
||||||
- Missing parentheses on `return` expressions. A recurring small
|
- Missing parentheses on `return` expressions. A recurring small
|
||||||
|
|
@ -1351,11 +1351,11 @@ has a specific structure, documented in `style(9)`. Let us walk
|
||||||
through a complete header and examine every part.
|
through a complete header and examine every part.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Your Name <you@example.com>
|
* Copyright (c) 2026 Your Name <you@example.com>
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Redistribution and use in source and binary forms, with or
|
* Redistribution and use in source and binary forms, with or
|
||||||
* without modification, are permitted provided that the
|
* without modification, are permitted provided that the
|
||||||
* following conditions are met:
|
* following conditions are met:
|
||||||
|
|
@ -1382,22 +1382,23 @@ through a complete header and examine every part.
|
||||||
*/
|
*/
|
||||||
```
|
```
|
||||||
|
|
||||||
The opening `/*-` is not a typo. The dash after the star is
|
The opening is a plain `/*` in column 1. You will still see `/*-`
|
||||||
significant. An automated script in the tree harvests licence
|
at the top of many files in the tree: the dash was a marker for an
|
||||||
information from files by looking for multi-line comments that
|
automated licence-harvesting script, and for years `style(9)`
|
||||||
start in column 1 with the sequence `/*-`. Using `/*-` flags the
|
required it. The current `style(9)` has dropped that requirement,
|
||||||
block as a licence; using plain `/*` does not. `style(9)` is
|
so new code opens the header with `/*` and relies on the SPDX line
|
||||||
explicit: if you want the tree's licence harvester to pick up
|
to identify the licence.
|
||||||
your licence correctly, use `/*-` for the opening line.
|
|
||||||
|
|
||||||
Immediately after the opening is the SPDX-License-Identifier
|
Immediately after the opening come the copyright lines, then the
|
||||||
line. SPDX is a standardised vocabulary for describing licences
|
SPDX-License-Identifier line. SPDX is a standardised vocabulary
|
||||||
in machine-readable form. The line tells the harvester which
|
for describing licences in machine-readable form. The line names
|
||||||
licence the file is under, and it does so in a form that cannot be
|
the licence the file is under in a form that cannot be
|
||||||
misinterpreted. Use `BSD-2-Clause` for a two-clause BSD licence,
|
misinterpreted. Use `BSD-2-Clause` for a two-clause BSD licence,
|
||||||
`BSD-3-Clause` for a three-clause BSD licence. For other licences,
|
`BSD-3-Clause` for a three-clause BSD licence. For other licences,
|
||||||
consult the SPDX identifier list at `https://spdx.org/licenses/`.
|
consult the SPDX identifier list at `https://spdx.org/licenses/`.
|
||||||
Do not invent identifiers.
|
Do not invent identifiers. Note the order: `style(9)` says to
|
||||||
|
write the copyright lines before the SPDX identifier. Older files
|
||||||
|
have it the other way around; new code should not.
|
||||||
|
|
||||||
The copyright line names the year and the copyright holder. Use
|
The copyright line names the year and the copyright holder. Use
|
||||||
your full legal name, or the name of your employer if you are
|
your full legal name, or the name of your employer if you are
|
||||||
|
|
@ -1466,12 +1467,12 @@ The convention in the tree for derivative works is to preserve
|
||||||
the original copyright line and add your own as a separate line:
|
the original copyright line and add your own as a separate line:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 1998 Original Author <original@example.com>
|
* Copyright (c) 1998 Original Author <original@example.com>
|
||||||
* Copyright (c) 2026 Your Name <you@example.com>
|
* Copyright (c) 2026 Your Name <you@example.com>
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* [licence text]
|
* [licence text]
|
||||||
*/
|
*/
|
||||||
```
|
```
|
||||||
|
|
@ -1546,17 +1547,17 @@ never prepared for submission, you will need to add the proper
|
||||||
header to each file. The steps are:
|
header to each file. The steps are:
|
||||||
|
|
||||||
1. Decide on the licence. For a new driver, use BSD-2-Clause.
|
1. Decide on the licence. For a new driver, use BSD-2-Clause.
|
||||||
2. Write the SPDX identifier line.
|
2. Write the copyright line with your name, email, and the year
|
||||||
3. Write the copyright line with your name, email, and the year
|
|
||||||
of first creation.
|
of first creation.
|
||||||
|
3. Write the SPDX identifier line after the copyright line.
|
||||||
4. Paste in the standard BSD-2-Clause licence text.
|
4. Paste in the standard BSD-2-Clause licence text.
|
||||||
5. Verify that the opening is `/*-` and the file starts in
|
5. Verify that the opening is `/*` and the file starts in
|
||||||
column 1.
|
column 1.
|
||||||
6. Verify that there is a single blank line after the closing
|
6. Verify that there is a single blank line after the closing
|
||||||
`*/`.
|
`*/`.
|
||||||
7. Repeat for each file: the `.c` files, the `.h` files, the
|
7. Repeat for each file: the `.c` files, the `.h` files, the
|
||||||
manual page (where the licence appears as `.\" -` style
|
manual page (where the licence appears as `.\"` style
|
||||||
comments rather than `/*-` style), and any other files that
|
comments rather than `/*` style), and any other files that
|
||||||
contain substantial content.
|
contain substantial content.
|
||||||
|
|
||||||
For the Makefile, as noted earlier, a licence header is
|
For the Makefile, as noted earlier, a licence header is
|
||||||
|
|
@ -1568,8 +1569,8 @@ shown in Section 2 is trivial enough that no header is required.
|
||||||
There is no single automated tool that validates every aspect of
|
There is no single automated tool that validates every aspect of
|
||||||
a FreeBSD copyright header. The `checkstyle9.pl` script catches
|
a FreeBSD copyright header. The `checkstyle9.pl` script catches
|
||||||
some kinds of formatting errors near the header. The licence
|
some kinds of formatting errors near the header. The licence
|
||||||
harvester in the tree works on the `/*-` marker and the SPDX
|
tooling in the tree works on the SPDX line. The most reliable
|
||||||
line. The most reliable validation, however, is to compare your
|
validation, however, is to compare your
|
||||||
header directly against a known-good header from a recent commit
|
header directly against a known-good header from a recent commit
|
||||||
in the tree, such as the header in
|
in the tree, such as the header in
|
||||||
`/usr/src/sys/dev/null/null.c` or any recently added driver.
|
`/usr/src/sys/dev/null/null.c` or any recently added driver.
|
||||||
|
|
@ -1586,8 +1587,8 @@ saves enormous amounts of time. The FreeBSD Project accepts
|
||||||
BSD-2-Clause, BSD-3-Clause, and a few other permissive licences
|
BSD-2-Clause, BSD-3-Clause, and a few other permissive licences
|
||||||
for historical files. New contributions should default to
|
for historical files. New contributions should default to
|
||||||
BSD-2-Clause. The copyright header uses a specific form, opening
|
BSD-2-Clause. The copyright header uses a specific form, opening
|
||||||
with `/*-`, followed by an SPDX identifier, followed by one or
|
with `/*`, followed by one or more copyright lines, followed by
|
||||||
more copyright lines, followed by the standard licence text. Code
|
an SPDX identifier, followed by the standard licence text. Code
|
||||||
derived from other projects carries its original licence
|
derived from other projects carries its original licence
|
||||||
obligations forward, and derivative work must preserve the
|
obligations forward, and derivative work must preserve the
|
||||||
original attributions. Code you did not write yourself requires
|
original attributions. Code you did not write yourself requires
|
||||||
|
|
@ -1696,11 +1697,11 @@ hypothetical `mydev` driver. Save it as `mydev.4`, run
|
||||||
the kind of manual page you can adapt to your own driver.
|
the kind of manual page you can adapt to your own driver.
|
||||||
|
|
||||||
```text
|
```text
|
||||||
.\"-
|
|
||||||
.\" SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2026 Your Name <you@example.com>
|
.\" Copyright (c) 2026 Your Name <you@example.com>
|
||||||
.\"
|
.\"
|
||||||
|
.\" SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
.\"
|
||||||
.\" Redistribution and use in source and binary forms, with or
|
.\" Redistribution and use in source and binary forms, with or
|
||||||
.\" without modification, are permitted provided that the
|
.\" without modification, are permitted provided that the
|
||||||
.\" following conditions are met:
|
.\" following conditions are met:
|
||||||
|
|
@ -1808,8 +1809,9 @@ with `.\"`. These are mdoc comments. They are not rendered in the
|
||||||
manual page output. They exist to carry the copyright header and
|
manual page output. They exist to carry the copyright header and
|
||||||
any notes to future editors.
|
any notes to future editors.
|
||||||
|
|
||||||
The opening marker is `.\"-` with a dash, equivalent to the `/*-`
|
The opening line is a plain `.\"`, equivalent to the `/*` opening
|
||||||
in C files. The licence harvester recognises it.
|
in C files. As in C files, the copyright line comes first and the
|
||||||
|
SPDX identifier follows it.
|
||||||
|
|
||||||
The `.Dd` macro sets the document date. It is formatted as month,
|
The `.Dd` macro sets the document date. It is formatted as month,
|
||||||
day, year with full month name. The project's mdoc style is to
|
day, year with full month name. The project's mdoc style is to
|
||||||
|
|
@ -3609,14 +3611,14 @@ Steps:
|
||||||
`.c` file, each `.h` file, and the manual page.
|
`.c` file, each `.h` file, and the manual page.
|
||||||
2. For each file, check the existing header. If it is missing or
|
2. For each file, check the existing header. If it is missing or
|
||||||
malformed, replace it with a known-good template.
|
malformed, replace it with a known-good template.
|
||||||
3. Use `/*-` as the opening of the header in `.c` and `.h` files.
|
3. Use `/*` as the opening of the header in `.c` and `.h` files.
|
||||||
Use `.\"-` as the opening in the manual page.
|
Use `.\"` as the opening in the manual page.
|
||||||
4. Include the SPDX-License-Identifier line with the appropriate
|
4. Add your name and email to the Copyright line.
|
||||||
licence, typically `BSD-2-Clause`.
|
5. Include the SPDX-License-Identifier line, after the Copyright
|
||||||
5. Add your name and email to the Copyright line.
|
line, with the appropriate licence, typically `BSD-2-Clause`.
|
||||||
6. Include the standard licence text.
|
6. Include the standard licence text.
|
||||||
7. Verify that the file starts in column 1 with the `/*-` or
|
7. Verify that the file starts in column 1 with the `/*` or
|
||||||
`.\"-` opening.
|
`.\"` opening.
|
||||||
|
|
||||||
Success criterion: every file has a correctly-formatted header
|
Success criterion: every file has a correctly-formatted header
|
||||||
that matches the conventions of files already in the tree.
|
that matches the conventions of files already in the tree.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Lab 7.4, variant B.
|
* Lab 7.4, variant B.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Lab 7.4, variant A.
|
* Lab 7.4, variant A.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Stage 0 of Chapter 7: minimal kernel module scaffold.
|
* Stage 0 of Chapter 7: minimal kernel module scaffold.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Stage 1 of Chapter 7: minimal Newbus pseudo-device.
|
* Stage 1 of Chapter 7: minimal Newbus pseudo-device.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Stage 2 of Chapter 7: complete minimal pseudo-device driver.
|
* Stage 2 of Chapter 7: complete minimal pseudo-device driver.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Stage 0 of Chapter 8: the Chapter 7 driver with a structured device
|
* Stage 0 of Chapter 8: the Chapter 7 driver with a structured device
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Stage 1 of Chapter 8: add an alias so /dev/myfirst points at
|
* Stage 1 of Chapter 8: add an alias so /dev/myfirst points at
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Stage 2 of Chapter 8: per-open state via devfs_set_cdevpriv().
|
* Stage 2 of Chapter 8: per-open state via devfs_set_cdevpriv().
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Stage 3 of Chapter 8: two-node driver with data and control nodes.
|
* Stage 3 of Chapter 8: two-node driver with data and control nodes.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 Your Name
|
* Copyright (c) 2025 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Stage 4 of Chapter 8: multiple cdevs plus destroy_dev_drain.
|
* Stage 4 of Chapter 8: multiple cdevs plus destroy_dev_drain.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
/*-
|
/*
|
||||||
|
* Copyright (c) 2026 Edson Brandi
|
||||||
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*
|
*
|
||||||
* hold_myfirst: open /dev/myfirst/0 and sleep. Used for Challenge 2 to
|
* hold_myfirst: open /dev/myfirst/0 and sleep. Used for Challenge 2 to
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
/*-
|
/*
|
||||||
|
* Copyright (c) 2026 Edson Brandi
|
||||||
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*
|
*
|
||||||
* parallel_probe: open a device node multiple times from a single
|
* parallel_probe: open a device node multiple times from a single
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
/*-
|
/*
|
||||||
|
* Copyright (c) 2026 Edson Brandi
|
||||||
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*
|
*
|
||||||
* probe_myfirst: a tiny userland probe for the Chapter 8 myfirst driver.
|
* probe_myfirst: a tiny userland probe for the Chapter 8 myfirst driver.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
/*-
|
/*
|
||||||
|
* Copyright (c) 2026 Edson Brandi
|
||||||
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*
|
*
|
||||||
* stat_myfirst: print stat(2) metadata for one or more device-file
|
* stat_myfirst: print stat(2) metadata for one or more device-file
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
/*-
|
/*
|
||||||
|
* Copyright (c) 2026 Edson Brandi
|
||||||
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*
|
*
|
||||||
* stress_probe: loop open() and close() on a device node many times.
|
* stress_probe: loop open() and close() on a device node many times.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Your Name
|
* Copyright (c) 2026 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Chapter 9, Stage 1: a static-message read path.
|
* Chapter 9, Stage 1: a static-message read path.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Your Name
|
* Copyright (c) 2026 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Chapter 9, Stage 2: a write-once / read-many buffer.
|
* Chapter 9, Stage 2: a write-once / read-many buffer.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Your Name
|
* Copyright (c) 2026 Your Name
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Chapter 9, Stage 3: a first-in / first-out echo driver.
|
* Chapter 9, Stage 3: a first-in / first-out echo driver.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cb_test.c: simple sanity tests for the cbuf userland implementation.
|
* cb_test.c: simple sanity tests for the cbuf userland implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: userland implementation of the byte-oriented circular buffer.
|
* cbuf.c: userland implementation of the byte-oriented circular buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer.
|
* cbuf.h: a fixed-size byte-oriented circular buffer.
|
||||||
*
|
*
|
||||||
* The buffer does not lock; the caller is responsible for whatever
|
* The buffer does not lock; the caller is responsible for whatever
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 10, Stage 2: circular-buffer integration.
|
* Chapter 10, Stage 2: circular-buffer integration.
|
||||||
*
|
*
|
||||||
* Replaces the Stage 3 linear FIFO from Chapter 9 with a true
|
* Replaces the Stage 3 linear FIFO from Chapter 9 with a true
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 10, Stage 3: blocking and non-blocking I/O.
|
* Chapter 10, Stage 3: blocking and non-blocking I/O.
|
||||||
*
|
*
|
||||||
* Builds on Stage 2 by adding mtx_sleep(9) on the empty/full
|
* Builds on Stage 2 by adding mtx_sleep(9) on the empty/full
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 10, Stage 4: poll support and refactor.
|
* Chapter 10, Stage 4: poll support and refactor.
|
||||||
*
|
*
|
||||||
* Adds d_poll, selinfo for read and write readiness, and refactors
|
* Adds d_poll, selinfo for read and write readiness, and refactors
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 10, Stage 5: minimal d_mmap on top of Stage 4.
|
* Chapter 10, Stage 5: minimal d_mmap on top of Stage 4.
|
||||||
*
|
*
|
||||||
* Lets user space mmap(2) the cbuf's backing memory read-only.
|
* Lets user space mmap(2) the cbuf's backing memory read-only.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* mmap_myfirst.c: read-only mmap tester for /dev/myfirst (Stage 5).
|
* mmap_myfirst.c: read-only mmap tester for /dev/myfirst (Stage 5).
|
||||||
*
|
*
|
||||||
* Maps the cbuf's backing memory and dumps the first 64 bytes. The
|
* Maps the cbuf's backing memory and dumps the first 64 bytes. The
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* producer_consumer.c: a two-process load test for /dev/myfirst.
|
* producer_consumer.c: a two-process load test for /dev/myfirst.
|
||||||
*
|
*
|
||||||
* Forks a child writer and uses the parent as the reader. Each side
|
* Forks a child writer and uses the parent as the reader. Each side
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* rw_myfirst_nb.c: non-blocking behaviour tester for /dev/myfirst.
|
* rw_myfirst_nb.c: non-blocking behaviour tester for /dev/myfirst.
|
||||||
*
|
*
|
||||||
* Exercises Stage 3+ of Chapter 10:
|
* Exercises Stage 3+ of Chapter 10:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* rw_myfirst_v2.c: sized fill/drain tester for /dev/myfirst.
|
* rw_myfirst_v2.c: sized fill/drain tester for /dev/myfirst.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* stress_rw.c: a single-process stress harness for /dev/myfirst.
|
* stress_rw.c: a single-process stress harness for /dev/myfirst.
|
||||||
*
|
*
|
||||||
* Runs through a small table of (block size, repeat count) pairs.
|
* Runs through a small table of (block size, repeat count) pairs.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 11, Stage 1: DELIBERATELY UNSAFE race-demo driver.
|
* Chapter 11, Stage 1: DELIBERATELY UNSAFE race-demo driver.
|
||||||
*
|
*
|
||||||
* This driver is structurally identical to the Chapter 10 Stage 4 driver,
|
* This driver is structurally identical to the Chapter 10 Stage 4 driver,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 11, Stage 2: concurrent-safe with documented locking.
|
* Chapter 11, Stage 2: concurrent-safe with documented locking.
|
||||||
*
|
*
|
||||||
* Functionally identical to the Chapter 10 Stage 4 driver. The
|
* Functionally identical to the Chapter 10 Stage 4 driver. The
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 11, Stage 3: migrate byte counters to counter(9).
|
* Chapter 11, Stage 3: migrate byte counters to counter(9).
|
||||||
*
|
*
|
||||||
* Builds on Stage 2 by replacing sc->bytes_read and sc->bytes_written,
|
* Builds on Stage 2 by replacing sc->bytes_read and sc->bytes_written,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 11, Stage 5: KASSERTs throughout, ready for a debug kernel.
|
* Chapter 11, Stage 5: KASSERTs throughout, ready for a debug kernel.
|
||||||
*
|
*
|
||||||
* Builds on Chapter 11 Stage 3 (counter(9) migration) by adding KASSERT
|
* Builds on Chapter 11 Stage 3 (counter(9) migration) by adding KASSERT
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* lat_tester.c: measure read latency against /dev/myfirst and print
|
* lat_tester.c: measure read latency against /dev/myfirst and print
|
||||||
* a simple bucketed histogram. Useful for observing the cost of
|
* a simple bucketed histogram. Useful for observing the cost of
|
||||||
* the driver's mutex under various load conditions.
|
* the driver's mutex under various load conditions.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* mp_stress.c: a multi-process stress tester for /dev/myfirst.
|
* mp_stress.c: a multi-process stress tester for /dev/myfirst.
|
||||||
*
|
*
|
||||||
* Forks NWRITERS writer children and NREADERS reader children.
|
* Forks NWRITERS writer children and NREADERS reader children.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* mt_reader.c: multiple threads reading from one descriptor of
|
* mt_reader.c: multiple threads reading from one descriptor of
|
||||||
* /dev/myfirst. Exercises the driver's handling of multiple
|
* /dev/myfirst. Exercises the driver's handling of multiple
|
||||||
* concurrent readers on the same fh.
|
* concurrent readers on the same fh.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 12, Stage 1: condition variables replace anonymous channels.
|
* Chapter 12, Stage 1: condition variables replace anonymous channels.
|
||||||
*
|
*
|
||||||
* Builds on Chapter 11 Stage 5 (counter9 + KASSERTs). Replaces the
|
* Builds on Chapter 11 Stage 5 (counter9 + KASSERTs). Replaces the
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 12, Stage 2: bounded reads via cv_timedwait_sig.
|
* Chapter 12, Stage 2: bounded reads via cv_timedwait_sig.
|
||||||
*
|
*
|
||||||
* Builds on Chapter 12 Stage 1 (cv channels) by adding two new sysctls:
|
* Builds on Chapter 12 Stage 1 (cv channels) by adding two new sysctls:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 12, Stage 3: sx-protected configuration subsystem.
|
* Chapter 12, Stage 3: sx-protected configuration subsystem.
|
||||||
*
|
*
|
||||||
* Builds on Stage 2 (bounded reads) by adding a runtime configuration
|
* Builds on Stage 2 (bounded reads) by adding a runtime configuration
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 12, Stage 4: the final synchronized driver.
|
* Chapter 12, Stage 4: the final synchronized driver.
|
||||||
*
|
*
|
||||||
* Combines all of Chapter 12: cv channels (Stage 1), bounded reads
|
* Combines all of Chapter 12: cv channels (Stage 1), bounded reads
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* config_writer.c: stress the Chapter 12 driver's configuration
|
* config_writer.c: stress the Chapter 12 driver's configuration
|
||||||
* sysctls by toggling debug_level and soft_byte_limit at high
|
* sysctls by toggling debug_level and soft_byte_limit at high
|
||||||
* frequency for a configurable duration.
|
* frequency for a configurable duration.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* timeout_tester.c: verify that the Chapter 12 driver's bounded
|
* timeout_tester.c: verify that the Chapter 12 driver's bounded
|
||||||
* read returns EAGAIN after approximately the configured timeout
|
* read returns EAGAIN after approximately the configured timeout
|
||||||
* when no data is available.
|
* when no data is available.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 13, Stage 1: heartbeat callout only.
|
* Chapter 13, Stage 1: heartbeat callout only.
|
||||||
*
|
*
|
||||||
* Builds on Chapter 12 Stage 4 by adding one callout:
|
* Builds on Chapter 12 Stage 4 by adding one callout:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 13, Stage 2: heartbeat + watchdog callouts.
|
* Chapter 13, Stage 2: heartbeat + watchdog callouts.
|
||||||
*
|
*
|
||||||
* Builds on Stage 1 by adding the watchdog callout:
|
* Builds on Stage 1 by adding the watchdog callout:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 13, Stage 3: heartbeat + watchdog + tick source.
|
* Chapter 13, Stage 3: heartbeat + watchdog + tick source.
|
||||||
*
|
*
|
||||||
* Builds on Stage 2 by adding the tick source callout:
|
* Builds on Stage 2 by adding the tick source callout:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 13, Stage 4: the final timer-enhanced driver.
|
* Chapter 13, Stage 4: the final timer-enhanced driver.
|
||||||
*
|
*
|
||||||
* Builds on Chapter 12 Stage 4 by adding three callouts:
|
* Builds on Chapter 12 Stage 4 by adding three callouts:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* poll_waiter.c: a trivial poll(2) client for /dev/myfirst.
|
* poll_waiter.c: a trivial poll(2) client for /dev/myfirst.
|
||||||
*
|
*
|
||||||
* Compile with:
|
* Compile with:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 14, Stage 1: the first task.
|
* Chapter 14, Stage 1: the first task.
|
||||||
*
|
*
|
||||||
* Starts from Chapter 13 Stage 4 and adds one task, enqueued from the
|
* Starts from Chapter 13 Stage 4 and adds one task, enqueued from the
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 14, Stage 2: the private taskqueue.
|
* Chapter 14, Stage 2: the private taskqueue.
|
||||||
*
|
*
|
||||||
* Builds on Chapter 14 Stage 1 by creating a private taskqueue
|
* Builds on Chapter 14 Stage 1 by creating a private taskqueue
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 14, Stage 3: deliberate coalescing and a delayed reset.
|
* Chapter 14, Stage 3: deliberate coalescing and a delayed reset.
|
||||||
*
|
*
|
||||||
* Builds on Stage 2 by adding bulk_writer_task (to demonstrate
|
* Builds on Stage 2 by adding bulk_writer_task (to demonstrate
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
* cbuf.h: a fixed-size byte-oriented circular buffer for the
|
||||||
* Chapter 10 myfirst driver.
|
* Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Chapter 14, Stage 4: the final taskqueue-enhanced driver.
|
* Chapter 14, Stage 4: the final taskqueue-enhanced driver.
|
||||||
*
|
*
|
||||||
* Builds on Chapter 13 Stage 4 by adding a private taskqueue and three
|
* Builds on Chapter 13 Stage 4 by adding a private taskqueue and three
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* signal_read: start a blocking read on /dev/myfirst, receive a
|
* signal_read: start a blocking read on /dev/myfirst, receive a
|
||||||
* signal after a delay, report how many bytes were delivered before
|
* signal after a delay, report how many bytes were delivered before
|
||||||
* the signal interrupted the read.
|
* the signal interrupted the read.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* writer_cap_test: start N concurrent writers that open /dev/myfirst
|
* writer_cap_test: start N concurrent writers that open /dev/myfirst
|
||||||
* and write a short burst. Used to stress the writer-cap semaphore
|
* and write a short burst. Used to stress the writer-cap semaphore
|
||||||
* introduced in Chapter 15 Stage 1.
|
* introduced in Chapter 15 Stage 1.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*-
|
/*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 Edson Brandi
|
* Copyright (c) 2026 Edson Brandi
|
||||||
*
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
* cbuf.c: kernel-side implementation of the byte-oriented circular
|
||||||
* buffer for the Chapter 10 myfirst driver.
|
* buffer for the Chapter 10 myfirst driver.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue