Relating device names in /dev/ to drive letters in Windows.

Brian Inglis
Mon Jul 27 13:10:17 GMT 2020

On 2020-07-27 05:24, Hamish McIntyre-Bhatty via Cygwin wrote:

Please maintain threading using Reply to List or Reply/All to keep the
discussion together in email clients using proper References headers for
threads, rather than just Subject, and also please retain some quoted context
for your replies.

> smartmontools does help - I can see make and model, which is definitely
> helpful.
> Oh, I guess I just didn't have blkid installed then. I'll fix that.

>> $ which blkid
>> /sbin/blkid
>> $ cygcheck -f /sbin/blkid
>> util-linux-2.33.1-2
>> Everyone has util-linux installed as it is in the Base category.

> I'd be happy to attempt implementing this, but I'm not sure where to
> start. With the information you've given me I should be able to figure
> something out, but I'm not sure how this is done in Linux/a POSIX
> compliant way. Would be be through a file and directory structure or
> through some libraries?

See what libraries are used by the package, whether and what system dependencies
each has, clone the source repo or download the sources and create a local repo,
so you can follow a similar structure with a Cygwin port.
Using a (git) repo to track your information, documentation, research, proofs of
concept, and changes will make life easier for all.

> I know a little bit of C and C++, so if I do have to write a library I
> should be able to muddle through, and probably learn quite a lot, but
> I'm not sure quite where to start here, with either the Linux side or
> the Cygwin side (would this be part of the Cygwin DLL?).

First you need to research what information you need to deliver to your client
or consumer, based on the system dependencies found above, and how to find that
information under Windows.

You could make that process into a proof of concept in some interpreted script
running under an elevated admin shell to access /proc/..., /proc/registry/...,
/proc/sys/... etc. and get at the information you require.

Then you could research how you could implement that process with Windows APIs
by searching online docs, including e.g. SO: pay attention to supported versions
in MS docs.

If you isolate system interfaces into independent modules, they could be
reimplemented in the DLL if appropriate.

> I'm aware this might not be the right mailing list, but would appreciate
> if anyone knowledgeable in this area could give me a few pointers to
> help me get started - I'd love to contribute more to Cygwin :)

Check out the newlib-cygwin source repo and read the sources (starting with
short .cc files under winsup/cygwin/) to see how system interfaces are
implemented using Windows APIs.

Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in IEC units and prefixes, physical quantities in SI.]

More information about the Cygwin mailing list