Subject: Re: CVS commit: src/sys/dev/scsipi
To: None <>
From: YAMAMOTO Takashi <>
List: tech-kern
Date: 08/10/2005 21:38:59
> > i think you can use config(9) facilities to make any tape devices require
> > the code.  (like wlan does)
> Yes, that is true but the sticking point is the sysctl hooks.  At the
> moment they refer to functions that are only defined if st.c is built,
> I fixed that by including st.h which addressed the unresolved symbols
> but I have subsequently found that there are some architectures that
> have no scsipi at all so st.h is not generated.  A kernel build on
> these architectures is now failing.

can't you create sysctl nodes when attaching devices?

> > i still don't understand why these tape-specific code is necessary, tho.
> > 
> Because they are not disk drives? because they don't have partitions?
> They are not block devices?  Seeks are meaningless (even though these
> are not tracked...). 

afaik, only disk-specific part of diskstats is its name.
yes, you can just seek=0 for tapes.

> I _could_ have put them in amongst the disks
> but, really, they are a different class of device and thought it
> better that they be treated a bit differently.

i have an opposite opinion.
if possible, being generic is a good idea.

> kern/subr_disk.c:disk_unbusy is the one that worried me most, having
> the kernel panic because the tape drive was unexpectedly busy seems a
> bit harsh to me.  Maybe I am worrying too much.

that panic is to detect bugs.
type of the device is not important.

> > can't you solve it by adding some "if (tape)" conditions?
> > 
> If you know it is a tape drive - a new field would have to be added to
> the disk struct or a flag passed to the function calls... and really
> the calls should be renamed (and disk_subr.c) to drive_* instead of
> disk_* since the names would be misleading.  I am not averse to doing
> this, if it is seen as appropriate.

to me, "if (tape)" doesn't seem to be needed, at least for disk_unbusy().

IMO, you can/should just use diskstats for tapes as well.
there is no need to have tape-specific one.

i have no strong opinion about s/disk/something/ renaming.