File media type

Ove Kaaven ovehk at ping.uio.no
Fri Oct 19 08:38:33 CDT 2001


On Fri, 19 Oct 2001, Marcus Meissner wrote:

> Well, nearly clean would be this code:
> 
> The defines are Linux specific, but could be handled by ifdef/autoconf checks.
> Solaris has fstatvfs() and probably similar magic constants.
> 
> BOOL
> is_on_cdrom(int fd) {
>     struct statfs buf;
> 
>     if (-1==fstatfs(fd,&buf))
> 	return FALSE;
>     return ((buf.f_type == ISOFS_SUPER_MAGIC)||(buf.f_type == UDF_SUPER_MAGIC));
> }

That's not a foolproof check for removable media... though it would
trigger for loopback mounts, which may or may not be good, it doesn't
check for floppy disks, which I consider just as important to support disk
changes for, if not more.





More information about the wine-devel mailing list