POSIX names for drive letters

Schwarz, Konrad konrad.schwarz@siemens.com
Fri Aug 25 11:44:00 GMT 2006


Hi,

I know that it is kind of late :-), but I would like to suggest an
alternative/additional mapping of drive letters to the MinGW and Cygwin
file-system name space.

The proposed mapping for directory `C:\' is `//./C$/' (or perhaps
`//./C/').

The reasons for this mapping are:

* POSIX allows paths that begin with exactly two slashes to be
"special": they do not have to obey normal file system path semantics
(see XBD 4.11).  E.g., POSIX requires `/x/my_file' to be referenced from
`/y/my_dir' as `../../x/my_file', but this is does not work in MinGW.
By beginning the path with two slashes, POSIX compliant code knows that
this transformation should not be attempted in general.

* The notation `//./something' is in line with standard Windows API
names for system devices.  See the documentation for the CreateFile()
function in the Windows SDK for those names.  In particular,
CreateFile() uses `\\.\C:\' to represent the root directory of that
volume and `\\.\C:' to represent the volume (raw device).  Since colon
is used in POSIX to separate paths in the PATH environment variable,
`//./C:/' is not a good mapping.

* The notation is in line with the Windows Universal Naming Convention
(UNC) insofar as it consists of two components and begins with two
directory separation characters.  Therefore, Windows-special cased code
that does not need to differentiate between "local" and "network" drives
(which should be the majority of cases) can stay unaware of the
differentiation.

* `//host/C$' is the standard share name for drives under Windows that
are mounted from a different machine.

* Shells do not attempt to expand the substring `$/' as a variable.
Other languages, e.g., make(1), will attempt to expand such a reference,
so `//./C/' might be better than `//./C$/'.  `//./C/' also has the
benefit of using only letters from the POSIX portable filename character
set.  However, `//./C/' might be used by Microsoft for some different
purpose in the future.

Note that for Windows, `/' is a reserved letter in the file system.  It
is, as far as I know, never a problem to replace `\' with `/' in paths
when dealing directly with the operating system (cmd.exe is something
else), and the Windows SDK functions will even do this for you, except
for paths prefixed with '\\?\'.

Regards,

Konrad Schwarz

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list