[Mono-dev] [PATCH] DriveInfo implementation - volume space

Robert Jordan robertj at gmx.net
Sat Dec 8 17:04:25 EST 2007


Hi Javier,

Javier Martín wrote:
> About the test case, I've not written it mainly because I don't really
> know what to test for. M$s spec is quite lame, describing only the
> windows-specific case (and not even all of them - what will the class
> do with junction points is not specified). If anyone wants to write a
> test to check that DriveInfo throws ArgumentNullException when null is
> fed to its constructor, well, just do it o_O.

Well, DriveInfo's members don't look exactly like no-ops to me :)
They do something worth some unit testing.

In volumes.c:

+	if (NULL != availFree)
+		availFree->QuadPart = buf.f_bavail * buf.f_frsize;
+	if (NULL != totalSize)
+		totalSize->QuadPart = buf.f_blocks * buf.f_frsize;
+	if (NULL != totalFree)
+		totalFree->QuadPart = buf.f_bfree * buf.f_frsize;

On systems w/out LARGE_FILE support (_FILE_OFFSET_BITS != 64),
the computations are not performed at 64-bit precision, so
you better cast the result to guint64.

> (GMT+1). I would really want the functionality brought by this patch
> to be included in Mono as soon as sanely possible, since I really need
> the free space meters for a project of mine and I'm not really
> comfortable running my many .net systems on an SVN version of Mono
> (remember Miguel's laptop at the first day of the Summit?). So, please

I don't think your patch will make into 1.2.6, but feel free
to ask the team (Dick, Miguel).

To avoid stability issues, you can always work with a stable
branch (e.g. branches/mono-1-2-6/ in SVN) and apply the patch
to this version.

Robert




More information about the Mono-devel-list mailing list