[PATCH 1 of 2] cext: implement osutil.getfstype() on Windows

Matt Harbison mharbison72 at gmail.com
Sat Dec 30 11:19:56 EST 2017


> On Dec 30, 2017, at 2:13 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> 
>> On Thu, 28 Dec 2017 18:31:38 -0500, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison at yahoo.com>
>> # Date 1514442941 18000
>> #      Thu Dec 28 01:35:41 2017 -0500
>> # Node ID 452b23148c906aca4765d568263d9e3615cce228
>> # Parent  95a9be56c3bb614fc1334a4cc8ec669f9eb7bc5a
>> cext: implement osutil.getfstype() on Windows
>> 
>> This will allow NTFS to be added to the hardlink whitelist, and resume creating
>> hardlinks in transactions (which was disabled globally in 07a92bbd02e5; see also
>> e5ce49a30146).  I'll wait until this is accepted before implementing the pure
>> version.
> 
> Perhaps we don't need a cext version if we'll reimplement it with ctypes.

So move the existing util.getfstype to posix, and then “util.getfstype = platform.getfstype”?  Works for me.  Do you want to drop this from hg-committed?

>> +    fullpath = calloc(size, sizeof(fullpath[0]));
>> +    volume = calloc(size, sizeof(volume[0]));
> 
> Nit: no need to zero-fill?
> 
>> +    if (!fullpath || !volume) {
>> +        PyErr_SetString(PyExc_MemoryError, "out of memory");
>> +        goto bail;
> 
> Nit: PyErr_NoMemory() is preferred in our code.
> 
>> +bail:
>> +    if (fullpath)
>> +        free(fullpath);
>> +    if (volume)
>> +        free(volume);
> 
> Nit: free(NULL) is valid.


More information about the Mercurial-devel mailing list