From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks
Date: Sat, 4 Nov 2023 21:51:00 +0100 [thread overview]
Message-ID: <ZUautCVKk4bXD4q4@calimero.vinschen.de> (raw)
In-Reply-To: <c82507ab-193a-4a85-7ef0-64f7a7f30705@t-online.de>
Hi Christian,
patch looks pretty good to me. Just two minor points:
> + /* Traverse \Device directory ... */
> + bool errno_set = false;
> + HANDLE devhdl = INVALID_HANDLE_VALUE;
INVALID_HANDLE_VALUE is a Win32 API concept and is only returned by
CreateFile and friends. The native NT API doesn't know
INVALID_HANDLE_VALUE and, fortunately, only uses NULL. I think it's
puzzeling to use INVALID_HANDLE_VALUE in a native NT context. So, would
you mind to just use NULL (or nullptr) instead? As in...
> + if (devhdl != INVALID_HANDLE_VALUE)
if (devhdl)
Sounds easier to me :)
> + /* Fetch drive layout info to get size of all partitions on disk. */
> + DWORD part_cnt = 0;
> + PARTITION_INFORMATION_EX *pix = nullptr;
> + PARTITION_INFORMATION *pi = nullptr;
> + DWORD bytes_read;
> + if (DeviceIoControl (devhdl, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, nullptr, 0,
> + ioctl_buf, NT_MAX_PATH, &bytes_read, nullptr))
> + {
> + DRIVE_LAYOUT_INFORMATION_EX *pdlix =
> + reinterpret_cast<DRIVE_LAYOUT_INFORMATION_EX *>(ioctl_buf);
> + part_cnt = pdlix->PartitionCount;
> + pix = pdlix->PartitionEntry;
> + }
> + else if (DeviceIoControl (devhdl, IOCTL_DISK_GET_DRIVE_LAYOUT, nullptr,
Do we really still need IOCTL_DISK_GET_DRIVE_LAYOUT w/o _EX?
fhandler_proc still uses it, too, but the EX variation is available
since XP. I can't imagine that a fallback to the non-EX-version is still
necessary. If you like you could drop it immediately, or we can drop
both usages as a followup patch.
Last, but not least, do you see a chance to add any other /dev/disk
subdir? by-partuuid, perhaps?
Thanks,
Corinna
next prev parent reply other threads:[~2023-11-04 20:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 11:57 Christian Franke
2023-10-03 12:39 ` Christian Franke
2023-11-03 9:55 ` Corinna Vinschen
2023-11-03 10:09 ` Corinna Vinschen
2023-11-03 11:06 ` Christian Franke
2023-11-03 11:11 ` Corinna Vinschen
2023-11-03 11:10 ` Corinna Vinschen
2023-11-03 13:27 ` Corinna Vinschen
2023-11-03 16:09 ` Christian Franke
2023-11-03 16:27 ` Corinna Vinschen
2023-11-03 16:30 ` Corinna Vinschen
2023-11-03 17:54 ` Christian Franke
2023-11-04 9:34 ` Corinna Vinschen
2023-11-04 9:57 ` Corinna Vinschen
2023-11-04 11:34 ` Christian Franke
2023-11-04 15:53 ` Christian Franke
2023-11-04 20:51 ` Corinna Vinschen [this message]
2023-11-05 15:45 ` Christian Franke
2023-11-05 19:59 ` Corinna Vinschen
2023-11-07 10:10 ` Christian Franke
2023-11-07 13:29 ` Corinna Vinschen
2023-11-07 14:30 ` Christian Franke
2023-11-07 15:23 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZUautCVKk4bXD4q4@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).