[Patches] [ python-Patches-410547 ] os.statvfs support for Windows

noreply@sourceforge.net noreply@sourceforge.net
Thu, 29 Mar 2001 20:13:50 -0800


Patches item #410547, was updated on 2001-03-22 08:58
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=410547&group_id=5470

Category: Windows
Group: None
Status: Open
Priority: 5
Submitted By: Fredrik Lundh (effbot)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: os.statvfs support for Windows

Initial Comment:
This patch adds (partial) os.statvfs support for
Windows.

The FRSIZE, BLOCKS, BFREE, BAVAIL, and NAMEMAX
fields are set.  Remaining fields are set to
zero, but should probably be set to None.

</F>

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-03-29 20:13

Message:
Logged In: YES 
user_id=31435

No, it did not go in.  I asked for a doc patch first so I 
wouldn't have to pee away time trying to guess what it 
does.  Now I've peed away the time, and I don't like it.  
Here's what it returns on my home desktop box (Win98SE, 
20Gb drive):

>>> os.statvfs("c:\")  # argument is very touchy
(32768, 32768, 65526, 65526, 65526, 0, 0, 0, 0, 1024)
>>>

*Nothing* there makes sense, except for the last "max path" 
result.  Even the "block size" is wrong (the FAT32 fs on 
this box uses 16Kb clusters, not 32Kb).  Digging into the 
MS docs,

"""The GetDiskFreeSpace function returns incorrect values 
for volumes that are larger than 2 gigabytes"""

and

"""Even on volumes that are smaller than 2 gigabytes, the 
values stored into *lpSectorsPerCluster, 
*lpNumberOfFreeClusters, and *lpTotalNumberOfClusters 
values may be incorrect"""

under Win95, and, to judge from my desktop box, it appears 
useless under the latest flavor of Win98 too.

The function the patch uses is obsolete, and a ...Ex 
version is recommended in its place, which

"""returns correct values for all volumes, including those 
that are greater than 2 gigabytes"""

BUT, *that* function isn't available under the original 
Win95, only under Win95 OSR2 and later.  In addition, that 
function only returns number of bytes total and free (as 64 
bit unsigned ints), nothing about block size, # clusters, 
etc.  (OTOH, total bytes is free is what people asked for!  
I don't recall anyone asking for a statvfs() clone)

So bouncing back to you:  how much time do you want me to 
devote to this?

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-03-29 09:28

Message:
Logged In: YES 
user_id=6380

Tim, wasn't this supposed to go into 2.1b2?  Did it?  Can it
go into 2.1final?


----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-22 13:35

Message:
Logged In: YES 
user_id=31435

/F, can you add a doc patch (for os.statvfs) that says 
enough so that a Windows user has some chance of guessing 
what this function returns?

BTW, I have no problem w/ returning zeroes instead of Nones.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=410547&group_id=5470