Re: Determining the hard drives.
From: Peter T. Breuer (ptb_at_oboe.it.uc3m.es)
Date: Tue, 15 Nov 2005 13:49:51 +0100
In comp.os.linux.development.system Pascal Bourguignon <email@example.com> wrote:
> "Enrique Perez-Terron" <firstname.lastname@example.org> writes:
>> On Tue, 15 Nov 2005 03:27:36 +0100, olczyk <email@example.com> wrote:
>>> Is there a way to ( programatically) determine the hard drives installed
>>> on a computer?
>> int fd=open("/proc/partitions", O_RDONLY, 0);
> This shows partitions, not hard drives.
> /proc/devices shows the device drivers.
None of this matters - as you know, there is no way to do what the OP
asked and indeed, no definition of what he means. Is a floppy a "hard
drive"? Is a memory stick a hard drive? Is a network block devcie a hard
drive? Enrique made a reasonable guess at the OP's level of understanding
and gave him an answer that would satisfy him. I agree with you however
that that is an immoral thing to do to a person.
> There's no simple way to determine the hard drives. Hard drives can
> be connected by various interfaces: parrallel port, ide, scsi, usb,
> firewire, bluetooth?!
> So you'd have to scan the various buses and determine for each device
> found if it's a hard drive.
Which doesn't attack the problem - it's his head that doesn't know what a
hard drive is, not us.