Re: How to recognize hdc as a CD-ROM drive?

Andries.Brouwer@cwi.nl
Sun, 17 May 1998 14:13:32 +0200 (MET DST)


From fizban@tin.it Sun May 17 12:21:41 1998

> For programs like mount and fdisk it is useful
> to be able to find out whether a device is a hard disk
> or a CD-ROM drive or something else.
> However, there seems to be no simple way to do so.

In 2.1.102, having mounted the /proc filesystem:

# cat /proc/ide/hdd/media
cdrom

Very good. That will suffice.

Look in /etc/fstab ...

I like this a lot less. Not good information but a vague heuristic.

But ... if you want to open() the device and don't receive kernel
messages, you can much more easily (with the syslog(2) system call):

syslog(8, NULL, 1);

Inadmissable - who knows what else is happening at the same time.
A utility program like mount or fdisk cannot change the loglevel.
It is up to the system administrator to set policy.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu