From 127eb3863ca19d7af726967e70adec27cb80e4e2 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 26 Aug 2026 02:32:55 +0100 Subject: [PATCH] refactor: adopt current style(9) license header order (copyright before SPDX) Update all example sources, man pages, and chapter code blocks to the current FreeBSD header convention: plain /* opening, copyright lines first, SPDX-License-Identifier after them. Add missing headers to ch21/ch22 example files and missing copyright lines in ch08/ch16/ch36. Rewrite chapter 37 prose (en, pt_BR, es_ES, zh_CN) and the submission checklist, which previously taught the /*- marker and SPDX-first order. --- content/chapters/part2/chapter-07.md | 6 +- content/chapters/part3/chapter-15.md | 6 +- content/chapters/part4/chapter-17.md | 8 +- content/chapters/part4/chapter-18.md | 18 +-- content/chapters/part7/chapter-37.md | 112 +++++++++--------- .../labs/lab7.4-fail-dev/myfirst.c | 6 +- .../labs/lab7.4-fail-mtx/myfirst.c | 6 +- .../stage0-scaffold/myfirst.c | 6 +- .../stage1-newbus/myfirst.c | 6 +- .../stage2-final/myfirst.c | 6 +- .../stage0-structured-name/myfirst.c | 6 +- .../stage1-alias/myfirst.c | 6 +- .../stage2-perhandle/myfirst.c | 6 +- .../stage3-two-nodes/myfirst.c | 6 +- .../stage4-destroy-drain/myfirst.c | 6 +- .../userland/hold_myfirst.c | 4 +- .../userland/parallel_probe.c | 4 +- .../userland/probe_myfirst.c | 4 +- .../userland/stat_myfirst.c | 4 +- .../userland/stress_probe.c | 4 +- .../stage1-static-message/myfirst.c | 6 +- .../stage2-readwrite/myfirst.c | 6 +- .../stage3-echo/myfirst.c | 6 +- .../cbuf-userland/cb_test.c | 6 +- .../cbuf-userland/cbuf.c | 6 +- .../cbuf-userland/cbuf.h | 6 +- .../stage2-circular/cbuf.c | 6 +- .../stage2-circular/cbuf.h | 6 +- .../stage2-circular/myfirst.c | 6 +- .../stage3-blocking/cbuf.c | 6 +- .../stage3-blocking/cbuf.h | 6 +- .../stage3-blocking/myfirst.c | 6 +- .../stage4-poll-refactor/cbuf.c | 6 +- .../stage4-poll-refactor/cbuf.h | 6 +- .../stage4-poll-refactor/myfirst.c | 6 +- .../stage5-mmap/cbuf.c | 6 +- .../stage5-mmap/cbuf.h | 6 +- .../stage5-mmap/myfirst.c | 6 +- .../userland/mmap_myfirst.c | 6 +- .../userland/producer_consumer.c | 6 +- .../userland/rw_myfirst_nb.c | 6 +- .../userland/rw_myfirst_v2.c | 6 +- .../userland/stress_rw.c | 6 +- .../ch11-concurrency/stage1-race-demo/cbuf.c | 6 +- .../ch11-concurrency/stage1-race-demo/cbuf.h | 6 +- .../stage1-race-demo/myfirst.c | 6 +- .../stage2-concurrent-safe/cbuf.c | 6 +- .../stage2-concurrent-safe/cbuf.h | 6 +- .../stage2-concurrent-safe/myfirst.c | 6 +- .../ch11-concurrency/stage3-counter9/cbuf.c | 6 +- .../ch11-concurrency/stage3-counter9/cbuf.h | 6 +- .../stage3-counter9/myfirst.c | 6 +- .../ch11-concurrency/stage5-kasserts/cbuf.c | 6 +- .../ch11-concurrency/stage5-kasserts/cbuf.h | 6 +- .../stage5-kasserts/myfirst.c | 6 +- .../ch11-concurrency/userland/lat_tester.c | 6 +- .../ch11-concurrency/userland/mp_stress.c | 6 +- .../ch11-concurrency/userland/mt_reader.c | 6 +- .../stage1-cv-channels/cbuf.c | 6 +- .../stage1-cv-channels/cbuf.h | 6 +- .../stage1-cv-channels/myfirst.c | 6 +- .../stage2-bounded-read/cbuf.c | 6 +- .../stage2-bounded-read/cbuf.h | 6 +- .../stage2-bounded-read/myfirst.c | 6 +- .../stage3-sx-config/cbuf.c | 6 +- .../stage3-sx-config/cbuf.h | 6 +- .../stage3-sx-config/myfirst.c | 6 +- .../stage4-final/cbuf.c | 6 +- .../stage4-final/cbuf.h | 6 +- .../stage4-final/myfirst.c | 6 +- .../userland/config_writer.c | 6 +- .../userland/timeout_tester.c | 6 +- .../stage1-heartbeat/cbuf.c | 6 +- .../stage1-heartbeat/cbuf.h | 6 +- .../stage1-heartbeat/myfirst.c | 6 +- .../stage2-watchdog/cbuf.c | 6 +- .../stage2-watchdog/cbuf.h | 6 +- .../stage2-watchdog/myfirst.c | 6 +- .../stage3-tick-source/cbuf.c | 6 +- .../stage3-tick-source/cbuf.h | 6 +- .../stage3-tick-source/myfirst.c | 6 +- .../stage4-final/cbuf.c | 6 +- .../stage4-final/cbuf.h | 6 +- .../stage4-final/myfirst.c | 6 +- .../labs/poll_waiter.c | 6 +- .../stage1-first-task/cbuf.c | 6 +- .../stage1-first-task/cbuf.h | 6 +- .../stage1-first-task/myfirst.c | 6 +- .../stage2-private-taskqueue/cbuf.c | 6 +- .../stage2-private-taskqueue/cbuf.h | 6 +- .../stage2-private-taskqueue/myfirst.c | 6 +- .../stage3-coalescing/cbuf.c | 6 +- .../stage3-coalescing/cbuf.h | 6 +- .../stage3-coalescing/myfirst.c | 6 +- .../stage4-final/cbuf.c | 6 +- .../stage4-final/cbuf.h | 6 +- .../stage4-final/myfirst.c | 6 +- .../labs/signal_read.c | 6 +- .../labs/writer_cap_test.c | 6 +- .../stage1-writers-sema/cbuf.c | 6 +- .../stage1-writers-sema/cbuf.h | 6 +- .../stage1-writers-sema/myfirst.c | 6 +- .../stage2-stats-cache/cbuf.c | 6 +- .../stage2-stats-cache/cbuf.h | 6 +- .../stage2-stats-cache/myfirst.c | 6 +- .../stage3-interruptible/cbuf.c | 6 +- .../stage3-interruptible/cbuf.h | 6 +- .../stage3-interruptible/myfirst.c | 6 +- .../stage4-final/cbuf.c | 6 +- .../stage4-final/cbuf.h | 6 +- .../stage4-final/myfirst.c | 6 +- .../stage4-final/myfirst_sync.h | 6 +- .../hwsim-standalone/hwsim.c | 4 +- .../labs/register_dump.c | 4 +- .../stage4-final/myfirst_hw.c | 6 +- .../stage4-final/myfirst_hw.h | 6 +- .../hwsim2-standalone/hwsim2.c | 6 +- .../stage5-final/myfirst_hw.h | 6 +- .../stage5-final/myfirst_sim.c | 6 +- .../stage5-final/myfirst_sim.h | 6 +- .../stage1-probe/myfirst_pci.c | 6 +- .../stage1-probe/myfirst_pci.h | 6 +- .../stage2-bar/myfirst_pci.c | 6 +- .../stage2-bar/myfirst_pci.h | 6 +- .../stage3-integrated/myfirst_hw_pci.c | 6 +- .../stage3-integrated/myfirst_pci.c | 6 +- .../stage3-integrated/myfirst_pci.h | 6 +- .../stage4-final/myfirst_hw_pci.c | 6 +- .../stage4-final/myfirst_pci.c | 6 +- .../stage4-final/myfirst_pci.h | 6 +- .../stage4-final/myfirst_intr.c | 6 +- .../stage4-final/myfirst_intr.h | 6 +- .../stage4-final/myfirst_msix.c | 6 +- .../stage4-final/myfirst_msix.h | 6 +- .../stage1-alloc/myfirst_dma_snippet.c | 6 +- .../stage1-alloc/myfirst_softc_additions.h | 6 +- .../stage2-polling/myfirst_dma_stage2.c | 6 +- .../stage2-polling/myfirst_header_additions.h | 6 +- .../stage2-polling/myfirst_sim_dma_stage2.c | 6 +- .../stage3-interrupt/myfirst_dma_stage3.c | 6 +- .../stage3-interrupt/myfirst_intr_additions.c | 6 +- .../ch21-dma/stage4-final/myfirst_dma.c | 6 +- .../ch21-dma/stage4-final/myfirst_dma.h | 6 +- .../myfirst_header_additions.h | 6 +- .../stage1-skeleton/myfirst_pci_stage1.c | 6 +- .../stage2-quiesce/myfirst_header_additions.h | 6 +- .../stage2-quiesce/myfirst_pci_stage2.c | 6 +- .../stage3-restore/myfirst_pci_stage3.c | 6 +- .../ch22-power/stage4-final/myfirst_power.c | 6 +- .../ch22-power/stage4-final/myfirst_power.h | 6 +- .../exercise-your-own/skeleton-template.c | 4 +- .../ch37-upstream/sample-driver/mydev.c | 6 +- .../ch37-upstream/sample-driver/mydev.h | 6 +- .../ch37-upstream/sample-driver/mydevreg.h | 6 +- .../ch37-upstream/sample-manpage/mydev.4 | 4 +- .../ch37-upstream/submission-checklist.md | 13 +- .../template-driver/share/man/man4/mydrv.4 | 4 +- .../template-driver/sys/dev/mydrv/mydrv.c | 6 +- .../template-driver/sys/dev/mydrv/mydrv.h | 6 +- .../es_ES/chapters/part2/chapter-07.md | 6 +- .../es_ES/chapters/part3/chapter-15.md | 6 +- .../es_ES/chapters/part4/chapter-17.md | 8 +- .../es_ES/chapters/part4/chapter-18.md | 18 +-- .../es_ES/chapters/part7/chapter-37.md | 66 +++++------ .../pt_BR/chapters/part2/chapter-07.md | 6 +- .../pt_BR/chapters/part3/chapter-15.md | 6 +- .../pt_BR/chapters/part4/chapter-17.md | 8 +- .../pt_BR/chapters/part4/chapter-18.md | 18 +-- .../pt_BR/chapters/part7/chapter-37.md | 76 ++++++------ .../zh_CN/chapters/part2/chapter-07.md | 6 +- .../zh_CN/chapters/part3/chapter-15.md | 6 +- .../zh_CN/chapters/part4/chapter-17.md | 8 +- .../zh_CN/chapters/part4/chapter-18.md | 18 +-- .../zh_CN/chapters/part7/chapter-37.md | 54 ++++----- 174 files changed, 727 insertions(+), 644 deletions(-) diff --git a/content/chapters/part2/chapter-07.md b/content/chapters/part2/chapter-07.md index 35a77d6..ba99b5d 100644 --- a/content/chapters/part2/chapter-07.md +++ b/content/chapters/part2/chapter-07.md @@ -238,10 +238,10 @@ Now create `myfirst.c`, the actual driver source. This first version is **minima Here's the skeleton: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. */ diff --git a/content/chapters/part3/chapter-15.md b/content/chapters/part3/chapter-15.md index 9c76d65..cf5a252 100644 --- a/content/chapters/part3/chapter-15.md +++ b/content/chapters/part3/chapter-15.md @@ -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. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sync.h: the named synchronisation vocabulary of the * myfirst driver. * diff --git a/content/chapters/part4/chapter-17.md b/content/chapters/part4/chapter-17.md index 5405346..00467e5 100644 --- a/content/chapters/part4/chapter-17.md +++ b/content/chapters/part4/chapter-17.md @@ -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: ```c -/*- +/* * myfirst_sim.c -- Chapter 17 simulated hardware backend. * * 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`. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sim.h -- Chapter 17 simulation API. * * The simulation layer turns the Chapter 16 static register block into diff --git a/content/chapters/part4/chapter-18.md b/content/chapters/part4/chapter-18.md index 7b9dfb0..499555b 100644 --- a/content/chapters/part4/chapter-18.md +++ b/content/chapters/part4/chapter-18.md @@ -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`. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.c -- Chapter 18 Stage 1 PCI probe/attach skeleton. * * At this stage the driver only probes, attaches, and detaches. @@ -597,11 +597,11 @@ MODULE_VERSION(myfirst, 1); The companion header, `myfirst_pci.h`: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * 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 ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2006 Marcel Moolenaar All rights reserved. * Copyright (c) 2001 M. Warner Losh + * + * SPDX-License-Identifier: BSD-2-Clause ... */ diff --git a/content/chapters/part7/chapter-37.md b/content/chapters/part7/chapter-37.md index c1baa00..c87afc8 100644 --- a/content/chapters/part7/chapter-37.md +++ b/content/chapters/part7/chapter-37.md @@ -696,11 +696,11 @@ macros in earlier chapters; here we are focusing on how they arrange themselves on the page. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: @@ -785,9 +785,9 @@ MODULE_VERSION(mydev, 1); MODULE_DEPEND(mydev, pci, 1, 1, 1); ``` -Several things are worth noticing. The copyright header uses the -`/*-` opening marker, which the automatic licence-harvesting -script recognises. The SPDX line names the licence explicitly. +Several things are worth noticing. The copyright header opens +with a plain `/*` comment, states the copyright first, and then +names the licence explicitly with the SPDX line. The indentation is tabs, not spaces, as mandated by `style(9)`. The function declarations are tab-separated, also per `style(9)`. The `DRIVER_MODULE` and related macros appear at the bottom, in @@ -888,14 +888,13 @@ as a panic message. #### Copyright Header Form -The copyright header uses the `/*-` opening marker. This marker -is magic. An automated tool harvests licences from the tree by -looking for multi-line comments that start in column 1 with `/*-`. -Using the marker flags the block as a licence; using a regular -`/*` does not. Immediately after `/*-`, the next significant line -should be `SPDX-License-Identifier:` followed by the SPDX licence -code, such as `BSD-2-Clause`. Then come one or more `Copyright` -lines. Then the licence text. +The copyright header is a multi-line comment starting in column 1 +with a plain `/*`. Older files open with `/*-`, a marker that a +licence-harvesting tool once relied on; `style(9)` no longer asks +for the dash in new code. The first significant lines are one or +more `Copyright` lines. After the copyright lines comes +`SPDX-License-Identifier:` followed by the SPDX licence code, +such as `BSD-2-Clause`. Then, optionally, the licence text. #### 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 `mydev`, the main source file is `mydev.c`, not `main.c` or `driver.c`. -- Missing or incorrect copyright header. The header uses `/*-` as - the opening marker, the SPDX identifier comes first, and the - licence text matches one of the project's accepted licences. +- Missing or incorrect copyright header. The header opens with + `/*`, the copyright lines come first, the SPDX identifier + 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 the style checker will flag space indentation immediately. - 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. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * 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 -significant. An automated script in the tree harvests licence -information from files by looking for multi-line comments that -start in column 1 with the sequence `/*-`. Using `/*-` flags the -block as a licence; using plain `/*` does not. `style(9)` is -explicit: if you want the tree's licence harvester to pick up -your licence correctly, use `/*-` for the opening line. +The opening is a plain `/*` in column 1. You will still see `/*-` +at the top of many files in the tree: the dash was a marker for an +automated licence-harvesting script, and for years `style(9)` +required it. The current `style(9)` has dropped that requirement, +so new code opens the header with `/*` and relies on the SPDX line +to identify the licence. -Immediately after the opening is the SPDX-License-Identifier -line. SPDX is a standardised vocabulary for describing licences -in machine-readable form. The line tells the harvester which -licence the file is under, and it does so in a form that cannot be +Immediately after the opening come the copyright lines, then the +SPDX-License-Identifier line. SPDX is a standardised vocabulary +for describing licences in machine-readable form. The line names +the licence the file is under in a form that cannot be misinterpreted. Use `BSD-2-Clause` for a two-clause BSD licence, `BSD-3-Clause` for a three-clause BSD licence. For other licences, 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 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: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 1998 Original Author * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * [licence text] */ ``` @@ -1546,17 +1547,17 @@ never prepared for submission, you will need to add the proper header to each file. The steps are: 1. Decide on the licence. For a new driver, use BSD-2-Clause. -2. Write the SPDX identifier line. -3. Write the copyright line with your name, email, and the year +2. Write the copyright line with your name, email, and the year of first creation. +3. Write the SPDX identifier line after the copyright line. 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. 6. Verify that there is a single blank line after the closing `*/`. 7. Repeat for each file: the `.c` files, the `.h` files, the - manual page (where the licence appears as `.\" -` style - comments rather than `/*-` style), and any other files that + manual page (where the licence appears as `.\"` style + comments rather than `/*` style), and any other files that contain substantial content. 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 a FreeBSD copyright header. The `checkstyle9.pl` script catches some kinds of formatting errors near the header. The licence -harvester in the tree works on the `/*-` marker and the SPDX -line. The most reliable validation, however, is to compare your +tooling in the tree works on the SPDX line. The most reliable +validation, however, is to compare your header directly against a known-good header from a recent commit in the tree, such as the header in `/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 for historical files. New contributions should default to BSD-2-Clause. The copyright header uses a specific form, opening -with `/*-`, followed by an SPDX identifier, followed by one or -more copyright lines, followed by the standard licence text. Code +with `/*`, followed by one or more copyright lines, followed by +an SPDX identifier, followed by the standard licence text. Code derived from other projects carries its original licence obligations forward, and derivative work must preserve the 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. ```text -.\"- -.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2026 Your Name .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Redistribution and use in source and binary forms, with or .\" without modification, are permitted provided that the .\" 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 any notes to future editors. -The opening marker is `.\"-` with a dash, equivalent to the `/*-` -in C files. The licence harvester recognises it. +The opening line is a plain `.\"`, equivalent to the `/*` opening +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, 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. 2. For each file, check the existing header. If it is missing or malformed, replace it with a known-good template. -3. Use `/*-` as the opening of the header in `.c` and `.h` files. - Use `.\"-` as the opening in the manual page. -4. Include the SPDX-License-Identifier line with the appropriate - licence, typically `BSD-2-Clause`. -5. Add your name and email to the Copyright line. +3. Use `/*` as the opening of the header in `.c` and `.h` files. + Use `.\"` as the opening in the manual page. +4. Add your name and email to the Copyright line. +5. Include the SPDX-License-Identifier line, after the Copyright + line, with the appropriate licence, typically `BSD-2-Clause`. 6. Include the standard licence text. -7. Verify that the file starts in column 1 with the `/*-` or - `.\"-` opening. +7. Verify that the file starts in column 1 with the `/*` or + `.\"` opening. Success criterion: every file has a correctly-formatted header that matches the conventions of files already in the tree. diff --git a/examples/part-02/ch07-writing-your-first-driver/labs/lab7.4-fail-dev/myfirst.c b/examples/part-02/ch07-writing-your-first-driver/labs/lab7.4-fail-dev/myfirst.c index 15d67dd..f6cbd5e 100644 --- a/examples/part-02/ch07-writing-your-first-driver/labs/lab7.4-fail-dev/myfirst.c +++ b/examples/part-02/ch07-writing-your-first-driver/labs/lab7.4-fail-dev/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Lab 7.4, variant B. diff --git a/examples/part-02/ch07-writing-your-first-driver/labs/lab7.4-fail-mtx/myfirst.c b/examples/part-02/ch07-writing-your-first-driver/labs/lab7.4-fail-mtx/myfirst.c index 2bd6063..18fac74 100644 --- a/examples/part-02/ch07-writing-your-first-driver/labs/lab7.4-fail-mtx/myfirst.c +++ b/examples/part-02/ch07-writing-your-first-driver/labs/lab7.4-fail-mtx/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Lab 7.4, variant A. diff --git a/examples/part-02/ch07-writing-your-first-driver/stage0-scaffold/myfirst.c b/examples/part-02/ch07-writing-your-first-driver/stage0-scaffold/myfirst.c index efe8b67..7375fe7 100644 --- a/examples/part-02/ch07-writing-your-first-driver/stage0-scaffold/myfirst.c +++ b/examples/part-02/ch07-writing-your-first-driver/stage0-scaffold/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Stage 0 of Chapter 7: minimal kernel module scaffold. diff --git a/examples/part-02/ch07-writing-your-first-driver/stage1-newbus/myfirst.c b/examples/part-02/ch07-writing-your-first-driver/stage1-newbus/myfirst.c index c2fb8da..df71f97 100644 --- a/examples/part-02/ch07-writing-your-first-driver/stage1-newbus/myfirst.c +++ b/examples/part-02/ch07-writing-your-first-driver/stage1-newbus/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Stage 1 of Chapter 7: minimal Newbus pseudo-device. diff --git a/examples/part-02/ch07-writing-your-first-driver/stage2-final/myfirst.c b/examples/part-02/ch07-writing-your-first-driver/stage2-final/myfirst.c index 5c904f4..457eaf1 100644 --- a/examples/part-02/ch07-writing-your-first-driver/stage2-final/myfirst.c +++ b/examples/part-02/ch07-writing-your-first-driver/stage2-final/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Stage 2 of Chapter 7: complete minimal pseudo-device driver. diff --git a/examples/part-02/ch08-working-with-device-files/stage0-structured-name/myfirst.c b/examples/part-02/ch08-working-with-device-files/stage0-structured-name/myfirst.c index 1db6cc3..d4911b3 100644 --- a/examples/part-02/ch08-working-with-device-files/stage0-structured-name/myfirst.c +++ b/examples/part-02/ch08-working-with-device-files/stage0-structured-name/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Stage 0 of Chapter 8: the Chapter 7 driver with a structured device diff --git a/examples/part-02/ch08-working-with-device-files/stage1-alias/myfirst.c b/examples/part-02/ch08-working-with-device-files/stage1-alias/myfirst.c index 28752bc..a710681 100644 --- a/examples/part-02/ch08-working-with-device-files/stage1-alias/myfirst.c +++ b/examples/part-02/ch08-working-with-device-files/stage1-alias/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Stage 1 of Chapter 8: add an alias so /dev/myfirst points at diff --git a/examples/part-02/ch08-working-with-device-files/stage2-perhandle/myfirst.c b/examples/part-02/ch08-working-with-device-files/stage2-perhandle/myfirst.c index f7eae0b..ed984e2 100644 --- a/examples/part-02/ch08-working-with-device-files/stage2-perhandle/myfirst.c +++ b/examples/part-02/ch08-working-with-device-files/stage2-perhandle/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Stage 2 of Chapter 8: per-open state via devfs_set_cdevpriv(). diff --git a/examples/part-02/ch08-working-with-device-files/stage3-two-nodes/myfirst.c b/examples/part-02/ch08-working-with-device-files/stage3-two-nodes/myfirst.c index 8f8baaa..41c2b06 100644 --- a/examples/part-02/ch08-working-with-device-files/stage3-two-nodes/myfirst.c +++ b/examples/part-02/ch08-working-with-device-files/stage3-two-nodes/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Stage 3 of Chapter 8: two-node driver with data and control nodes. diff --git a/examples/part-02/ch08-working-with-device-files/stage4-destroy-drain/myfirst.c b/examples/part-02/ch08-working-with-device-files/stage4-destroy-drain/myfirst.c index 9515b2d..a6c41d5 100644 --- a/examples/part-02/ch08-working-with-device-files/stage4-destroy-drain/myfirst.c +++ b/examples/part-02/ch08-working-with-device-files/stage4-destroy-drain/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Stage 4 of Chapter 8: multiple cdevs plus destroy_dev_drain. diff --git a/examples/part-02/ch08-working-with-device-files/userland/hold_myfirst.c b/examples/part-02/ch08-working-with-device-files/userland/hold_myfirst.c index 7130b95..95b3c0d 100644 --- a/examples/part-02/ch08-working-with-device-files/userland/hold_myfirst.c +++ b/examples/part-02/ch08-working-with-device-files/userland/hold_myfirst.c @@ -1,4 +1,6 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * * SPDX-License-Identifier: BSD-2-Clause * * hold_myfirst: open /dev/myfirst/0 and sleep. Used for Challenge 2 to diff --git a/examples/part-02/ch08-working-with-device-files/userland/parallel_probe.c b/examples/part-02/ch08-working-with-device-files/userland/parallel_probe.c index 45d4659..667f46d 100644 --- a/examples/part-02/ch08-working-with-device-files/userland/parallel_probe.c +++ b/examples/part-02/ch08-working-with-device-files/userland/parallel_probe.c @@ -1,4 +1,6 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * * SPDX-License-Identifier: BSD-2-Clause * * parallel_probe: open a device node multiple times from a single diff --git a/examples/part-02/ch08-working-with-device-files/userland/probe_myfirst.c b/examples/part-02/ch08-working-with-device-files/userland/probe_myfirst.c index 34ab067..dc42f1f 100644 --- a/examples/part-02/ch08-working-with-device-files/userland/probe_myfirst.c +++ b/examples/part-02/ch08-working-with-device-files/userland/probe_myfirst.c @@ -1,4 +1,6 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * * SPDX-License-Identifier: BSD-2-Clause * * probe_myfirst: a tiny userland probe for the Chapter 8 myfirst driver. diff --git a/examples/part-02/ch08-working-with-device-files/userland/stat_myfirst.c b/examples/part-02/ch08-working-with-device-files/userland/stat_myfirst.c index 2bdf537..8274203 100644 --- a/examples/part-02/ch08-working-with-device-files/userland/stat_myfirst.c +++ b/examples/part-02/ch08-working-with-device-files/userland/stat_myfirst.c @@ -1,4 +1,6 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * * SPDX-License-Identifier: BSD-2-Clause * * stat_myfirst: print stat(2) metadata for one or more device-file diff --git a/examples/part-02/ch08-working-with-device-files/userland/stress_probe.c b/examples/part-02/ch08-working-with-device-files/userland/stress_probe.c index 71e451d..15e984b 100644 --- a/examples/part-02/ch08-working-with-device-files/userland/stress_probe.c +++ b/examples/part-02/ch08-working-with-device-files/userland/stress_probe.c @@ -1,4 +1,6 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * * SPDX-License-Identifier: BSD-2-Clause * * stress_probe: loop open() and close() on a device node many times. diff --git a/examples/part-02/ch09-reading-and-writing/stage1-static-message/myfirst.c b/examples/part-02/ch09-reading-and-writing/stage1-static-message/myfirst.c index 45d36ff..d3e1e7a 100644 --- a/examples/part-02/ch09-reading-and-writing/stage1-static-message/myfirst.c +++ b/examples/part-02/ch09-reading-and-writing/stage1-static-message/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Chapter 9, Stage 1: a static-message read path. diff --git a/examples/part-02/ch09-reading-and-writing/stage2-readwrite/myfirst.c b/examples/part-02/ch09-reading-and-writing/stage2-readwrite/myfirst.c index 04a9db2..242acb9 100644 --- a/examples/part-02/ch09-reading-and-writing/stage2-readwrite/myfirst.c +++ b/examples/part-02/ch09-reading-and-writing/stage2-readwrite/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Chapter 9, Stage 2: a write-once / read-many buffer. diff --git a/examples/part-02/ch09-reading-and-writing/stage3-echo/myfirst.c b/examples/part-02/ch09-reading-and-writing/stage3-echo/myfirst.c index 12abb1b..4a6eec9 100644 --- a/examples/part-02/ch09-reading-and-writing/stage3-echo/myfirst.c +++ b/examples/part-02/ch09-reading-and-writing/stage3-echo/myfirst.c @@ -1,7 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. * * Chapter 9, Stage 3: a first-in / first-out echo driver. diff --git a/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cb_test.c b/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cb_test.c index 2f513c1..b01d10d 100644 --- a/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cb_test.c +++ b/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cb_test.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cb_test.c: simple sanity tests for the cbuf userland implementation. */ diff --git a/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cbuf.c b/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cbuf.c index c5028c1..1676019 100644 --- a/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cbuf.c +++ b/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: userland implementation of the byte-oriented circular buffer. */ diff --git a/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cbuf.h b/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cbuf.h index 9d157d4..ab62883 100644 --- a/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cbuf.h +++ b/examples/part-02/ch10-handling-io-efficiently/cbuf-userland/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer. * * The buffer does not lock; the caller is responsible for whatever diff --git a/examples/part-02/ch10-handling-io-efficiently/stage2-circular/cbuf.c b/examples/part-02/ch10-handling-io-efficiently/stage2-circular/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage2-circular/cbuf.c +++ b/examples/part-02/ch10-handling-io-efficiently/stage2-circular/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-02/ch10-handling-io-efficiently/stage2-circular/cbuf.h b/examples/part-02/ch10-handling-io-efficiently/stage2-circular/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage2-circular/cbuf.h +++ b/examples/part-02/ch10-handling-io-efficiently/stage2-circular/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-02/ch10-handling-io-efficiently/stage2-circular/myfirst.c b/examples/part-02/ch10-handling-io-efficiently/stage2-circular/myfirst.c index 4d876dc..30805d5 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage2-circular/myfirst.c +++ b/examples/part-02/ch10-handling-io-efficiently/stage2-circular/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 10, Stage 2: circular-buffer integration. * * Replaces the Stage 3 linear FIFO from Chapter 9 with a true diff --git a/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/cbuf.c b/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/cbuf.c +++ b/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/cbuf.h b/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/cbuf.h +++ b/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/myfirst.c b/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/myfirst.c index f50117a..25a29d6 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/myfirst.c +++ b/examples/part-02/ch10-handling-io-efficiently/stage3-blocking/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 10, Stage 3: blocking and non-blocking I/O. * * Builds on Stage 2 by adding mtx_sleep(9) on the empty/full diff --git a/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/cbuf.c b/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/cbuf.c +++ b/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/cbuf.h b/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/cbuf.h +++ b/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/myfirst.c b/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/myfirst.c index afc9162..d5dcb99 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/myfirst.c +++ b/examples/part-02/ch10-handling-io-efficiently/stage4-poll-refactor/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 10, Stage 4: poll support and refactor. * * Adds d_poll, selinfo for read and write readiness, and refactors diff --git a/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/cbuf.c b/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/cbuf.c +++ b/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/cbuf.h b/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/cbuf.h +++ b/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/myfirst.c b/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/myfirst.c index 8481285..591cc26 100644 --- a/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/myfirst.c +++ b/examples/part-02/ch10-handling-io-efficiently/stage5-mmap/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 10, Stage 5: minimal d_mmap on top of Stage 4. * * Lets user space mmap(2) the cbuf's backing memory read-only. diff --git a/examples/part-02/ch10-handling-io-efficiently/userland/mmap_myfirst.c b/examples/part-02/ch10-handling-io-efficiently/userland/mmap_myfirst.c index 8cd922d..7d57cf3 100644 --- a/examples/part-02/ch10-handling-io-efficiently/userland/mmap_myfirst.c +++ b/examples/part-02/ch10-handling-io-efficiently/userland/mmap_myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * 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 diff --git a/examples/part-02/ch10-handling-io-efficiently/userland/producer_consumer.c b/examples/part-02/ch10-handling-io-efficiently/userland/producer_consumer.c index c9f5932..e4f2b3d 100644 --- a/examples/part-02/ch10-handling-io-efficiently/userland/producer_consumer.c +++ b/examples/part-02/ch10-handling-io-efficiently/userland/producer_consumer.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * producer_consumer.c: a two-process load test for /dev/myfirst. * * Forks a child writer and uses the parent as the reader. Each side diff --git a/examples/part-02/ch10-handling-io-efficiently/userland/rw_myfirst_nb.c b/examples/part-02/ch10-handling-io-efficiently/userland/rw_myfirst_nb.c index 88a853f..b79ea80 100644 --- a/examples/part-02/ch10-handling-io-efficiently/userland/rw_myfirst_nb.c +++ b/examples/part-02/ch10-handling-io-efficiently/userland/rw_myfirst_nb.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * rw_myfirst_nb.c: non-blocking behaviour tester for /dev/myfirst. * * Exercises Stage 3+ of Chapter 10: diff --git a/examples/part-02/ch10-handling-io-efficiently/userland/rw_myfirst_v2.c b/examples/part-02/ch10-handling-io-efficiently/userland/rw_myfirst_v2.c index 7c30eda..4ad0e3a 100644 --- a/examples/part-02/ch10-handling-io-efficiently/userland/rw_myfirst_v2.c +++ b/examples/part-02/ch10-handling-io-efficiently/userland/rw_myfirst_v2.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * rw_myfirst_v2.c: sized fill/drain tester for /dev/myfirst. * * Usage: diff --git a/examples/part-02/ch10-handling-io-efficiently/userland/stress_rw.c b/examples/part-02/ch10-handling-io-efficiently/userland/stress_rw.c index 397b4b3..66eade2 100644 --- a/examples/part-02/ch10-handling-io-efficiently/userland/stress_rw.c +++ b/examples/part-02/ch10-handling-io-efficiently/userland/stress_rw.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * stress_rw.c: a single-process stress harness for /dev/myfirst. * * Runs through a small table of (block size, repeat count) pairs. diff --git a/examples/part-03/ch11-concurrency/stage1-race-demo/cbuf.c b/examples/part-03/ch11-concurrency/stage1-race-demo/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch11-concurrency/stage1-race-demo/cbuf.c +++ b/examples/part-03/ch11-concurrency/stage1-race-demo/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch11-concurrency/stage1-race-demo/cbuf.h b/examples/part-03/ch11-concurrency/stage1-race-demo/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch11-concurrency/stage1-race-demo/cbuf.h +++ b/examples/part-03/ch11-concurrency/stage1-race-demo/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch11-concurrency/stage1-race-demo/myfirst.c b/examples/part-03/ch11-concurrency/stage1-race-demo/myfirst.c index f0a5f6e..61d627b 100644 --- a/examples/part-03/ch11-concurrency/stage1-race-demo/myfirst.c +++ b/examples/part-03/ch11-concurrency/stage1-race-demo/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 11, Stage 1: DELIBERATELY UNSAFE race-demo driver. * * This driver is structurally identical to the Chapter 10 Stage 4 driver, diff --git a/examples/part-03/ch11-concurrency/stage2-concurrent-safe/cbuf.c b/examples/part-03/ch11-concurrency/stage2-concurrent-safe/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch11-concurrency/stage2-concurrent-safe/cbuf.c +++ b/examples/part-03/ch11-concurrency/stage2-concurrent-safe/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch11-concurrency/stage2-concurrent-safe/cbuf.h b/examples/part-03/ch11-concurrency/stage2-concurrent-safe/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch11-concurrency/stage2-concurrent-safe/cbuf.h +++ b/examples/part-03/ch11-concurrency/stage2-concurrent-safe/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch11-concurrency/stage2-concurrent-safe/myfirst.c b/examples/part-03/ch11-concurrency/stage2-concurrent-safe/myfirst.c index d5a71cc..e2c8b66 100644 --- a/examples/part-03/ch11-concurrency/stage2-concurrent-safe/myfirst.c +++ b/examples/part-03/ch11-concurrency/stage2-concurrent-safe/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 11, Stage 2: concurrent-safe with documented locking. * * Functionally identical to the Chapter 10 Stage 4 driver. The diff --git a/examples/part-03/ch11-concurrency/stage3-counter9/cbuf.c b/examples/part-03/ch11-concurrency/stage3-counter9/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch11-concurrency/stage3-counter9/cbuf.c +++ b/examples/part-03/ch11-concurrency/stage3-counter9/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch11-concurrency/stage3-counter9/cbuf.h b/examples/part-03/ch11-concurrency/stage3-counter9/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch11-concurrency/stage3-counter9/cbuf.h +++ b/examples/part-03/ch11-concurrency/stage3-counter9/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch11-concurrency/stage3-counter9/myfirst.c b/examples/part-03/ch11-concurrency/stage3-counter9/myfirst.c index 7229c74..fa720ed 100644 --- a/examples/part-03/ch11-concurrency/stage3-counter9/myfirst.c +++ b/examples/part-03/ch11-concurrency/stage3-counter9/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 11, Stage 3: migrate byte counters to counter(9). * * Builds on Stage 2 by replacing sc->bytes_read and sc->bytes_written, diff --git a/examples/part-03/ch11-concurrency/stage5-kasserts/cbuf.c b/examples/part-03/ch11-concurrency/stage5-kasserts/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch11-concurrency/stage5-kasserts/cbuf.c +++ b/examples/part-03/ch11-concurrency/stage5-kasserts/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch11-concurrency/stage5-kasserts/cbuf.h b/examples/part-03/ch11-concurrency/stage5-kasserts/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch11-concurrency/stage5-kasserts/cbuf.h +++ b/examples/part-03/ch11-concurrency/stage5-kasserts/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch11-concurrency/stage5-kasserts/myfirst.c b/examples/part-03/ch11-concurrency/stage5-kasserts/myfirst.c index f4a7f75..ca061ab 100644 --- a/examples/part-03/ch11-concurrency/stage5-kasserts/myfirst.c +++ b/examples/part-03/ch11-concurrency/stage5-kasserts/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 11, Stage 5: KASSERTs throughout, ready for a debug kernel. * * Builds on Chapter 11 Stage 3 (counter(9) migration) by adding KASSERT diff --git a/examples/part-03/ch11-concurrency/userland/lat_tester.c b/examples/part-03/ch11-concurrency/userland/lat_tester.c index 932f43b..f27dffc 100644 --- a/examples/part-03/ch11-concurrency/userland/lat_tester.c +++ b/examples/part-03/ch11-concurrency/userland/lat_tester.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * lat_tester.c: measure read latency against /dev/myfirst and print * a simple bucketed histogram. Useful for observing the cost of * the driver's mutex under various load conditions. diff --git a/examples/part-03/ch11-concurrency/userland/mp_stress.c b/examples/part-03/ch11-concurrency/userland/mp_stress.c index d28b683..7853ea7 100644 --- a/examples/part-03/ch11-concurrency/userland/mp_stress.c +++ b/examples/part-03/ch11-concurrency/userland/mp_stress.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * mp_stress.c: a multi-process stress tester for /dev/myfirst. * * Forks NWRITERS writer children and NREADERS reader children. diff --git a/examples/part-03/ch11-concurrency/userland/mt_reader.c b/examples/part-03/ch11-concurrency/userland/mt_reader.c index 4dd84b9..e8eac45 100644 --- a/examples/part-03/ch11-concurrency/userland/mt_reader.c +++ b/examples/part-03/ch11-concurrency/userland/mt_reader.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * mt_reader.c: multiple threads reading from one descriptor of * /dev/myfirst. Exercises the driver's handling of multiple * concurrent readers on the same fh. diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/cbuf.c b/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/cbuf.c +++ b/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/cbuf.h b/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/cbuf.h +++ b/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/myfirst.c b/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/myfirst.c index 7290726..c73e39a 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/myfirst.c +++ b/examples/part-03/ch12-synchronization-mechanisms/stage1-cv-channels/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 12, Stage 1: condition variables replace anonymous channels. * * Builds on Chapter 11 Stage 5 (counter9 + KASSERTs). Replaces the diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/cbuf.c b/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/cbuf.c +++ b/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/cbuf.h b/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/cbuf.h +++ b/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/myfirst.c b/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/myfirst.c index c767239..1c2b1a2 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/myfirst.c +++ b/examples/part-03/ch12-synchronization-mechanisms/stage2-bounded-read/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 12, Stage 2: bounded reads via cv_timedwait_sig. * * Builds on Chapter 12 Stage 1 (cv channels) by adding two new sysctls: diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/cbuf.c b/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/cbuf.c +++ b/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/cbuf.h b/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/cbuf.h +++ b/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/myfirst.c b/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/myfirst.c index 4ec0343..96094fb 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/myfirst.c +++ b/examples/part-03/ch12-synchronization-mechanisms/stage3-sx-config/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 12, Stage 3: sx-protected configuration subsystem. * * Builds on Stage 2 (bounded reads) by adding a runtime configuration diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage4-final/cbuf.c b/examples/part-03/ch12-synchronization-mechanisms/stage4-final/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage4-final/cbuf.c +++ b/examples/part-03/ch12-synchronization-mechanisms/stage4-final/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage4-final/cbuf.h b/examples/part-03/ch12-synchronization-mechanisms/stage4-final/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage4-final/cbuf.h +++ b/examples/part-03/ch12-synchronization-mechanisms/stage4-final/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch12-synchronization-mechanisms/stage4-final/myfirst.c b/examples/part-03/ch12-synchronization-mechanisms/stage4-final/myfirst.c index 325dc94..cf754a8 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/stage4-final/myfirst.c +++ b/examples/part-03/ch12-synchronization-mechanisms/stage4-final/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 12, Stage 4: the final synchronized driver. * * Combines all of Chapter 12: cv channels (Stage 1), bounded reads diff --git a/examples/part-03/ch12-synchronization-mechanisms/userland/config_writer.c b/examples/part-03/ch12-synchronization-mechanisms/userland/config_writer.c index 38c74aa..7cedaa2 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/userland/config_writer.c +++ b/examples/part-03/ch12-synchronization-mechanisms/userland/config_writer.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * config_writer.c: stress the Chapter 12 driver's configuration * sysctls by toggling debug_level and soft_byte_limit at high * frequency for a configurable duration. diff --git a/examples/part-03/ch12-synchronization-mechanisms/userland/timeout_tester.c b/examples/part-03/ch12-synchronization-mechanisms/userland/timeout_tester.c index 5331277..d2006f5 100644 --- a/examples/part-03/ch12-synchronization-mechanisms/userland/timeout_tester.c +++ b/examples/part-03/ch12-synchronization-mechanisms/userland/timeout_tester.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * timeout_tester.c: verify that the Chapter 12 driver's bounded * read returns EAGAIN after approximately the configured timeout * when no data is available. diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/cbuf.c b/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/cbuf.c +++ b/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/cbuf.h b/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/cbuf.h +++ b/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/myfirst.c b/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/myfirst.c index 75986b5..33d01d4 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/myfirst.c +++ b/examples/part-03/ch13-timers-and-delayed-work/stage1-heartbeat/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 13, Stage 1: heartbeat callout only. * * Builds on Chapter 12 Stage 4 by adding one callout: diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/cbuf.c b/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/cbuf.c +++ b/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/cbuf.h b/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/cbuf.h +++ b/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/myfirst.c b/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/myfirst.c index 763c231..bc28fc2 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/myfirst.c +++ b/examples/part-03/ch13-timers-and-delayed-work/stage2-watchdog/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 13, Stage 2: heartbeat + watchdog callouts. * * Builds on Stage 1 by adding the watchdog callout: diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/cbuf.c b/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/cbuf.c +++ b/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/cbuf.h b/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/cbuf.h +++ b/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/myfirst.c b/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/myfirst.c index c52328c..a2ed394 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/myfirst.c +++ b/examples/part-03/ch13-timers-and-delayed-work/stage3-tick-source/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 13, Stage 3: heartbeat + watchdog + tick source. * * Builds on Stage 2 by adding the tick source callout: diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage4-final/cbuf.c b/examples/part-03/ch13-timers-and-delayed-work/stage4-final/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage4-final/cbuf.c +++ b/examples/part-03/ch13-timers-and-delayed-work/stage4-final/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage4-final/cbuf.h b/examples/part-03/ch13-timers-and-delayed-work/stage4-final/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage4-final/cbuf.h +++ b/examples/part-03/ch13-timers-and-delayed-work/stage4-final/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch13-timers-and-delayed-work/stage4-final/myfirst.c b/examples/part-03/ch13-timers-and-delayed-work/stage4-final/myfirst.c index ef0758a..206bb52 100644 --- a/examples/part-03/ch13-timers-and-delayed-work/stage4-final/myfirst.c +++ b/examples/part-03/ch13-timers-and-delayed-work/stage4-final/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 13, Stage 4: the final timer-enhanced driver. * * Builds on Chapter 12 Stage 4 by adding three callouts: diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/labs/poll_waiter.c b/examples/part-03/ch14-taskqueues-and-deferred-work/labs/poll_waiter.c index 2466e9f..f3ac46d 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/labs/poll_waiter.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/labs/poll_waiter.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * poll_waiter.c: a trivial poll(2) client for /dev/myfirst. * * Compile with: diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/cbuf.c b/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/cbuf.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/cbuf.h b/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/cbuf.h +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/myfirst.c b/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/myfirst.c index a397a98..9898e8e 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/myfirst.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage1-first-task/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 14, Stage 1: the first task. * * Starts from Chapter 13 Stage 4 and adds one task, enqueued from the diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/cbuf.c b/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/cbuf.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/cbuf.h b/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/cbuf.h +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/myfirst.c b/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/myfirst.c index 907cbea..68e6a55 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/myfirst.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage2-private-taskqueue/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 14, Stage 2: the private taskqueue. * * Builds on Chapter 14 Stage 1 by creating a private taskqueue diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/cbuf.c b/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/cbuf.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/cbuf.h b/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/cbuf.h +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/myfirst.c b/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/myfirst.c index 1666c56..6d7068e 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/myfirst.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage3-coalescing/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 14, Stage 3: deliberate coalescing and a delayed reset. * * Builds on Stage 2 by adding bulk_writer_task (to demonstrate diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/cbuf.c b/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/cbuf.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/cbuf.h b/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/cbuf.h +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/myfirst.c b/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/myfirst.c index 62db7c1..d9ed689 100644 --- a/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/myfirst.c +++ b/examples/part-03/ch14-taskqueues-and-deferred-work/stage4-final/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 14, Stage 4: the final taskqueue-enhanced driver. * * Builds on Chapter 13 Stage 4 by adding a private taskqueue and three diff --git a/examples/part-03/ch15-more-synchronization/labs/signal_read.c b/examples/part-03/ch15-more-synchronization/labs/signal_read.c index 0d86bba..0e22503 100644 --- a/examples/part-03/ch15-more-synchronization/labs/signal_read.c +++ b/examples/part-03/ch15-more-synchronization/labs/signal_read.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * signal_read: start a blocking read on /dev/myfirst, receive a * signal after a delay, report how many bytes were delivered before * the signal interrupted the read. diff --git a/examples/part-03/ch15-more-synchronization/labs/writer_cap_test.c b/examples/part-03/ch15-more-synchronization/labs/writer_cap_test.c index fc174be..496e6d2 100644 --- a/examples/part-03/ch15-more-synchronization/labs/writer_cap_test.c +++ b/examples/part-03/ch15-more-synchronization/labs/writer_cap_test.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * writer_cap_test: start N concurrent writers that open /dev/myfirst * and write a short burst. Used to stress the writer-cap semaphore * introduced in Chapter 15 Stage 1. diff --git a/examples/part-03/ch15-more-synchronization/stage1-writers-sema/cbuf.c b/examples/part-03/ch15-more-synchronization/stage1-writers-sema/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch15-more-synchronization/stage1-writers-sema/cbuf.c +++ b/examples/part-03/ch15-more-synchronization/stage1-writers-sema/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch15-more-synchronization/stage1-writers-sema/cbuf.h b/examples/part-03/ch15-more-synchronization/stage1-writers-sema/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch15-more-synchronization/stage1-writers-sema/cbuf.h +++ b/examples/part-03/ch15-more-synchronization/stage1-writers-sema/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch15-more-synchronization/stage1-writers-sema/myfirst.c b/examples/part-03/ch15-more-synchronization/stage1-writers-sema/myfirst.c index 080761e..dc0e6e8 100644 --- a/examples/part-03/ch15-more-synchronization/stage1-writers-sema/myfirst.c +++ b/examples/part-03/ch15-more-synchronization/stage1-writers-sema/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 15, Stage 1: add the writer-cap semaphore. * * Builds on Chapter 14 Stage 4 by adding one primitive: diff --git a/examples/part-03/ch15-more-synchronization/stage2-stats-cache/cbuf.c b/examples/part-03/ch15-more-synchronization/stage2-stats-cache/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch15-more-synchronization/stage2-stats-cache/cbuf.c +++ b/examples/part-03/ch15-more-synchronization/stage2-stats-cache/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch15-more-synchronization/stage2-stats-cache/cbuf.h b/examples/part-03/ch15-more-synchronization/stage2-stats-cache/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch15-more-synchronization/stage2-stats-cache/cbuf.h +++ b/examples/part-03/ch15-more-synchronization/stage2-stats-cache/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch15-more-synchronization/stage2-stats-cache/myfirst.c b/examples/part-03/ch15-more-synchronization/stage2-stats-cache/myfirst.c index 80cb950..94fcad6 100644 --- a/examples/part-03/ch15-more-synchronization/stage2-stats-cache/myfirst.c +++ b/examples/part-03/ch15-more-synchronization/stage2-stats-cache/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 15, Stage 2: add the stats cache with sx upgrade pattern. * * Builds on Stage 1 by adding a read-mostly statistics cache: diff --git a/examples/part-03/ch15-more-synchronization/stage3-interruptible/cbuf.c b/examples/part-03/ch15-more-synchronization/stage3-interruptible/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch15-more-synchronization/stage3-interruptible/cbuf.c +++ b/examples/part-03/ch15-more-synchronization/stage3-interruptible/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch15-more-synchronization/stage3-interruptible/cbuf.h b/examples/part-03/ch15-more-synchronization/stage3-interruptible/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch15-more-synchronization/stage3-interruptible/cbuf.h +++ b/examples/part-03/ch15-more-synchronization/stage3-interruptible/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch15-more-synchronization/stage3-interruptible/myfirst.c b/examples/part-03/ch15-more-synchronization/stage3-interruptible/myfirst.c index a368234..4f84bb3 100644 --- a/examples/part-03/ch15-more-synchronization/stage3-interruptible/myfirst.c +++ b/examples/part-03/ch15-more-synchronization/stage3-interruptible/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 15, Stage 3: refine EINTR/ERESTART handling. * * Builds on Stage 2 by: diff --git a/examples/part-03/ch15-more-synchronization/stage4-final/cbuf.c b/examples/part-03/ch15-more-synchronization/stage4-final/cbuf.c index c92b247..3d3d63f 100644 --- a/examples/part-03/ch15-more-synchronization/stage4-final/cbuf.c +++ b/examples/part-03/ch15-more-synchronization/stage4-final/cbuf.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.c: kernel-side implementation of the byte-oriented circular * buffer for the Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch15-more-synchronization/stage4-final/cbuf.h b/examples/part-03/ch15-more-synchronization/stage4-final/cbuf.h index da7038c..9f70ca6 100644 --- a/examples/part-03/ch15-more-synchronization/stage4-final/cbuf.h +++ b/examples/part-03/ch15-more-synchronization/stage4-final/cbuf.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * cbuf.h: a fixed-size byte-oriented circular buffer for the * Chapter 10 myfirst driver. * diff --git a/examples/part-03/ch15-more-synchronization/stage4-final/myfirst.c b/examples/part-03/ch15-more-synchronization/stage4-final/myfirst.c index a1e4220..ecde058 100644 --- a/examples/part-03/ch15-more-synchronization/stage4-final/myfirst.c +++ b/examples/part-03/ch15-more-synchronization/stage4-final/myfirst.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 15, Stage 4: the coordinated driver (v0.9-coordination). * * Adds to Chapter 14 Stage 4: diff --git a/examples/part-03/ch15-more-synchronization/stage4-final/myfirst_sync.h b/examples/part-03/ch15-more-synchronization/stage4-final/myfirst_sync.h index e97dc1e..11414a2 100644 --- a/examples/part-03/ch15-more-synchronization/stage4-final/myfirst_sync.h +++ b/examples/part-03/ch15-more-synchronization/stage4-final/myfirst_sync.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sync.h: the named synchronisation vocabulary of the * myfirst driver at Chapter 15 Stage 4. * diff --git a/examples/part-04/ch16-accessing-hardware/hwsim-standalone/hwsim.c b/examples/part-04/ch16-accessing-hardware/hwsim-standalone/hwsim.c index 81553f0..72b5e26 100644 --- a/examples/part-04/ch16-accessing-hardware/hwsim-standalone/hwsim.c +++ b/examples/part-04/ch16-accessing-hardware/hwsim-standalone/hwsim.c @@ -1,4 +1,6 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * * SPDX-License-Identifier: BSD-2-Clause * * hwsim.c -- Chapter 16 stand-alone bus_space(9) practice module. diff --git a/examples/part-04/ch16-accessing-hardware/labs/register_dump.c b/examples/part-04/ch16-accessing-hardware/labs/register_dump.c index 8ca08a2..e67f5ed 100644 --- a/examples/part-04/ch16-accessing-hardware/labs/register_dump.c +++ b/examples/part-04/ch16-accessing-hardware/labs/register_dump.c @@ -1,4 +1,6 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * * SPDX-License-Identifier: BSD-2-Clause * * register_dump.c -- Chapter 16 user-space register dump tool. diff --git a/examples/part-04/ch16-accessing-hardware/stage4-final/myfirst_hw.c b/examples/part-04/ch16-accessing-hardware/stage4-final/myfirst_hw.c index 6c41caf..11de16e 100644 --- a/examples/part-04/ch16-accessing-hardware/stage4-final/myfirst_hw.c +++ b/examples/part-04/ch16-accessing-hardware/stage4-final/myfirst_hw.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_hw.c -- Chapter 16 Stage 4 hardware access layer. * * Implements: diff --git a/examples/part-04/ch16-accessing-hardware/stage4-final/myfirst_hw.h b/examples/part-04/ch16-accessing-hardware/stage4-final/myfirst_hw.h index 4dbf743..837fb5f 100644 --- a/examples/part-04/ch16-accessing-hardware/stage4-final/myfirst_hw.h +++ b/examples/part-04/ch16-accessing-hardware/stage4-final/myfirst_hw.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_hw.h -- Chapter 16 Stage 4 simulated hardware interface. * * Adds hardware-access layer to the Chapter 15 Stage 4 driver: diff --git a/examples/part-04/ch17-simulating-hardware/hwsim2-standalone/hwsim2.c b/examples/part-04/ch17-simulating-hardware/hwsim2-standalone/hwsim2.c index 0c0140e..faffc9e 100644 --- a/examples/part-04/ch17-simulating-hardware/hwsim2-standalone/hwsim2.c +++ b/examples/part-04/ch17-simulating-hardware/hwsim2-standalone/hwsim2.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * hwsim2.c -- Chapter 17 stand-alone simulation practice module. * * Demonstrates callout-driven hardware simulation without the myfirst diff --git a/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_hw.h b/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_hw.h index b90380f..2e287af 100644 --- a/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_hw.h +++ b/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_hw.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_hw.h -- Chapter 17 Stage 5 hardware interface. * * Extended from Chapter 16: diff --git a/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.c b/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.c index 47b472d..21e4761 100644 --- a/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.c +++ b/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sim.c -- Chapter 17 simulated hardware backend. * * Adds callouts that drive autonomous register changes, a diff --git a/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h b/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h index 90e157f..bfa29dc 100644 --- a/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h +++ b/examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sim.h -- Chapter 17 simulation API. * * The simulation layer turns the Chapter 16 static register block into diff --git a/examples/part-04/ch18-writing-pci-driver/stage1-probe/myfirst_pci.c b/examples/part-04/ch18-writing-pci-driver/stage1-probe/myfirst_pci.c index 4fc8980..af1ec42 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage1-probe/myfirst_pci.c +++ b/examples/part-04/ch18-writing-pci-driver/stage1-probe/myfirst_pci.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.c -- Chapter 18 Stage 1 PCI probe/attach/detach skeleton. * * Stage 1's job is to prove the probe-attach-detach dance against a diff --git a/examples/part-04/ch18-writing-pci-driver/stage1-probe/myfirst_pci.h b/examples/part-04/ch18-writing-pci-driver/stage1-probe/myfirst_pci.h index e354917..5b1819c 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage1-probe/myfirst_pci.h +++ b/examples/part-04/ch18-writing-pci-driver/stage1-probe/myfirst_pci.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.h -- Chapter 18 PCI interface for the myfirst driver. * * Stage 1: minimal probe/attach/detach. Declares the vendor/device diff --git a/examples/part-04/ch18-writing-pci-driver/stage2-bar/myfirst_pci.c b/examples/part-04/ch18-writing-pci-driver/stage2-bar/myfirst_pci.c index 4eef00e..62ad903 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage2-bar/myfirst_pci.c +++ b/examples/part-04/ch18-writing-pci-driver/stage2-bar/myfirst_pci.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.c -- Chapter 18 Stage 2 PCI driver. * * Stage 2 extends Stage 1 by claiming BAR 0 as a SYS_RES_MEMORY diff --git a/examples/part-04/ch18-writing-pci-driver/stage2-bar/myfirst_pci.h b/examples/part-04/ch18-writing-pci-driver/stage2-bar/myfirst_pci.h index b6566f4..580ce9d 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage2-bar/myfirst_pci.h +++ b/examples/part-04/ch18-writing-pci-driver/stage2-bar/myfirst_pci.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.h -- Chapter 18 PCI interface for the myfirst driver. * * Stage 2: adds BAR allocation via bus_alloc_resource_any(9). diff --git a/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_hw_pci.c b/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_hw_pci.c index e86fcc8..4a26a10 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_hw_pci.c +++ b/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_hw_pci.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_hw_pci.c -- Chapter 18 Stage 3 addition to the Chapter 16 * hardware layer. * diff --git a/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_pci.c b/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_pci.c index 2aeb6b5..4a74222 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_pci.c +++ b/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_pci.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.c -- Chapter 18 Stage 3 PCI driver. * * Stage 3 wires everything together. Attach allocates BAR 0, walks diff --git a/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_pci.h b/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_pci.h index 35f49e4..4d7b045 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_pci.h +++ b/examples/part-04/ch18-writing-pci-driver/stage3-integrated/myfirst_pci.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.h -- Chapter 18 PCI interface for the myfirst driver. * * Stage 3: hw layer bridged to the BAR, capability walk, cdev diff --git a/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_hw_pci.c b/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_hw_pci.c index 34a9cba..ad0b4d2 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_hw_pci.c +++ b/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_hw_pci.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_hw_pci.c -- Chapter 18 addition to the Chapter 16 * hardware layer. Provides myfirst_hw_attach_pci(), which binds an * existing struct resource * (allocated by myfirst_pci.c) to the diff --git a/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_pci.c b/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_pci.c index c25d694..f640d5a 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_pci.c +++ b/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_pci.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.c -- Chapter 18 final PCI attach layer. * * Registers the myfirst driver against the pci(4) bus. Probe matches diff --git a/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_pci.h b/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_pci.h index 9530c73..fda3416 100644 --- a/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_pci.h +++ b/examples/part-04/ch18-writing-pci-driver/stage4-final/myfirst_pci.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.h -- Chapter 18 PCI interface for the myfirst driver. * * Final stage. See PCI.md for the user-facing documentation. diff --git a/examples/part-04/ch19-handling-interrupts/stage4-final/myfirst_intr.c b/examples/part-04/ch19-handling-interrupts/stage4-final/myfirst_intr.c index f30a56c..b5e1d83 100644 --- a/examples/part-04/ch19-handling-interrupts/stage4-final/myfirst_intr.c +++ b/examples/part-04/ch19-handling-interrupts/stage4-final/myfirst_intr.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_intr.c -- Chapter 19 interrupt-handling layer. * * Implements: diff --git a/examples/part-04/ch19-handling-interrupts/stage4-final/myfirst_intr.h b/examples/part-04/ch19-handling-interrupts/stage4-final/myfirst_intr.h index f789a76..5b1a524 100644 --- a/examples/part-04/ch19-handling-interrupts/stage4-final/myfirst_intr.h +++ b/examples/part-04/ch19-handling-interrupts/stage4-final/myfirst_intr.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_intr.h -- Chapter 19 interrupt-handler interface. * * Exposes the three functions the PCI layer calls to bring up and diff --git a/examples/part-04/ch20-advanced-interrupts/stage4-final/myfirst_msix.c b/examples/part-04/ch20-advanced-interrupts/stage4-final/myfirst_msix.c index 81cd938..d568722 100644 --- a/examples/part-04/ch20-advanced-interrupts/stage4-final/myfirst_msix.c +++ b/examples/part-04/ch20-advanced-interrupts/stage4-final/myfirst_msix.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_msix.c -- Chapter 20 multi-vector interrupt layer. * * Implements the three-tier fallback ladder (MSI-X -> MSI -> legacy), diff --git a/examples/part-04/ch20-advanced-interrupts/stage4-final/myfirst_msix.h b/examples/part-04/ch20-advanced-interrupts/stage4-final/myfirst_msix.h index 9315184..b7caa90 100644 --- a/examples/part-04/ch20-advanced-interrupts/stage4-final/myfirst_msix.h +++ b/examples/part-04/ch20-advanced-interrupts/stage4-final/myfirst_msix.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_msix.h -- Chapter 20 multi-vector interrupt interface. * * Adds a three-tier fallback ladder (MSI-X, MSI, legacy INTx) to the diff --git a/examples/part-04/ch21-dma/stage1-alloc/myfirst_dma_snippet.c b/examples/part-04/ch21-dma/stage1-alloc/myfirst_dma_snippet.c index 9d83438..c673f0d 100644 --- a/examples/part-04/ch21-dma/stage1-alloc/myfirst_dma_snippet.c +++ b/examples/part-04/ch21-dma/stage1-alloc/myfirst_dma_snippet.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 1 snippet: DMA allocation and teardown. * * This file contains only the Chapter 21 Stage 1 additions to diff --git a/examples/part-04/ch21-dma/stage1-alloc/myfirst_softc_additions.h b/examples/part-04/ch21-dma/stage1-alloc/myfirst_softc_additions.h index c6e483c..c0a3c0e 100644 --- a/examples/part-04/ch21-dma/stage1-alloc/myfirst_softc_additions.h +++ b/examples/part-04/ch21-dma/stage1-alloc/myfirst_softc_additions.h @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 1: additions to myfirst.h. * * Append these declarations to myfirst.h after the Chapter 20 softc diff --git a/examples/part-04/ch21-dma/stage2-polling/myfirst_dma_stage2.c b/examples/part-04/ch21-dma/stage2-polling/myfirst_dma_stage2.c index b837353..3995e62 100644 --- a/examples/part-04/ch21-dma/stage2-polling/myfirst_dma_stage2.c +++ b/examples/part-04/ch21-dma/stage2-polling/myfirst_dma_stage2.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 2: DMA transfer helper (polling-based). * * This snippet shows the Stage 2 addition to myfirst.c. It assumes diff --git a/examples/part-04/ch21-dma/stage2-polling/myfirst_header_additions.h b/examples/part-04/ch21-dma/stage2-polling/myfirst_header_additions.h index 981dfe7..572af51 100644 --- a/examples/part-04/ch21-dma/stage2-polling/myfirst_header_additions.h +++ b/examples/part-04/ch21-dma/stage2-polling/myfirst_header_additions.h @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 2: header additions. * * Append to myfirst.h after the Chapter 20 register map. diff --git a/examples/part-04/ch21-dma/stage2-polling/myfirst_sim_dma_stage2.c b/examples/part-04/ch21-dma/stage2-polling/myfirst_sim_dma_stage2.c index 77ce3d4..8d89640 100644 --- a/examples/part-04/ch21-dma/stage2-polling/myfirst_sim_dma_stage2.c +++ b/examples/part-04/ch21-dma/stage2-polling/myfirst_sim_dma_stage2.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 2: simulated DMA engine. * * This snippet shows the Stage 2 additions to myfirst_sim.c. It diff --git a/examples/part-04/ch21-dma/stage3-interrupt/myfirst_dma_stage3.c b/examples/part-04/ch21-dma/stage3-interrupt/myfirst_dma_stage3.c index db4be52..6ef289a 100644 --- a/examples/part-04/ch21-dma/stage3-interrupt/myfirst_dma_stage3.c +++ b/examples/part-04/ch21-dma/stage3-interrupt/myfirst_dma_stage3.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 3: interrupt-driven DMA transfer helper. * * Replaces the Stage 2 polling helper with a condition-variable-based diff --git a/examples/part-04/ch21-dma/stage3-interrupt/myfirst_intr_additions.c b/examples/part-04/ch21-dma/stage3-interrupt/myfirst_intr_additions.c index ec2c380..aadb63b 100644 --- a/examples/part-04/ch21-dma/stage3-interrupt/myfirst_intr_additions.c +++ b/examples/part-04/ch21-dma/stage3-interrupt/myfirst_intr_additions.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 3: interrupt filter and task additions. * * Extends the Chapter 20 rx filter and task to handle diff --git a/examples/part-04/ch21-dma/stage4-final/myfirst_dma.c b/examples/part-04/ch21-dma/stage4-final/myfirst_dma.c index 7aa3d08..24cb9d5 100644 --- a/examples/part-04/ch21-dma/stage4-final/myfirst_dma.c +++ b/examples/part-04/ch21-dma/stage4-final/myfirst_dma.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 4: myfirst_dma.c * * Consolidated DMA subsystem for the myfirst driver. Moves the DMA diff --git a/examples/part-04/ch21-dma/stage4-final/myfirst_dma.h b/examples/part-04/ch21-dma/stage4-final/myfirst_dma.h index 57feab4..f3344f6 100644 --- a/examples/part-04/ch21-dma/stage4-final/myfirst_dma.h +++ b/examples/part-04/ch21-dma/stage4-final/myfirst_dma.h @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 21 Stage 4: public DMA API for the myfirst driver. * * The DMA subsystem manages a single 4 KB host-visible buffer that diff --git a/examples/part-04/ch22-power/stage1-skeleton/myfirst_header_additions.h b/examples/part-04/ch22-power/stage1-skeleton/myfirst_header_additions.h index 8bd7e41..757b62e 100644 --- a/examples/part-04/ch22-power/stage1-skeleton/myfirst_header_additions.h +++ b/examples/part-04/ch22-power/stage1-skeleton/myfirst_header_additions.h @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 22 Stage 1: header additions. * * Append these fields to struct myfirst_softc in myfirst.h. diff --git a/examples/part-04/ch22-power/stage1-skeleton/myfirst_pci_stage1.c b/examples/part-04/ch22-power/stage1-skeleton/myfirst_pci_stage1.c index 1809f6c..cec9a8e 100644 --- a/examples/part-04/ch22-power/stage1-skeleton/myfirst_pci_stage1.c +++ b/examples/part-04/ch22-power/stage1-skeleton/myfirst_pci_stage1.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 22 Stage 1: skeleton power-management methods for the * myfirst driver. * diff --git a/examples/part-04/ch22-power/stage2-quiesce/myfirst_header_additions.h b/examples/part-04/ch22-power/stage2-quiesce/myfirst_header_additions.h index 400bf23..a208efb 100644 --- a/examples/part-04/ch22-power/stage2-quiesce/myfirst_header_additions.h +++ b/examples/part-04/ch22-power/stage2-quiesce/myfirst_header_additions.h @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 22 Stage 2: header additions. * * Append these fields to struct myfirst_softc in myfirst.h. diff --git a/examples/part-04/ch22-power/stage2-quiesce/myfirst_pci_stage2.c b/examples/part-04/ch22-power/stage2-quiesce/myfirst_pci_stage2.c index 849c848..5801521 100644 --- a/examples/part-04/ch22-power/stage2-quiesce/myfirst_pci_stage2.c +++ b/examples/part-04/ch22-power/stage2-quiesce/myfirst_pci_stage2.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 22 Stage 2: quiesce helpers and rewritten suspend for * the myfirst driver. * diff --git a/examples/part-04/ch22-power/stage3-restore/myfirst_pci_stage3.c b/examples/part-04/ch22-power/stage3-restore/myfirst_pci_stage3.c index 21e3242..5244285 100644 --- a/examples/part-04/ch22-power/stage3-restore/myfirst_pci_stage3.c +++ b/examples/part-04/ch22-power/stage3-restore/myfirst_pci_stage3.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 22 Stage 3: restore helper and rewritten resume/shutdown * for the myfirst driver. * diff --git a/examples/part-04/ch22-power/stage4-final/myfirst_power.c b/examples/part-04/ch22-power/stage4-final/myfirst_power.c index 7ad1b82..da1d02e 100644 --- a/examples/part-04/ch22-power/stage4-final/myfirst_power.c +++ b/examples/part-04/ch22-power/stage4-final/myfirst_power.c @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 22 Stage 4: myfirst_power.c * * Consolidated power-management subsystem for the myfirst driver. diff --git a/examples/part-04/ch22-power/stage4-final/myfirst_power.h b/examples/part-04/ch22-power/stage4-final/myfirst_power.h index 24c284e..c7569d2 100644 --- a/examples/part-04/ch22-power/stage4-final/myfirst_power.h +++ b/examples/part-04/ch22-power/stage4-final/myfirst_power.h @@ -1,4 +1,8 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * + * SPDX-License-Identifier: BSD-2-Clause + * * Chapter 22 Stage 4: public power-management API for the * myfirst driver. * diff --git a/examples/part-07/ch36-reverse-engineering/exercise-your-own/skeleton-template.c b/examples/part-07/ch36-reverse-engineering/exercise-your-own/skeleton-template.c index c482891..bf67ce8 100644 --- a/examples/part-07/ch36-reverse-engineering/exercise-your-own/skeleton-template.c +++ b/examples/part-07/ch36-reverse-engineering/exercise-your-own/skeleton-template.c @@ -1,4 +1,6 @@ -/*- +/* + * Copyright (c) 2026 Edson Brandi + * * SPDX-License-Identifier: BSD-2-Clause * * skeleton-template.c diff --git a/examples/part-07/ch37-upstream/sample-driver/mydev.c b/examples/part-07/ch37-upstream/sample-driver/mydev.c index 98c6ec3..2bff8d2 100644 --- a/examples/part-07/ch37-upstream/sample-driver/mydev.c +++ b/examples/part-07/ch37-upstream/sample-driver/mydev.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: diff --git a/examples/part-07/ch37-upstream/sample-driver/mydev.h b/examples/part-07/ch37-upstream/sample-driver/mydev.h index 70a984a..f1f8cd6 100644 --- a/examples/part-07/ch37-upstream/sample-driver/mydev.h +++ b/examples/part-07/ch37-upstream/sample-driver/mydev.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: diff --git a/examples/part-07/ch37-upstream/sample-driver/mydevreg.h b/examples/part-07/ch37-upstream/sample-driver/mydevreg.h index d64fdb0..e8a5019 100644 --- a/examples/part-07/ch37-upstream/sample-driver/mydevreg.h +++ b/examples/part-07/ch37-upstream/sample-driver/mydevreg.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: diff --git a/examples/part-07/ch37-upstream/sample-manpage/mydev.4 b/examples/part-07/ch37-upstream/sample-manpage/mydev.4 index f6248b4..972e175 100644 --- a/examples/part-07/ch37-upstream/sample-manpage/mydev.4 +++ b/examples/part-07/ch37-upstream/sample-manpage/mydev.4 @@ -1,8 +1,8 @@ -.\"- -.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2026 Your Name .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Redistribution and use in source and binary forms, with or .\" without modification, are permitted provided that the .\" following conditions are met: diff --git a/examples/part-07/ch37-upstream/submission-checklist.md b/examples/part-07/ch37-upstream/submission-checklist.md index 44554f1..f4f2a70 100644 --- a/examples/part-07/ch37-upstream/submission-checklist.md +++ b/examples/part-07/ch37-upstream/submission-checklist.md @@ -23,15 +23,16 @@ every box with full confidence. ## Copyright Headers -- [ ] Every `.c` and `.h` file starts in column 1 with `/*-`. -- [ ] Every file has an `SPDX-License-Identifier:` line - immediately after the opening marker. +- [ ] Every `.c` and `.h` file starts in column 1 with `/*`. +- [ ] Every file has at least one `Copyright (c) YEAR Name` line + immediately after the opening. +- [ ] Every file has an `SPDX-License-Identifier:` line after the + copyright lines. - [ ] The SPDX code matches the licence text that follows. -- [ ] Every file has at least one `Copyright (c) YEAR Name` line. - [ ] The licence text matches one of the approved templates documented in Section 3 of Chapter 37. -- [ ] The manual page uses `.\"-` (with a dash) as its opening - marker, not `.\"`. +- [ ] The manual page uses `.\"` comment lines for its header, + with the same copyright-then-SPDX order. ## Code Style diff --git a/examples/part-07/ch38-final-thoughts/template-driver/share/man/man4/mydrv.4 b/examples/part-07/ch38-final-thoughts/template-driver/share/man/man4/mydrv.4 index c4997fc..e20d89e 100644 --- a/examples/part-07/ch38-final-thoughts/template-driver/share/man/man4/mydrv.4 +++ b/examples/part-07/ch38-final-thoughts/template-driver/share/man/man4/mydrv.4 @@ -1,8 +1,8 @@ -.\"- -.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2026 Your Name .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Redistribution and use in source and binary forms, with or .\" without modification, are permitted provided that the .\" following conditions are met: diff --git a/examples/part-07/ch38-final-thoughts/template-driver/sys/dev/mydrv/mydrv.c b/examples/part-07/ch38-final-thoughts/template-driver/sys/dev/mydrv/mydrv.c index 8396231..58c456c 100644 --- a/examples/part-07/ch38-final-thoughts/template-driver/sys/dev/mydrv/mydrv.c +++ b/examples/part-07/ch38-final-thoughts/template-driver/sys/dev/mydrv/mydrv.c @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: diff --git a/examples/part-07/ch38-final-thoughts/template-driver/sys/dev/mydrv/mydrv.h b/examples/part-07/ch38-final-thoughts/template-driver/sys/dev/mydrv/mydrv.h index 083b3e2..bc9ffea 100644 --- a/examples/part-07/ch38-final-thoughts/template-driver/sys/dev/mydrv/mydrv.h +++ b/examples/part-07/ch38-final-thoughts/template-driver/sys/dev/mydrv/mydrv.h @@ -1,8 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: diff --git a/translations/es_ES/chapters/part2/chapter-07.md b/translations/es_ES/chapters/part2/chapter-07.md index dea8030..81e12f0 100644 --- a/translations/es_ES/chapters/part2/chapter-07.md +++ b/translations/es_ES/chapters/part2/chapter-07.md @@ -238,10 +238,10 @@ Ahora crea `myfirst.c`, el código fuente real del driver. Esta primera versión Aquí está el esqueleto: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. */ diff --git a/translations/es_ES/chapters/part3/chapter-15.md b/translations/es_ES/chapters/part3/chapter-15.md index 77e3e52..87b0aff 100644 --- a/translations/es_ES/chapters/part3/chapter-15.md +++ b/translations/es_ES/chapters/part3/chapter-15.md @@ -3610,11 +3610,11 @@ El driver `myfirst` al final del Capítulo 15 usa todas las primitivas que intro El código fuente complementario en `examples/part-03/ch15-more-synchronization/stage4-final/` incluye el `myfirst_sync.h` completo. Como referencia, aquí tienes una versión completa que puede utilizarse como plantilla. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sync.h: the named synchronisation vocabulary of the * myfirst driver. * diff --git a/translations/es_ES/chapters/part4/chapter-17.md b/translations/es_ES/chapters/part4/chapter-17.md index ba1b462..1aca757 100644 --- a/translations/es_ES/chapters/part4/chapter-17.md +++ b/translations/es_ES/chapters/part4/chapter-17.md @@ -495,7 +495,7 @@ La distribución de archivos del capítulo 16 era `myfirst.c` para el ciclo de v Crea `myfirst_sim.c` junto a los archivos del capítulo 16. La primera versión es pequeña: ```c -/*- +/* * myfirst_sim.c -- Chapter 17 simulated hardware backend. * * Adds a callout that drives autonomous register changes, a @@ -3869,11 +3869,11 @@ Si quieres profundizar en los temas que tocó el capítulo 17, los siguientes so El `myfirst_sim.h` completo tal como queda al final del capítulo 17, para consulta rápida. El código fuente también está disponible en `examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h`. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sim.h -- Chapter 17 simulation API. * * The simulation layer turns the Chapter 16 static register block into diff --git a/translations/es_ES/chapters/part4/chapter-18.md b/translations/es_ES/chapters/part4/chapter-18.md index 89ac396..3fb006b 100644 --- a/translations/es_ES/chapters/part4/chapter-18.md +++ b/translations/es_ES/chapters/part4/chapter-18.md @@ -501,11 +501,11 @@ Los valores de prioridad son negativos por convención, de modo que gana el valo Reuniendo todo lo anterior, aquí está el driver de la Etapa 1 del Capítulo 18, presentado como un único archivo autocontenido que surge del esqueleto del Capítulo 17. El archivo se llama `myfirst_pci.c`; es nuevo en el Capítulo 18 y convive con los archivos existentes `myfirst.c`, `myfirst_hw.c` y `myfirst_sim.c`. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.c -- Chapter 18 Stage 1 PCI probe/attach skeleton. * * At this stage the driver only probes, attaches, and detaches. @@ -597,11 +597,11 @@ MODULE_VERSION(myfirst, 1); El archivo de cabecera complementario, `myfirst_pci.h`: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.h -- Chapter 18 PCI interface for the myfirst driver. */ @@ -2643,11 +2643,11 @@ Leer este archivo después de escribir el driver del Capítulo 18 es un breve ej ### La parte superior del archivo ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2006 Marcel Moolenaar All rights reserved. * Copyright (c) 2001 M. Warner Losh + * + * SPDX-License-Identifier: BSD-2-Clause ... */ diff --git a/translations/es_ES/chapters/part7/chapter-37.md b/translations/es_ES/chapters/part7/chapter-37.md index ca46976..dfc8d56 100644 --- a/translations/es_ES/chapters/part7/chapter-37.md +++ b/translations/es_ES/chapters/part7/chapter-37.md @@ -217,11 +217,11 @@ Un archivo de driver bien organizado tiene un ritmo visible que los lectores con A modo de orientación, aquí tienes la estructura mínima de `mydev.c`. No está completo, pero muestra los elementos estructurales que un revisor esperará ver. Ya has visto el funcionamiento de cada una de estas macros en capítulos anteriores; aquí nos centramos en cómo se organizan en la página. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: @@ -306,7 +306,7 @@ MODULE_VERSION(mydev, 1); MODULE_DEPEND(mydev, pci, 1, 1, 1); ``` -Hay varios aspectos que merece la pena destacar. La cabecera de copyright usa el marcador de apertura `/*-`, que el script automático de recopilación de licencias reconoce. La línea SPDX nombra la licencia explícitamente. La indentación usa tabuladores, no espacios, como exige `style(9)`. Las declaraciones de función están separadas con tabuladores, también según `style(9)`. Las macros `DRIVER_MODULE` y relacionadas aparecen al final, en el orden que espera el sistema de build. Esta es la estructura que un revisor esperará encontrar. +Hay varios aspectos que merece la pena destacar. La cabecera de copyright abre con un comentario `/*` normal, declara primero el copyright y después nombra la licencia explícitamente con la línea SPDX. La indentación usa tabuladores, no espacios, como exige `style(9)`. Las declaraciones de función están separadas con tabuladores, también según `style(9)`. Las macros `DRIVER_MODULE` y relacionadas aparecen al final, en el orden que espera el sistema de build. Esta es la estructura que un revisor esperará encontrar. ### El Makefile del módulo @@ -365,7 +365,7 @@ La indentación usa tabuladores reales, con una tabulación de 8 columnas. Los n #### Forma de la cabecera de copyright -La cabecera de copyright usa el marcador de apertura `/*-`. Este marcador es especial. Una herramienta automatizada recopila licencias del árbol buscando comentarios multilínea que comiencen en la columna 1 con `/*-`. Usar el marcador identifica el bloque como una licencia; usar un `/*` convencional no lo hace. Inmediatamente después de `/*-`, la siguiente línea significativa debe ser `SPDX-License-Identifier:` seguida del código de licencia SPDX, como `BSD-2-Clause`. A continuación vienen una o más líneas de `Copyright`. Después, el texto de la licencia. +La cabecera de copyright es un comentario multilínea que comienza en la columna 1 con un `/*` normal. Los archivos más antiguos abren con `/*-`, un marcador del que dependía en su día una herramienta de recopilación de licencias; `style(9)` ya no pide el guion en el código nuevo. Las primeras líneas significativas son una o más líneas de `Copyright`. Después de las líneas de copyright viene `SPDX-License-Identifier:` seguido del código de licencia SPDX, como `BSD-2-Clause`. Después, opcionalmente, el texto de la licencia. #### Declaraciones y definiciones de funciones @@ -646,10 +646,10 @@ como una rápida comprobación propia antes de pasar a la sección 3. - Nombres de archivo que no coinciden con el driver. Si el driver es `mydev`, el archivo fuente principal es `mydev.c`, no `main.c` ni `driver.c`. -- Cabecera de copyright ausente o incorrecta. La cabecera usa `/*-` - como marcador de apertura, el identificador SPDX va primero, y el - texto de licencia corresponde a una de las licencias aceptadas por - el proyecto. +- Cabecera de copyright ausente o incorrecta. La cabecera abre con + `/*`, las líneas de copyright van primero, el identificador SPDX + las sigue, y el texto de licencia corresponde a una de las + licencias aceptadas por el proyecto. - Espacios en lugar de tabulaciones. `style(9)` es explícito respecto a las tabulaciones, y el verificador de estilo marcará la indentación con espacios de inmediato. @@ -771,11 +771,11 @@ Si estás portando o adaptando código de otro proyecto de código abierto, revi La cabecera de copyright que aparece al principio de cada archivo fuente del árbol tiene una estructura específica, documentada en `style(9)`. Vamos a recorrer una cabecera completa y examinar cada una de sus partes. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: @@ -802,9 +802,9 @@ La cabecera de copyright que aparece al principio de cada archivo fuente del ár */ ``` -La apertura `/*-` no es una errata. El guion tras el asterisco es significativo. Un script automatizado del árbol recopila información de licencias de los archivos buscando comentarios multilínea que empiecen en la columna 1 con la secuencia `/*-`. Usar `/*-` marca el bloque como licencia; usar simplemente `/*` no lo hace. `style(9)` es explícito al respecto: si quieres que el recolector de licencias del árbol capture correctamente tu licencia, usa `/*-` en la línea de apertura. +La apertura es un `/*` normal en la columna 1. Todavía verás `/*-` al principio de muchos archivos del árbol: el guion era un marcador para un script automatizado de recopilación de licencias, y durante años `style(9)` lo exigió. El `style(9)` actual ha eliminado ese requisito, así que el código nuevo abre la cabecera con `/*` y se apoya en la línea SPDX para identificar la licencia. -Inmediatamente después de la apertura aparece la línea SPDX-License-Identifier. SPDX es un vocabulario estandarizado para describir licencias en forma legible por máquinas. Esta línea indica al recolector bajo qué licencia está el archivo, y lo hace de una forma que no puede interpretarse erróneamente. Usa `BSD-2-Clause` para una licencia BSD de dos cláusulas y `BSD-3-Clause` para una de tres cláusulas. Para otras licencias, consulta la lista de identificadores SPDX en `https://spdx.org/licenses/`. No inventes identificadores. +Inmediatamente después de la apertura vienen las líneas de copyright, y a continuación la línea SPDX-License-Identifier. SPDX es un vocabulario estandarizado para describir licencias en forma legible por máquinas. Esta línea indica bajo qué licencia está el archivo, y lo hace de una forma que no puede interpretarse erróneamente. Usa `BSD-2-Clause` para una licencia BSD de dos cláusulas y `BSD-3-Clause` para una de tres cláusulas. Para otras licencias, consulta la lista de identificadores SPDX en `https://spdx.org/licenses/`. No inventes identificadores. Fíjate en el orden: `style(9)` indica que las líneas de copyright se escriben antes del identificador SPDX. Los archivos más antiguos lo tienen al revés; el código nuevo no debe hacerlo. La línea de copyright indica el año y el titular de los derechos de autor. Usa tu nombre legal completo, o el nombre de tu empleador si estás contribuyendo trabajo realizado en el marco de una relación laboral, seguido de una dirección de correo electrónico lo suficientemente estable como para que puedan localizarte años después. Si contribuyes como particular, usa tu correo personal en lugar de una dirección temporal. @@ -834,12 +834,12 @@ Cualquier código que copies o adaptes de otro proyecto lleva consigo la licenci La convención del árbol para las obras derivadas es conservar la línea de copyright original y añadir la tuya como una línea separada: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 1998 Original Author * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * [licence text] */ ``` @@ -874,24 +874,24 @@ Si eres empleado de una empresa y contribuyes trabajo realizado en el marco de e Si estás adaptando un driver que ya has escrito pero que nunca preparaste para su envío, tendrás que añadir la cabecera adecuada a cada archivo. Los pasos son: 1. Decide la licencia. Para un nuevo driver, usa BSD-2-Clause. -2. Escribe la línea del identificador SPDX. -3. Escribe la línea de copyright con tu nombre, correo electrónico y el año de la primera creación. +2. Escribe la línea de copyright con tu nombre, correo electrónico y el año de la primera creación. +3. Escribe la línea del identificador SPDX después de la línea de copyright. 4. Pega el texto estándar de la licencia BSD-2-Clause. -5. Verifica que la apertura sea `/*-` y que el archivo empiece en la columna 1. +5. Verifica que la apertura sea `/*` y que el archivo empiece en la columna 1. 6. Verifica que haya una sola línea en blanco después del cierre `*/`. -7. Repite el proceso para cada archivo: los archivos `.c`, los archivos `.h`, la página de manual (donde la licencia aparece como comentarios estilo `.\" -` en lugar del estilo `/*-`) y cualquier otro archivo que contenga contenido sustancial. +7. Repite el proceso para cada archivo: los archivos `.c`, los archivos `.h`, la página de manual (donde la licencia aparece como comentarios estilo `.\"` en lugar del estilo `/*`) y cualquier otro archivo que contenga contenido sustancial. En el caso del Makefile, como se indicó anteriormente, la cabecera de licencia se omite convencionalmente en los archivos triviales. El Makefile del módulo que se mostró en la sección 2 es suficientemente trivial como para que no sea necesaria ninguna cabecera. ### Validar la cabecera -No existe una única herramienta automatizada que valide todos los aspectos de una cabecera de copyright de FreeBSD. El script `checkstyle9.pl` detecta algunos tipos de errores de formato relacionados con la cabecera. El recolector de licencias del árbol trabaja con el marcador `/*-` y la línea SPDX. La validación más fiable, sin embargo, consiste en comparar tu cabecera directamente con una cabecera de referencia conocida de un commit reciente del árbol, como la cabecera de `/usr/src/sys/dev/null/null.c` o la de cualquier driver añadido recientemente. +No existe una única herramienta automatizada que valide todos los aspectos de una cabecera de copyright de FreeBSD. El script `checkstyle9.pl` detecta algunos tipos de errores de formato relacionados con la cabecera. Las herramientas de licencias del árbol trabajan sobre la línea SPDX. La validación más fiable, sin embargo, consiste en comparar tu cabecera directamente con una cabecera de referencia conocida de un commit reciente del árbol, como la cabecera de `/usr/src/sys/dev/null/null.c` o la de cualquier driver añadido recientemente. Adquiere un pequeño hábito: cuando abras un nuevo archivo fuente, pega una cabecera conocida y correcta como primera acción. Esto evita el error fácil de olvidar la cabecera por completo y garantiza además que la estructura sea correcta desde el principio. ### Cerrando la sección 3 -La gestión de licencias es uno de los aspectos en los que hacerlo bien desde el principio ahorra una cantidad enorme de tiempo. El proyecto FreeBSD acepta BSD-2-Clause, BSD-3-Clause y algunas otras licencias permisivas para archivos históricos. Las nuevas contribuciones deben usar BSD-2-Clause por defecto. La cabecera de copyright tiene una forma específica: abre con `/*-`, seguida de un identificador SPDX, seguida de una o más líneas de copyright, seguida del texto estándar de la licencia. El código derivado de otros proyectos mantiene sus obligaciones de licencia originales, y las obras derivadas deben conservar las atribuciones originales. El código que no has escrito tú requiere el permiso y la atribución del autor. +La gestión de licencias es uno de los aspectos en los que hacerlo bien desde el principio ahorra una cantidad enorme de tiempo. El proyecto FreeBSD acepta BSD-2-Clause, BSD-3-Clause y algunas otras licencias permisivas para archivos históricos. Las nuevas contribuciones deben usar BSD-2-Clause por defecto. La cabecera de copyright tiene una forma específica: abre con `/*`, seguida de una o más líneas de copyright, seguidas de un identificador SPDX, seguido del texto estándar de la licencia. El código derivado de otros proyectos mantiene sus obligaciones de licencia originales, y las obras derivadas deben conservar las atribuciones originales. El código que no has escrito tú requiere el permiso y la atribución del autor. Con el aspecto legal resuelto, podemos pasar a la página de manual. Cada driver del árbol se acompaña de una página de manual, y escribir una buena es uno de los puntos donde los colaboradores por primera vez subestiman con más frecuencia el esfuerzo necesario. La sección 4 recorre las convenciones y proporciona una plantilla que puedes adaptar. @@ -947,11 +947,11 @@ No todas las secciones son obligatorias para todos los drivers. Para un driver s A continuación se muestra una página de manual de la sección 4 completa y funcional para un driver hipotético llamado `mydev`. Guárdala como `mydev.4`, ejecútala con `mandoc -Tlint` y verás que pasa sin errores. Este es el tipo de página de manual que puedes adaptar a tu propio driver. ```text -.\"- -.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2026 Your Name .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Redistribution and use in source and binary forms, with or .\" without modification, are permitted provided that the .\" following conditions are met: @@ -1051,7 +1051,7 @@ Repasemos las partes que con más frecuencia se malinterpretan. El bloque de cabecera al principio es un conjunto de líneas de comentario que comienzan con `.\"`. Son comentarios de mdoc. No aparecen en la salida de la página de manual. Su propósito es contener la cabecera de copyright y cualquier nota para futuros editores. -El marcador de apertura es `.\"-` con un guion, equivalente al `/*-` de los archivos C. La herramienta de recopilación de licencias lo reconoce. +La línea de apertura es un `.\"` normal, equivalente a la apertura `/*` de los archivos C. Igual que en los archivos C, la línea de copyright va primero y el identificador SPDX la sigue. La macro `.Dd` establece la fecha del documento. Se formatea como mes, día y año con el nombre completo del mes. El estilo mdoc del proyecto dicta actualizar `.Dd` siempre que el contenido de la página de manual cambie de forma significativa. No actualices la fecha por cambios triviales como correcciones de espacios en blanco, pero sí hazlo ante cualquier cambio semántico. @@ -2257,14 +2257,14 @@ Pasos: archivo `.c`, cada archivo `.h` y la página de manual. 2. Para cada archivo, comprueba la cabecera existente. Si falta o está mal formada, reemplázala por una plantilla correcta conocida. -3. Usa `/*-` como apertura de la cabecera en los archivos `.c` y `.h`. - Usa `.\"-` como apertura en la página de manual. -4. Incluye la línea `SPDX-License-Identifier` con la licencia apropiada, - normalmente `BSD-2-Clause`. -5. Añade tu nombre y dirección de correo electrónico en la línea de Copyright. +3. Usa `/*` como apertura de la cabecera en los archivos `.c` y `.h`. + Usa `.\"` como apertura en la página de manual. +4. Añade tu nombre y dirección de correo electrónico en la línea de Copyright. +5. Incluye la línea `SPDX-License-Identifier` con la licencia apropiada, + normalmente `BSD-2-Clause`, después de la línea de Copyright. 6. Incluye el texto de licencia estándar. -7. Verifica que el archivo comienza en la columna 1 con la apertura `/*-` o - `.\"-`. +7. Verifica que el archivo comienza en la columna 1 con la apertura `/*` o + `.\"`. Criterio de éxito: todos los archivos tienen una cabecera correctamente formateada que se ajusta a las convenciones de los archivos ya presentes en el árbol. diff --git a/translations/pt_BR/chapters/part2/chapter-07.md b/translations/pt_BR/chapters/part2/chapter-07.md index 811eb82..895ac58 100644 --- a/translations/pt_BR/chapters/part2/chapter-07.md +++ b/translations/pt_BR/chapters/part2/chapter-07.md @@ -238,10 +238,10 @@ Agora crie `myfirst.c`, o código-fonte real do driver. Esta primeira versão é Aqui está o esqueleto: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. */ diff --git a/translations/pt_BR/chapters/part3/chapter-15.md b/translations/pt_BR/chapters/part3/chapter-15.md index 8ebb285..e37ef91 100644 --- a/translations/pt_BR/chapters/part3/chapter-15.md +++ b/translations/pt_BR/chapters/part3/chapter-15.md @@ -3625,11 +3625,11 @@ O driver `myfirst` no final do Capítulo 15 usa todos os primitivos introduzidos O código-fonte companion disponível em `examples/part-03/ch15-more-synchronization/stage4-final/` inclui o `myfirst_sync.h` completo. Para referência, segue uma versão integral que pode ser usada como template. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sync.h: the named synchronisation vocabulary of the * myfirst driver. * diff --git a/translations/pt_BR/chapters/part4/chapter-17.md b/translations/pt_BR/chapters/part4/chapter-17.md index e0f473d..4052407 100644 --- a/translations/pt_BR/chapters/part4/chapter-17.md +++ b/translations/pt_BR/chapters/part4/chapter-17.md @@ -495,7 +495,7 @@ O layout de arquivos do Capítulo 16 era `myfirst.c` para o ciclo de vida do dri Crie `myfirst_sim.c` ao lado dos arquivos do Capítulo 16. A primeira versão é pequena: ```c -/*- +/* * myfirst_sim.c -- Chapter 17 simulated hardware backend. * * Adds a callout that drives autonomous register changes, a @@ -3871,11 +3871,11 @@ Se você quiser aprofundar nos temas abordados pelo Capítulo 17, os recursos a O `myfirst_sim.h` completo no estado em que se encontra ao final do Capítulo 17, para consulta rápida. O código-fonte também está disponível em `examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h`. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sim.h -- Chapter 17 simulation API. * * The simulation layer turns the Chapter 16 static register block into diff --git a/translations/pt_BR/chapters/part4/chapter-18.md b/translations/pt_BR/chapters/part4/chapter-18.md index 63d18ba..0de9041 100644 --- a/translations/pt_BR/chapters/part4/chapter-18.md +++ b/translations/pt_BR/chapters/part4/chapter-18.md @@ -501,11 +501,11 @@ Os valores de prioridade são negativos por convenção, de modo que o valor num Juntando tudo, aqui está o driver do Estágio 1 do Capítulo 18, apresentado como um único arquivo autocontido que evolui a partir do esqueleto do Capítulo 17. O nome do arquivo é `myfirst_pci.c`; ele é novo no Capítulo 18 e fica ao lado dos arquivos existentes `myfirst.c`, `myfirst_hw.c` e `myfirst_sim.c`. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.c -- Chapter 18 Stage 1 PCI probe/attach skeleton. * * At this stage the driver only probes, attaches, and detaches. @@ -597,11 +597,11 @@ MODULE_VERSION(myfirst, 1); O header complementar, `myfirst_pci.h`: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.h -- Chapter 18 PCI interface for the myfirst driver. */ @@ -2643,11 +2643,11 @@ Ler esse arquivo depois de escrever o driver do Capítulo 18 é um exercício cu ### O Topo do Arquivo ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2006 Marcel Moolenaar All rights reserved. * Copyright (c) 2001 M. Warner Losh + * + * SPDX-License-Identifier: BSD-2-Clause ... */ diff --git a/translations/pt_BR/chapters/part7/chapter-37.md b/translations/pt_BR/chapters/part7/chapter-37.md index 06a4abd..c44c6a1 100644 --- a/translations/pt_BR/chapters/part7/chapter-37.md +++ b/translations/pt_BR/chapters/part7/chapter-37.md @@ -292,11 +292,11 @@ encontrar. Você já viu a mecânica de cada um desses macros em capítulos anteriores; aqui estamos focando em como eles se organizam na página. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: @@ -381,9 +381,9 @@ MODULE_VERSION(mydev, 1); MODULE_DEPEND(mydev, pci, 1, 1, 1); ``` -Vale notar algumas coisas. O cabeçalho de copyright usa o marcador de -abertura `/*-`, que o script de coleta automática de licenças reconhece. -A linha SPDX nomeia a licença explicitamente. A indentação usa tabs, não +Vale notar algumas coisas. O cabeçalho de copyright abre com um comentário +`/*` simples, declara primeiro o copyright e, em seguida, nomeia a licença +explicitamente com a linha SPDX. A indentação usa tabs, não espaços, conforme exigido pelo `style(9)`. As declarações de funções são separadas por tabs, também conforme o `style(9)`. Os macros `DRIVER_MODULE` e relacionados aparecem no final, na ordem que o sistema de build espera. @@ -483,14 +483,13 @@ mensagem de panic. #### Formato do Cabeçalho de Copyright -O cabeçalho de copyright usa o marcador de abertura `/*-`. Esse marcador -é especial. Uma ferramenta automatizada coleta licenças da árvore procurando -comentários de múltiplas linhas que começam na coluna 1 com `/*-`. Usar esse -marcador sinaliza o bloco como uma licença; usar um `/*` comum não faz isso. -Imediatamente após `/*-`, a próxima linha significativa deve ser -`SPDX-License-Identifier:` seguido do código de licença SPDX, como -`BSD-2-Clause`. Depois vêm uma ou mais linhas de `Copyright`. Em seguida, -o texto da licença. +O cabeçalho de copyright é um comentário de múltiplas linhas que começa na +coluna 1 com um `/*` simples. Arquivos mais antigos abrem com `/*-`, um +marcador do qual uma ferramenta de coleta de licenças dependia no passado; +o `style(9)` não exige mais o traço em código novo. As primeiras linhas +significativas são uma ou mais linhas de `Copyright`. Depois das linhas de +copyright vem `SPDX-License-Identifier:` seguido do código de licença SPDX, +como `BSD-2-Clause`. Em seguida, opcionalmente, o texto da licença. #### Declarações e Definições de Funções @@ -779,9 +778,10 @@ autoavaliação rápida antes de avançar para a Seção 3. - Nomes de arquivos que não correspondem ao driver. Se o driver se chama `mydev`, o arquivo de código-fonte principal é `mydev.c`, não `main.c` ou `driver.c`. -- Cabeçalho de copyright ausente ou incorreto. O cabeçalho usa `/*-` como - marcador de abertura, o identificador SPDX vem primeiro, e o texto da - licença corresponde a uma das licenças aceitas pelo projeto. +- Cabeçalho de copyright ausente ou incorreto. O cabeçalho abre com `/*`, + as linhas de copyright vêm primeiro, o identificador SPDX vem depois + delas, e o texto da licença corresponde a uma das licenças aceitas pelo + projeto. - Espaços em vez de tabs. O `style(9)` é explícito sobre tabs, e o verificador de estilo vai sinalizar a indentação com espaços imediatamente. - Parênteses ausentes em expressões `return`. Um pequeno erro recorrente @@ -897,11 +897,11 @@ Se você estiver portando ou adaptando código de outro projeto de código abert O cabeçalho de copyright no topo de cada arquivo de código-fonte na árvore tem uma estrutura específica, documentada em `style(9)`. Vamos percorrer um cabeçalho completo e examinar cada parte. ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: @@ -928,9 +928,9 @@ O cabeçalho de copyright no topo de cada arquivo de código-fonte na árvore te */ ``` -O `/*-` de abertura não é um erro de digitação. O traço após o asterisco é significativo. Um script automatizado na árvore coleta informações de licença dos arquivos procurando por comentários de múltiplas linhas que começam na coluna 1 com a sequência `/*-`. Usar `/*-` marca o bloco como uma licença; usar simplesmente `/*` não faz isso. O `style(9)` é explícito: se você quiser que o coletor de licenças da árvore identifique sua licença corretamente, use `/*-` na linha de abertura. +A abertura é um `/*` simples na coluna 1. Você ainda verá `/*-` no topo de muitos arquivos da árvore: o traço era um marcador para um script automatizado de coleta de licenças, e por anos o `style(9)` o exigiu. O `style(9)` atual abandonou essa exigência, então código novo abre o cabeçalho com `/*` e conta com a linha SPDX para identificar a licença. -Imediatamente após a abertura está a linha SPDX-License-Identifier. SPDX é um vocabulário padronizado para descrever licenças de forma legível por máquinas. Essa linha informa ao coletor sob qual licença o arquivo está, de uma forma que não pode ser mal interpretada. Use `BSD-2-Clause` para uma licença BSD de duas cláusulas, `BSD-3-Clause` para uma licença BSD de três cláusulas. Para outras licenças, consulte a lista de identificadores SPDX em `https://spdx.org/licenses/`. Não invente identificadores. +Imediatamente após a abertura vêm as linhas de copyright e, em seguida, a linha SPDX-License-Identifier. SPDX é um vocabulário padronizado para descrever licenças de forma legível por máquinas. Essa linha declara sob qual licença o arquivo está, de uma forma que não pode ser mal interpretada. Use `BSD-2-Clause` para uma licença BSD de duas cláusulas, `BSD-3-Clause` para uma licença BSD de três cláusulas. Para outras licenças, consulte a lista de identificadores SPDX em `https://spdx.org/licenses/`. Não invente identificadores. Note a ordem: o `style(9)` manda escrever as linhas de copyright antes do identificador SPDX. Arquivos mais antigos têm a ordem inversa; código novo não deve tê-la. A linha de copyright indica o ano e o titular dos direitos. Use seu nome legal completo, ou o nome do seu empregador caso você esteja contribuindo com trabalho realizado no âmbito de um emprego, seguido de um endereço de e-mail estável o suficiente para que possam entrar em contato com você anos mais tarde. Se você estiver contribuindo como pessoa física, use seu e-mail pessoal em vez de um endereço temporário. @@ -960,12 +960,12 @@ Qualquer código que você copie ou adapte de outro projeto carrega consigo a li A convenção na árvore para trabalhos derivados é preservar a linha de copyright original e adicionar a sua como uma linha separada: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 1998 Original Author * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * [licence text] */ ``` @@ -1000,24 +1000,24 @@ Se você é funcionário de uma empresa e está contribuindo com trabalho realiz Se você está adaptando um driver que já escreveu, mas nunca preparou para envio, precisará adicionar o cabeçalho adequado a cada arquivo. Os passos são: 1. Decida a licença. Para um driver novo, use BSD-2-Clause. -2. Escreva a linha do identificador SPDX. -3. Escreva a linha de copyright com seu nome, e-mail e o ano de criação inicial. +2. Escreva a linha de copyright com seu nome, e-mail e o ano de criação inicial. +3. Escreva a linha do identificador SPDX depois da linha de copyright. 4. Cole o texto padrão da licença BSD-2-Clause. -5. Verifique se a abertura é `/*-` e se o arquivo começa na coluna 1. +5. Verifique se a abertura é `/*` e se o arquivo começa na coluna 1. 6. Verifique se há uma única linha em branco após o `*/` de fechamento. -7. Repita para cada arquivo: os arquivos `.c`, os arquivos `.h`, a página de manual (onde a licença aparece como comentários no estilo `.\" -` em vez de comentários no estilo `/*-`), e quaisquer outros arquivos que contenham conteúdo substancial. +7. Repita para cada arquivo: os arquivos `.c`, os arquivos `.h`, a página de manual (onde a licença aparece como comentários no estilo `.\"` em vez de comentários no estilo `/*`), e quaisquer outros arquivos que contenham conteúdo substancial. Para o Makefile, como mencionado anteriormente, um cabeçalho de licença é convencionalmente omitido para arquivos triviais. O Makefile do módulo apresentado na Seção 2 é simples o suficiente para que nenhum cabeçalho seja necessário. ### Validando o Cabeçalho -Não existe uma única ferramenta automatizada que valide todos os aspectos de um cabeçalho de copyright do FreeBSD. O script `checkstyle9.pl` detecta alguns tipos de erros de formatação próximos ao cabeçalho. O coletor de licenças da árvore trabalha com o marcador `/*-` e a linha SPDX. A validação mais confiável, no entanto, é comparar seu cabeçalho diretamente com um cabeçalho conhecido e correto de um commit recente na árvore, como o cabeçalho em `/usr/src/sys/dev/null/null.c` ou em qualquer driver adicionado recentemente. +Não existe uma única ferramenta automatizada que valide todos os aspectos de um cabeçalho de copyright do FreeBSD. O script `checkstyle9.pl` detecta alguns tipos de erros de formatação próximos ao cabeçalho. O ferramental de licenças da árvore trabalha com a linha SPDX. A validação mais confiável, no entanto, é comparar seu cabeçalho diretamente com um cabeçalho conhecido e correto de um commit recente na árvore, como o cabeçalho em `/usr/src/sys/dev/null/null.c` ou em qualquer driver adicionado recentemente. Crie um pequeno hábito: quando você abrir um novo arquivo de código-fonte, cole um cabeçalho conhecido e correto como primeira ação. Isso evita o erro fácil de esquecer o cabeçalho completamente e também garante que o formato esteja certo desde o início. ### Encerrando a Seção 3 -O licenciamento é um dos pontos em que acertar desde o início economiza uma quantidade enorme de tempo. O FreeBSD Project aceita BSD-2-Clause, BSD-3-Clause e algumas outras licenças permissivas para arquivos históricos. Novas contribuições devem usar BSD-2-Clause como padrão. O cabeçalho de copyright usa uma forma específica, abrindo com `/*-`, seguido de um identificador SPDX, seguido de uma ou mais linhas de copyright, seguido pelo texto padrão da licença. Código derivado de outros projetos carrega suas obrigações de licença originais para frente, e trabalhos derivados devem preservar as atribuições originais. Código que você mesmo não escreveu requer a permissão e a atribuição do autor. +O licenciamento é um dos pontos em que acertar desde o início economiza uma quantidade enorme de tempo. O FreeBSD Project aceita BSD-2-Clause, BSD-3-Clause e algumas outras licenças permissivas para arquivos históricos. Novas contribuições devem usar BSD-2-Clause como padrão. O cabeçalho de copyright usa uma forma específica, abrindo com `/*`, seguido de uma ou mais linhas de copyright, seguido de um identificador SPDX, seguido pelo texto padrão da licença. Código derivado de outros projetos carrega suas obrigações de licença originais para frente, e trabalhos derivados devem preservar as atribuições originais. Código que você mesmo não escreveu requer a permissão e a atribuição do autor. Com a parte legal resolvida, podemos nos voltar para a página de manual. Todo driver na árvore é acompanhado de uma página de manual, e escrever uma boa página é um dos pontos em que contribuidores de primeira viagem mais frequentemente subestimam o esforço necessário. A Seção 4 percorre as convenções e fornece um modelo que você pode adaptar. @@ -1073,11 +1073,11 @@ Nem toda seção é necessária para todo driver. Para um driver simples, `NAME` A seguir, uma página de manual completa e funcional da seção 4 para um driver hipotético `mydev`. Salve-a como `mydev.4`, execute `mandoc -Tlint` sobre ela e você verá que ela passa sem erros. Este é o tipo de página de manual que você pode adaptar para o seu próprio driver. ```text -.\"- -.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2026 Your Name .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Redistribution and use in source and binary forms, with or .\" without modification, are permitted provided that the .\" following conditions are met: @@ -1177,7 +1177,7 @@ Vamos percorrer as partes que são mais frequentemente mal compreendidas. O bloco de cabeçalho no topo é um conjunto de linhas de comentário que começam com `.\"`. São comentários mdoc. Eles não são renderizados na saída da página de manual. Eles existem para conter o cabeçalho de copyright e quaisquer notas para editores futuros. -O marcador de abertura é `.\"-` com um traço, equivalente ao `/*-` em arquivos C. O coletor de licenças o reconhece. +A linha de abertura é um `.\"` simples, equivalente à abertura `/*` em arquivos C. Como nos arquivos C, a linha de copyright vem primeiro e o identificador SPDX vem em seguida. A macro `.Dd` define a data do documento. É formatada como mês, dia, ano com o nome completo do mês. O estilo mdoc do projeto é atualizar `.Dd` sempre que o conteúdo da página de manual mudar de forma significativa. Não atualize a data para mudanças triviais como correções de espaço em branco, mas atualize-a para qualquer mudança semântica. @@ -2272,11 +2272,11 @@ Passos: 1. Identifique todos os arquivos do driver que precisam de cabeçalho: cada arquivo `.c`, cada arquivo `.h` e a página de manual. 2. Para cada arquivo, verifique o cabeçalho existente. Se estiver ausente ou malformado, substitua por um template conhecido e correto. -3. Use `/*-` como abertura do cabeçalho em arquivos `.c` e `.h`. Use `.\"-` como abertura na página de manual. -4. Inclua a linha `SPDX-License-Identifier` com a licença adequada, normalmente `BSD-2-Clause`. -5. Adicione seu nome e e-mail na linha Copyright. +3. Use `/*` como abertura do cabeçalho em arquivos `.c` e `.h`. Use `.\"` como abertura na página de manual. +4. Adicione seu nome e e-mail na linha Copyright. +5. Inclua a linha `SPDX-License-Identifier` com a licença adequada, normalmente `BSD-2-Clause`, depois da linha de copyright. 6. Inclua o texto padrão da licença. -7. Verifique que o arquivo começa na coluna 1 com a abertura `/*-` ou `.\"-`. +7. Verifique que o arquivo começa na coluna 1 com a abertura `/*` ou `.\"`. Critério de sucesso: todos os arquivos têm um cabeçalho corretamente formatado que corresponde às convenções dos arquivos já presentes na árvore. diff --git a/translations/zh_CN/chapters/part2/chapter-07.md b/translations/zh_CN/chapters/part2/chapter-07.md index 418b2c7..74dc165 100644 --- a/translations/zh_CN/chapters/part2/chapter-07.md +++ b/translations/zh_CN/chapters/part2/chapter-07.md @@ -239,10 +239,10 @@ Makefile 这是骨架: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2025 Your Name + * + * SPDX-License-Identifier: BSD-2-Clause * All rights reserved. */ diff --git a/translations/zh_CN/chapters/part3/chapter-15.md b/translations/zh_CN/chapters/part3/chapter-15.md index 537f7b7..34ccff8 100644 --- a/translations/zh_CN/chapters/part3/chapter-15.md +++ b/translations/zh_CN/chapters/part3/chapter-15.md @@ -3601,11 +3601,11 @@ $ grep -c 'mtx_init\|mtx_lock\|mtx_unlock' /usr/src/sys/dev/ale/if_ale.c `examples/part-03/ch15-more-synchronization/stage4-final/` 下的配套源代码包含完整的 `myfirst_sync.h`。作为参考,这是一个可用作模板的完整版本。 ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sync.h: the named synchronisation vocabulary of the * myfirst driver. * diff --git a/translations/zh_CN/chapters/part4/chapter-17.md b/translations/zh_CN/chapters/part4/chapter-17.md index 73c87fe..45e15fd 100644 --- a/translations/zh_CN/chapters/part4/chapter-17.md +++ b/translations/zh_CN/chapters/part4/chapter-17.md @@ -519,7 +519,7 @@ language: "zh-CN" 在第16章文件旁边创建 `myfirst_sim.c`。第一个版本很小: ```c -/*- +/* * myfirst_sim.c -- 第17章模拟硬件后端。 * * 添加一个驱动自主寄存器变化的定时器,一个 @@ -3825,11 +3825,11 @@ led_timeout(void *p) 这是第17章末尾完整的 `myfirst_sim.h` 文件,供快速参考。该源码也位于 `examples/part-04/ch17-simulating-hardware/stage5-final/myfirst_sim.h` 中。 ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_sim.h -- Chapter 17 simulation API. * * The simulation layer turns the Chapter 16 static register block into diff --git a/translations/zh_CN/chapters/part4/chapter-18.md b/translations/zh_CN/chapters/part4/chapter-18.md index 7bea0be..0ffe88b 100644 --- a/translations/zh_CN/chapters/part4/chapter-18.md +++ b/translations/zh_CN/chapters/part4/chapter-18.md @@ -500,11 +500,11 @@ FreeBSD定义几个探测优先级层级,定义在`/usr/src/sys/sys/bus.h`: 综上所述,这是第18章第1阶段驱动程序,作为单个自包含文件呈现,从第17章骨架中生长。文件名是`myfirst_pci.c`;它在第18章是新的,与现有的`myfirst.c`、`myfirst_hw.c`和`myfirst_sim.c`并存。 ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.c -- 第18章第1阶段PCI探测/附加骨架。 * * 在此阶段驱动程序只探测、附加和分离。 @@ -596,11 +596,11 @@ MODULE_VERSION(myfirst, 1); 伴随头文件`myfirst_pci.h`: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Edson Brandi * + * SPDX-License-Identifier: BSD-2-Clause + * * myfirst_pci.h -- myfirst驱动程序的第18章PCI接口。 */ @@ -2622,11 +2622,11 @@ make ### 文件顶部 ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2006 Marcel Moolenaar All rights reserved. * Copyright (c) 2001 M. Warner Losh + * + * SPDX-License-Identifier: BSD-2-Clause ... */ diff --git a/translations/zh_CN/chapters/part7/chapter-37.md b/translations/zh_CN/chapters/part7/chapter-37.md index b6ea447..66c1fb6 100644 --- a/translations/zh_CN/chapters/part7/chapter-37.md +++ b/translations/zh_CN/chapters/part7/chapter-37.md @@ -218,11 +218,11 @@ FreeBSD 项目是一个围绕三个主要子项目组织的长期社区:src、 作为入门指南,这里是一个 `mydev.c` 的最小形态。它不是完整的,但展示了审查者期望看到的结构元素。您在前面章节已经看到这些宏各自的机制;这里我们关注它们如何在页面上排列自己。 ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: @@ -307,7 +307,7 @@ MODULE_VERSION(mydev, 1); MODULE_DEPEND(mydev, pci, 1, 1, 1); ``` -几件事值得注意。版权头部使用 `/*-` 开头标记,自动许可证收集脚本能识别它。SPDX 行明确命名许可证。缩进使用制表符而非空格,正如 `style(9)` 要求的那样。函数声明使用制表符分隔,同样符合 `style(9)`。`DRIVER_MODULE` 和相关宏出现在底部,按构建系统期望的顺序。这是审查者期望看到的形态。 +几件事值得注意。版权头部以普通的 `/*` 注释开头,先写版权行,然后用 SPDX 行明确命名许可证。缩进使用制表符而非空格,正如 `style(9)` 要求的那样。函数声明使用制表符分隔,同样符合 `style(9)`。`DRIVER_MODULE` 和相关宏出现在底部,按构建系统期望的顺序。这是审查者期望看到的形态。 ### 模块 Makefile @@ -366,7 +366,7 @@ SRCS+= bus_if.h device_if.h pci_if.h #### 版权头部形式 -版权头部使用 `/*-` 开头标记。此标记是魔法。一个自动化工具通过查找在第 1 列以 `/*-` 开始的多行注释从源代码树收集许可证。使用此标记将块标记为许可证;使用常规 `/*` 则不会。在 `/*-` 之后紧接着,下一个重要行应该是 `SPDX-License-Identifier:` 后跟 SPDX 许可证代码,如 `BSD-2-Clause`。然后是一或多行 `Copyright`。然后是许可证文本。 +版权头部是一个从第 1 列开始、以普通 `/*` 开头的多行注释。较旧的文件以 `/*-` 开头,那个破折号曾是许可证收集工具依赖的标记;`style(9)` 已不再要求新代码使用它。头部最先的重要行是一或多行 `Copyright`。版权行之后是 `SPDX-License-Identifier:` 后跟 SPDX 许可证代码,如 `BSD-2-Clause`。然后是可选的许可证文本。 #### 函数声明和定义 @@ -578,7 +578,7 @@ mandoc -Tlint /usr/src/share/man/man4/mydev.4 - 文件位置错误。驱动程序存在于 `/usr/src/sys/dev//`,而非 `/usr/src/sys/` 顶部。模块 Makefile 存在于 `/usr/src/sys/modules//`。手册页存在于 `/usr/src/share/man/man4/`。 - 文件名与驱动程序不匹配。如果驱动程序是 `mydev`,主要源文件是 `mydev.c`,而非 `main.c` 或 `driver.c`。 -- 缺少或错误的版权头部。头部使用 `/*-` 作为开头标记,SPDX 标识符在最前,许可证文本与项目接受的许可证之一匹配。 +- 缺少或错误的版权头部。头部以 `/*` 开头,版权行在最前,SPDX 标识符紧随其后,许可证文本与项目接受的许可证之一匹配。 - 使用空格而非制表符。`style(9)` 明确要求制表符,风格检查器将立即标记空格缩进。 - `return` 表达式缺少括号。一个反复出现的小错误,风格检查器会捕捉。 - 变量声明和代码之间缺少空行。另一个小约定,风格检查器会捕捉。 @@ -634,11 +634,11 @@ FreeBSD 项目作为默认偏好两条款 BSD 许可证,通常写作 BSD-2-Cla 源代码树中每个源文件顶部的版权头部有特定的结构,记录在 `style(9)` 中。让我们演练一个完整的头部并检查每一部分。 ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the * following conditions are met: @@ -665,9 +665,9 @@ FreeBSD 项目作为默认偏好两条款 BSD 许可证,通常写作 BSD-2-Cla */ ``` -开头的 `/*-` 不是拼写错误。星号后的破折号很重要。源代码树中的自动化脚本通过查找在第 1 列以 `/*-` 序列开始的多行注释来从文件收集许可证信息。使用 `/*-` 将块标记为许可证;使用普通 `/*` 则不会。`style(9)` 明确规定:如果您想让源代码树的许可证收集器正确获取您的许可证,请使用 `/*-` 作为开头行。 +开头是从第 1 列开始的普通 `/*`。您在源代码树中许多文件的顶部仍会看到 `/*-`:那个破折号曾是自动许可证收集脚本的标记,`style(9)` 多年来一直要求它。当前的 `style(9)` 已取消这一要求,因此新代码以 `/*` 开头,并依靠 SPDX 行来标识许可证。 -紧接着开头的是 SPDX-License-Identifier 行。SPDX 是用于以机器可读形式描述许可证的标准化词汇。该行告诉收集器文件使用什么许可证,以一种无法被误解的形式。两条款 BSD 许可证使用 `BSD-2-Clause`,三条款 BSD 许可证使用 `BSD-3-Clause`。对于其他许可证,请查阅 `https://spdx.org/licenses/` 的 SPDX 标识符列表。不要发明标识符。 +紧接着开头的是版权行,然后是 SPDX-License-Identifier 行。SPDX 是用于以机器可读形式描述许可证的标准化词汇。该行以一种无法被误解的形式告诉收集器文件使用什么许可证。两条款 BSD 许可证使用 `BSD-2-Clause`,三条款 BSD 许可证使用 `BSD-3-Clause`。对于其他许可证,请查阅 `https://spdx.org/licenses/` 的 SPDX 标识符列表。不要发明标识符。注意顺序:`style(9)` 规定版权行写在 SPDX 标识符之前。较旧的文件顺序相反;新代码不应如此。 版权行命名年份和版权持有人。使用您的完整法定姓名,或您雇主的姓名(如果您是在雇佣下贡献工作),后跟一个足够稳定的电子邮件地址,以便多年后仍能联系到您。如果您作为个人贡献,请使用您的个人电子邮件而非一次性地址。 @@ -697,12 +697,12 @@ FreeBSD 项目作为默认偏好两条款 BSD 许可证,通常写作 BSD-2-Cla 源代码树中衍生作品的约定是保留原始版权行并作为单独的行添加您自己的: ```c -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 1998 Original Author * Copyright (c) 2026 Your Name * + * SPDX-License-Identifier: BSD-2-Clause + * * [licence text] */ ``` @@ -737,24 +737,24 @@ FreeBSD 项目作为默认偏好两条款 BSD 许可证,通常写作 BSD-2-Cla 如果您正在改装您已编写但从未准备提交的驱动程序,您需要向每个文件添加正确的头部。步骤如下: 1. 确定许可证。对于新驱动程序,使用 BSD-2-Clause。 -2. 写 SPDX 标识符行。 -3. 用您的姓名、电子邮件和首次创建年份写版权行。 +2. 用您的姓名、电子邮件和首次创建年份写版权行。 +3. 在版权行之后写 SPDX 标识符行。 4. 粘贴标准 BSD-2-Clause 许可证文本。 -5. 验证开头是 `/*-` 且文件从第 1 列开始。 +5. 验证开头是第 1 列的 `/*`。 6. 验证闭合 `*/` 后有一空行。 -7. 对每个文件重复:`.c` 文件、`.h` 文件、手册页(其中许可证以 `.\" -` 风格注释而非 `/*-` 风格出现),以及任何其他包含实质内容的文件。 +7. 对每个文件重复:`.c` 文件、`.h` 文件、手册页(其中许可证以 `.\"` 风格注释而非 `/*` 风格出现),以及任何其他包含实质内容的文件。 对于 Makefile,如前所述,琐碎文件传统上省略许可证头部。第 2 节中显示的模块 Makefile 足够琐碎不需要头部。 ### 验证头部 -没有单一自动化工具验证 FreeBSD 版权头部的每个方面。`checkstyle9.pl` 脚本捕捉头部附近的某些格式错误。源代码树中的许可证收集器基于 `/*-` 标记和 SPDX 行工作。然而,最可靠的验证是将您的头部直接与源代码树中已知良好的头部比较,如 `/usr/src/sys/dev/null/null.c` 中的头部或任何最近添加的驱动程序。 +没有单一自动化工具验证 FreeBSD 版权头部的每个方面。`checkstyle9.pl` 脚本捕捉头部附近的某些格式错误。源代码树中的许可证工具基于 SPDX 行工作。然而,最可靠的验证是将您的头部直接与源代码树中已知良好的头部比较,如 `/usr/src/sys/dev/null/null.c` 中的头部或任何最近添加的驱动程序。 建立一个小习惯:当您打开新的源文件时,粘贴已知良好的头部作为第一个动作。这防止完全忘记头部的容易错误,并确保形状从一开始就正确。 ### 第 3 节小结 -许可是在一开始就正确处理就能节省大量时间的地方之一。FreeBSD 项目接受 BSD-2-Clause、BSD-3-Clause 和少数其他用于历史文件的宽松许可证。新贡献应默认 BSD-2-Clause。版权头部使用特定形式,以 `/*-` 开头,后跟 SPDX 标识符,后跟一或多条版权行,然后是标准许可证文本。从其他项目衍生的代码携带其原始许可证义务向前传递,衍生作品必须保留原始归属。您未自己编写的代码需要作者的许可和归属。 +许可是在一开始就正确处理就能节省大量时间的地方之一。FreeBSD 项目接受 BSD-2-Clause、BSD-3-Clause 和少数其他用于历史文件的宽松许可证。新贡献应默认 BSD-2-Clause。版权头部使用特定形式,以 `/*` 开头,后跟一或多条版权行,后跟 SPDX 标识符,然后是标准许可证文本。从其他项目衍生的代码携带其原始许可证义务向前传递,衍生作品必须保留原始归属。您未自己编写的代码需要作者的许可和归属。 处理好法律方面,我们可以转向手册页。源代码树中的每个驱动程序都附带手册页,编写一个好的手册页是首次贡献者最常低估努力的地方之一。第 4 节演练约定并提供一个您可以改编的模板。 @@ -810,11 +810,11 @@ FreeBSD 中的手册页组织成编号章节。章节如下: 这里是一个假设的 `mydev` 驱动程序的完整、可工作的第 4 节手册页。将其保存为 `mydev.4`,对它运行 `mandoc -Tlint`,您将看到它干净通过。这是您可以改编用于自己的驱动程序的那种手册页。 ```text -.\"- -.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2026 Your Name .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Redistribution and use in source and binary forms, with or .\" without modification, are permitted provided that the .\" following conditions are met: @@ -914,7 +914,7 @@ driver and this manual page were written by 顶部的头部块是一组以 `.\"` 开始的注释行。这些是 mdoc 注释。它们不渲染到手册页输出。它们的存在是携带版权头部和给未来编辑的任何说明。 -开头标记是 `.\"-` 带破折号,等同于 C 文件中的 `/*-`。许可证收集器能识别它。 +开头行是普通的 `.\"`,等同于 C 文件中的 `/*` 开头。和 C 文件一样,版权行在最前,SPDX 标识符紧随其后。 `.Dd` 宏设置文档日期。它格式化为月、日、年,使用完整月份名称。项目的 mdoc 风格是每当手册页内容有意义更改时更新 `.Dd`。不要为琐碎更改如空格修复增加日期,但要为任何语义更改增加。 @@ -1971,11 +1971,11 @@ FreeBSD 有大约一年一次主要版本的发布周期,点版本发布在更 1. 识别驱动程序中需要头部的每个文件:每个 `.c` 文件、每个 `.h` 文件和手册页。 2. 对于每个文件,检查现有头部。如果缺失或畸形,用已知良好的模板替换它。 -3. 在 `.c` 和 `.h` 文件中使用 `/*-` 作为头部开头。在手册页中使用 `.\"-` 作为开头。 -4. 包含 SPDX-License-Identifier 行,带有适当许可证,通常为 `BSD-2-Clause`。 -5. 将您的姓名和电子邮件添加到版权行。 +3. 在 `.c` 和 `.h` 文件中使用 `/*` 作为头部开头。在手册页中使用 `.\"` 作为开头。 +4. 将您的姓名和电子邮件添加到版权行。 +5. 在版权行之后包含 SPDX-License-Identifier 行,带有适当许可证,通常为 `BSD-2-Clause`。 6. 包含标准许可证文本。 -7. 验证文件以 `/*-` 或 `.\"-` 开头从第 1 列开始。 +7. 验证文件以 `/*` 或 `.\"` 开头从第 1 列开始。 成功标准:每个文件有正确格式的头部,匹配已在源代码树中文件的约定。