By the way - I might have been a little confused in my previous reply.
I thought we had bad sectors also in the disklabel, but we don't. So ignore that bit. But we do have the replacement sectors. I guess that's what you want to get out, right?

Also, the bad144 program is honestly somewhat broken, if we're talking about the DEC STD 144 bad sector handling. What we have in bad144 sortof works, but it's not correct or complete. There are actually two lists of bad sectors as specified by DEC STD 144. Manufacture marked bad sectors, and field marked bad sectors. And they are kept in two different areas.

But that is getting somewhat off topic here. In general, I agree that this should only exist for machines where it makes sense. Not sure how to go about that in a good way, though.

  Johnny

On 5/27/26 14:00, Jason Thorpe wrote:
I am on a quest to properly unify the m68k user-land, which means addressing 
some long-standing ABI differences in some of the darker corners ofthe system.  
One particularly dark corner is BSD disklabel handling, which, from where I 
sit, is a giant toxic dumpster fire raging in the middleof the Bog of Eternal 
Stench.  But I don’t have time for that rant this morning.

So, let’s focus on DEC STD 144, a.k.a. bad144, a.k.a. dkbad.  It’s a 1970s-era 
bad sector remapping scheme that was already mostly obsolete by the mid-80s 
(ever since SCSI drives were able to maintain their own bad sector remapping 
information).  It is totally and completely useless on any drive made since the 
1990s.  And yet, its tendrils infest many a NetBSD port’s BSD disklabel 
handling because, as far as I can tell, cargo-cultism.

I figure there are a handful of legit use cases for bad144 in NetBSD still:

- The vax port, obviously, but only with the really old drives.  (VAX peeps 
please help me out here - is bad144 useful drives behind an MSCP-compliant 
controller?)

- hp300 port maybe (for HP-IB drives).

- sun3 / sun4 (Xylogics controllers and SMD drives)

- i386 (ESDI, ST506, other ancient drive technologies that can plug into ISA or 
MCA)

What I would like to propose is that bad144 be completely decoupled from 
“disklabel” and refactored out as set of library routines (slash module) that 
drivers can use.  But, most importantly, get it out of the main “BSD disklabel” 
code path.

And so, let’s discuss.

-- thorpej


Reply via email to