[Mono-dev] DriveInfo
Christopher Bergström
cbergstrom at netsyncro.com
Thu Feb 9 10:42:34 EST 2006
Jonathan Pryor wrote:
>On Thu, 2006-02-09 at 14:40 +1300, Thong Nguyen wrote:
>
>
>>I notice that there is already a UnixDriveInfo. I'm implementing a
>>System.IO.DriveInfo that currently just reflects on UnixDriveInfo.
>>
>>
>
>As a sanity check, you should make sure your DriveInfo members reflect
>the final .NET 2.0 DriveInfo members. I wrote UnixDriveInfo during one
>of the .NET 2.0 betas, so it's entirely possible that they added/changed
>the members.
>
>
>
>>UnixDriveInfo currently doesn't do any "DriveType" detection -- is there a
>>reliable POSIX way of detecting the "type" of a disk (cdrom, ram, etc).
>>
>>
>
>If I knew of one, I'd have used it. :-)
>
>I'd love to know an answer to this one. This information might be
>available via some ioctl(2) call, and if that's true you'll have more
>trouble than me, since you'll need to add the appropriate Win32 calls to
>I/O layer and use an internal call, since mscorlib.dll can't depend on
>Mono.Posix.dll...
>
>
The source for hdparm and sdparm will probably show which sys calls are
being used to get info.
hdparm -I /dev/hdx
hdparm -i /dev/hdx
>
>
>>UnixDriveInfo.GetDrives reads fstab which doesn't work with disks mounted
>>but not listed in fstab (disks mounted manually or by automount). Anyone
>>got any good proposals on the best way to handle this?
>>
>>
>
>HAL? Alas, that isn't POSIX; it's only used by Gnome afaik.
>
>This is another area that doesn't seem to be well supported by POSIX.
>
>
eh?
cat /etc/mtab
cat /proc/mounts
Shows which drives are currently mounted.
(If proc wasn't copied and running under a chroot you won't be able to
get it, but this may* be rare.)
there is a basic assumptions..
/dev/hdx = ata device
/dev/sdx = scsi device
/dev/md = software raid something (I might be mistaken on this.)
sata depending on the driver being used can end up being hdx or sdx
Hope this was helpful
C.
More information about the Mono-devel-list
mailing list