Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 1998 23:20:32 -0700 (PDT)
From:      Julian Elischer <julian@whistle.com>
To:        Greg Lehey <grog@lemis.com>
Cc:        FreeBSD Hackers <hackers@FreeBSD.ORG>
Subject:   Re: How do I access a block device in -CURRENT?
Message-ID:  <Pine.BSF.3.95.980721230308.25908A-100000@current1.whistle.com>
In-Reply-To: <19980722112240.K8098@freebie.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
It's exactly the same..

except that the TYEP of the entry is cdevsw

both bdevsw[] and cdevsw[] arrays point to the same structure,
(the name of which should neow be changed to devsw).

so you would go:
*bdevsw[major (devno)]->d_strategy) (bp);

look familiar?

teh only differnce is that bdevsw[] is an array of cdevsw entries for
now..  also the Bdevsw major number is stored in d_bmaj.

teh changeover problem with major numbers is a problemm
which is why htere are still two differnt arrays of pointers.

if you use devfs of course there is no problem :-) 
(as it bypasses the bdevsw and cdevsw arrays anyhow)

what is dead is the bdevsw structure, not (yet) the array.
this jsut means that each driver only declares a single
cdevsw struct and it gets put in both arrays.

EVENTUALLY, the bdevsw array will go away but just not quite yet.

of curse if you are doing this then you are adding yet another place that
will have to be hacked when the change is made..

julian

On Wed, 22 Jul 1998, Greg Lehey wrote:

> Since the change in bdevsw/cdevsw in -CURRENT, I have a problem: how
> do I access block devices from a driver?  Previously I would do
> something like
> 
>     (*bdevsw [major (devno)]->d_strategy) (bp); 
> 
> I'm not supposed to use bdevsw any more, I should use cdevsw instead.
> But the major numbers are different.  How do I find the correct major
> number?  I went through the way the system does it, and found:
> 
> #2  0xf014959e in spec_strategy (ap=0xf439de30) at ../../miscfs/specfs/spec_vnops.c:556
> 556             (*bdevsw[major(bp->b_dev)]->d_strategy)(bp);
> 
> So what's the story now?  Is bdevsw dead or not?  How do I access the
> devices?  One obvious choice would be to give block and character
> devices the same major numbers, like System V does, but the problems
> on changeover would be horrendous.


not with devfs :-)

Eventually there will be no bdevs and you will simly mount the cdevs.
there is no real difference at the moment as it is, and in fact
poul-henning
has had a system booting without the bdevs.

> 
> Greg
> --
> See complete headers for address and phone numbers
> finger grog@lemis.com for PGP public key
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.980721230308.25908A-100000>