Re: Attachment order of scsibus*

Valery Ushakov <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
On Fri, Apr 11, 2025 at 11:05:19 +0200, Edgar Fuß wrote:

> > You can create a custom kernel with a fixed set of attachments
> But how in this case?
> There’s some magic
>         scsibus* at scsi*
> but no scsi at anything.

scsi is not device, it's an attribute.  In Java terms, thinks classes
vs. interfaces.  config(5) is a bit dense, but it documents all this.

conf/files has:

  define scsi ...
  device mpt: scsi

which is kinda "class mpt extends device implements scsi".  As
config(5) says:

  There is a special class of attribute, named interface attribute, which
  represents a hook that allows a device to attach to (i.e., be a child of)
  another device.

and here "scsi" is such an "interface attribute".


sys/dev/scsipi/files.scsipi has:

    device scsibus ...
    attach scsibus at scsi

that tries to attach scsibus to any device that "implements scsi"
interface attribute.

This is may be a bit unfortunate from the readability point of view,
as the name "scsi" just seemingly appears out of nowhere in the kernel
config file, b/c its definition is somwhere in sys/**/files* that you
don't see when you read/edit a kernel config.  Think of this as a name
that comes from the "standard library", like printf, of FILE :) (sorry
for mixing Java and C metaphors).

-uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.