On Oct 4, 2011, at 9:32 AM, Erich Hoover wrote:

> This patch implements GetVolumePathName by using the full folder
> path and working backward until stat() returns a different device.
Surely there's a better way. Can't you do a statfs(2)/statvfs(2) (for example) 
to find out the FS root? (I know that works on the BSDs and Mac OS, because 
their statfs/statvfs structures all have a field for that--f_mntonname.) Then 
you can map that path back to a Wine path, and return that. Of course, that 
won't work for fake drives (see below).

At the very least, you should be caching this information, like I did when I 
added case-insensitive lookup support to Wine (see commit 
4e44e153c5c78339f17baeabe22f2015cfc8737c). Because you call stat(2) on every 
single directory in a pathname (especially in the common case of the file being 
on the root device), calculating this from scratch is extremely expensive.

And what about drive C? On Wine, that's not a device at all. It's a folder 
usually somewhere on the root device. In general, I don't see anything in your 
patch that accounts for fake drives like C:--the common case, I might add!

Chip



Reply via email to