FreeBSD Device Drivers Book

(github.com)

65 points | by myth_drannon 7 hours ago

2 comments

  • inatreecrown2 4 hours ago
    This is a huge book! I would like to know if a LLM was involved in the writing process or if this is the product of a human.
    • AbbeFaria 1 hour ago
      There is nothing wrong with using an LLM so long as a human takes ownership for the artefact (be that books, code etc).

      I would rather the author automate the mundane and focus on conveying their ideas clearly.

      As an aside, is there a Linux version for this ?

      • LeCompteSftware 45 minutes ago
        There is something wrong with it because LLMs are really not capable of writing a useful book, and this book is 100% LLM slop.

        Look at this totally useless """introduction""" to C: https://github.com/ebrandi/FDD-book/blob/main/content/chapte...

        First of all this is an entire book, it's 76,000 words. But look at the first nontrivial example of C after "hello world," under "Bonus learning point about C return values"

          exec_map_first_page(struct image_params *imgp)
         {
                vm_object_t object;
                vm_page_t m;
                int error;
        
                if (imgp->firstpage != NULL)
                        exec_unmap_first_page(imgp);
                        
                object = imgp->vp->v_object;
                if (object == NULL)
                        return (EACCES);
         #if VM_NRESERVLEVEL > 0
                if ((object->flags & OBJ_COLORED) == 0) {
                        VM_OBJECT_WLOCK(object);
                        vm_object_color(object, 0);
                        VM_OBJECT_WUNLOCK(object);
                }
         #endif
                error = vm_page_grab_valid_unlocked(&m, object, 0,
                    VM_ALLOC_COUNT(VM_INITIAL_PAGEIN) |
                    VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED);
        
                if (error != VM_PAGER_OK)
                        return (EIO);
                imgp->firstpage = sf_buf_alloc(m, 0);
                imgp->image_header = (char *)sf_buf_kva(imgp->firstpage);
        
                return (0);
         }
        
        This teaches nobody anything. I am sorry but this project is completely useless and there's no way Brandi read a single word of it. This entire book is a dishonest AI scam. I hate LLMs. It is hard to think of another computer technology that has done so much damage for so little good.

        Edit: I mean look at the intro to for loops. This is supposed to be for total beginners. Example 1:

          for (int i = 0; i < 10; i++) {
             printf("%d\n", i);
           }
        
        >> Start at i = 0

        >> Repeat while i < 10

        >> Increment i each time by 1 (i++)

        Example 2:

          for (i = 0; n > 0 && i < IFLIB_MAX_RX_REFRESH; n--, i++) {
             struct netmap_slot *slot = &ring->slot[nm_i];
             uint64_t paddr;
             void *addr = PNMB(na, slot, &paddr);
             /\* ... work per buffer ... \*/
             nm_i = nm_next(nm_i, lim);
             nic_i = nm_next(nic_i, lim);
           }
        
        >> What this loop does

        >> * The driver is refilling receive buffers so the NIC can keep receiving packets.

        >> * It processes buffers in batches: up to IFLIB_MAX_RX_REFRESH each time.

        >> * i counts how many buffers we've handled in this batch. n is the total remaining buffers to refill; it decrements every iteration.

        >> * For each buffer, the code grabs its slot, figures out the physical address, readies it for DMA, then advances the ring indices (nm_i, nic_i).

        >> * The loop stops when either the batch is full (i hits the max) or there's nothing left to do (n == 0). The batch is then "published" to the NIC by the code right after the loop.

        >> In essence, a for loop is the go-to choice when you have a clear limit on how many times something should run. It packages initialisation, condition checking, and iteration updates into a single, compact header, making the flow easy to follow.

        Total garbage. This has literally zero educational value. I assume Brandi is just trying to make a quick buck, he truly has not even glanced at the output. He should be ashamed of himself.

    • rvz 2 hours ago
      Even if it was, the author is not a random person and is part of the FreeBSD team and I'd rather trust them to write the book than someone else outside of the organization.

      So I would expect that they would thoroughly check the book for inaccuracies, errors and issues before releasing it after proof-reading, otherwise it would say a lot about how they use LLMs and not checking over it would hurt their own reputation.

    • esseph 4 hours ago
      "The English version is the original and authoritative version of the book. The Brazilian Portuguese and Spanish editions were translated using AI and have not yet undergone a full human technical review. They are published to make the material accessible to more readers, but they may contain translation mistakes, awkward wording, or technical inaccuracies introduced during translation.

      If something in a translated edition seems unclear, inconsistent, or technically questionable, please refer to the English version as the source of truth. Help with reviewing and improving the translations is very welcome (see Contributing below)."

      ---

      This doesn't directly answer your question though.

  • SilentM68 4 hours ago
    Never seen a book written that incorporates the programming language as part of the learning material.

    Awesome work!

    I await the Linux version :)

    • yjftsjthsd-h 3 hours ago
      Wow, that's amazing:

      > Do I need to know C before starting?

      > No. Chapters 4 and 5 teach C from the ground up, focusing on the parts of the language that matter for kernel work (pointers, structures, memory layout, the preprocessor, and calling conventions). If you already know C well, sidebars in those chapters tell you what to skim and what to read carefully.

      > Do I need to know UNIX or FreeBSD?

      > No. Chapter 2 walks you through installing FreeBSD in a VM or on bare metal, and Chapter 3 introduces the UNIX command line, filesystem, processes, permissions, and editors. By the end of Part 1 you will have a working lab and the vocabulary to use it.

      If you're trying to get more contributors to your project, that seems like an excellent way to do it:) You have any interest in working on the project? Great, here's everything to get you there!