[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: device detection
From: |
Glenn McGrath |
Subject: |
Re: device detection |
Date: |
Wed, 15 Nov 2000 15:39:18 +1100 |
Andrew Clausen wrote:
>
> Glenn McGrath wrote:
> > It could be done parsing /proc/devices or /proc/partitions, but this
> > method will still fail if the kernel doesnt have /proc support compiled
> > in.
>
> /proc is always around, nowadays. Well, not always, but we can
> force everyone to have it! Not unreasonable IMHO.
>
Yea, most people would agree with you there.
Personally i dont like /proc cause it adds about 75KB to the size of the
kernel, which is 5% of the total space for a boot floppy. But i guess i
am probably oversensitive to space concerns.
> (OTOH, FreeBSD is a different story... /proc isn't the same
> mess it is on Linux. /proc is a disgrace, IMHO. should be /kernel,
> or something)
>
I guess thats the other thing we have to keep in mind we dont want add
extra linuxisms (if thats a word) whilst looking to port it to other
os's
Is there an equivalent to /proc/partitions in the *BSD's ?
> So, how should we parse /proc/partitions? We need to tell the
> partition devices apart from the "real" ones. Can we simply
> strip the numbers off, from the end?
>
> Andrew Clausen
Yea, that would be by far the easiest approach, just loop around a scanf
statment.
libpci can be used to identify IDE bus's, if there was a way to probe
the ide bus directly to scan for disks, then we could avoid OS specifics
and detect drives directly, maybe thats a bit heavy for parted, but i
have an interest in that area anyway so i will see what i can work out.
We can always fall back to scanning /proc/partitions.
Glenn