Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-07 Thread Corinna Vinschen
On Nov 7 15:30, Christian Franke wrote: > Corinna Vinschen wrote: > > .. > > Looking forward to it. We'll just need an entry for the release text > > in winsup/cygwin/release/3.5.0 and doc/new-features.xml in the end :) > > Attached for now as implementing the remaining subdirs is not yet

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-07 Thread Christian Franke
Corinna Vinschen wrote: .. Looking forward to it. We'll just need an entry for the release text in winsup/cygwin/release/3.5.0 and doc/new-features.xml in the end :) Attached for now as implementing the remaining subdirs is not yet scheduled. Docbook formatting not tested. Christian From

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-07 Thread Corinna Vinschen
On Nov 7 11:10, Christian Franke wrote: > Corinna Vinschen wrote: > > Hi Christian, > > > > On Nov 5 16:45, Christian Franke wrote: > > > ... > > > Old IOCTL dropped and code simplified. > > Great. I pushed your patch. > > Thanks. > > > > ... > > > > Last, but not least, do you see a chance

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-07 Thread Christian Franke
Corinna Vinschen wrote: Hi Christian, On Nov 5 16:45, Christian Franke wrote: ... Old IOCTL dropped and code simplified. Great. I pushed your patch. Thanks. ... Last, but not least, do you see a chance to add any other /dev/disk subdir? by-partuuid, perhaps? Possibly, but not very

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-05 Thread Corinna Vinschen
Hi Christian, On Nov 5 16:45, Christian Franke wrote: > Corinna Vinschen wrote: > > Do we really still need IOCTL_DISK_GET_DRIVE_LAYOUT w/o _EX? > > Possibly not. I borrowed this code from code behind /proc/partitions. > > > fhandler_proc still uses it, too, but the EX variation is available >

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-05 Thread Christian Franke
Hi Corinna, Corinna Vinschen wrote: 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

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-04 Thread Corinna Vinschen
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

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-04 Thread Christian Franke
Corinna Vinschen wrote: On Nov 4 10:34, Corinna Vinschen wrote: On Nov 3 18:54, Christian Franke wrote: ... Conclusion: The behavior of the current patch is compatible with Linux :-) Ok, but with the DUID we have a workaround which makes it work even better than on Linux, so it would

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-04 Thread Christian Franke
Corinna Vinschen wrote: On Nov 4 10:34, Corinna Vinschen wrote: On Nov 3 18:54, Christian Franke wrote: ... MSDN claims: If the storage device is SCSI-compliant, the port driver attempts to extract the serial number from the optional Unit Serial Number page (page 0x80) of the

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-04 Thread Corinna Vinschen
On Nov 4 10:34, Corinna Vinschen wrote: > On Nov 3 18:54, Christian Franke wrote: > > Corinna Vinschen wrote: > > > On Nov 3 17:27, Corinna Vinschen wrote: > > > > On Nov 3 17:09, Christian Franke wrote: > > > > > Unlike (S)ATA and NVMe, the serial number > > > > > is not available for free in

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-04 Thread Corinna Vinschen
On Nov 3 18:54, Christian Franke wrote: > Corinna Vinschen wrote: > > On Nov 3 17:27, Corinna Vinschen wrote: > > > On Nov 3 17:09, Christian Franke wrote: > > > > Unlike (S)ATA and NVMe, the serial number > > > > is not available for free in the device identify data block but > > > > requires

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Christian Franke
Corinna Vinschen wrote: On Nov 3 17:27, Corinna Vinschen wrote: On Nov 3 17:09, Christian Franke wrote: Unlike (S)ATA and NVMe, the serial number is not available for free in the device identify data block but requires an extra command (SCSI INQUIRY of VPD page 0x80). This might not be

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Corinna Vinschen
On Nov 3 17:27, Corinna Vinschen wrote: > On Nov 3 17:09, Christian Franke wrote: > > Unlike (S)ATA and NVMe, the serial number > > is not available for free in the device identify data block but requires an > > extra command (SCSI INQUIRY of VPD page 0x80). This might not be supported > > by

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Corinna Vinschen
On Nov 3 17:09, Christian Franke wrote: > Corinna Vinschen wrote: > > I haven't found out where the UUID is coming from, yet, but based on the > > description from > > https://learn.microsoft.com/en-us/windows-hardware/drivers/storage/device-unique-identifiers--duids--for-storage-devices > > I

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Christian Franke
Corinna Vinschen wrote: On Nov 3 12:10, Corinna Vinschen wrote: On Nov 3 11:09, Corinna Vinschen wrote: On Nov 3 10:55, Corinna Vinschen wrote: On Oct 3 14:39, Christian Franke wrote: According to NtQueryObject(., ObjectBasicInformation, ...), using NtOpenFile(., MAXIMUM_ALLOWED, ...)

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Corinna Vinschen
On Nov 3 12:10, Corinna Vinschen wrote: > On Nov 3 11:09, Corinna Vinschen wrote: > > On Nov 3 10:55, Corinna Vinschen wrote: > > > On Oct 3 14:39, Christian Franke wrote: > > > > According to NtQueryObject(., ObjectBasicInformation, ...), using > > > > NtOpenFile(., MAXIMUM_ALLOWED, ...)

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Corinna Vinschen
On Nov 3 12:06, Christian Franke wrote: > Corinna Vinschen wrote: > > > I ran this on Windows 11 and Windows 2K19 in a QEMU/KVM VM. A > > > \Device\Harddisk0\Partition0 symlink pointing to \Device\Harddisk0\DR0 > > > exists in both cases. I straced it, and found the following debug > > >

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Corinna Vinschen
On Nov 3 11:09, Corinna Vinschen wrote: > On Nov 3 10:55, Corinna Vinschen wrote: > > On Oct 3 14:39, Christian Franke wrote: > > > According to NtQueryObject(., ObjectBasicInformation, ...), using > > > NtOpenFile(., MAXIMUM_ALLOWED, ...) without admin rights sets > > > GrantedAccess > > > to

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Christian Franke
Corinna Vinschen wrote: On Nov 3 10:55, Corinna Vinschen wrote: Hi Christian, On Oct 3 14:39, Christian Franke wrote: Christian Franke wrote: This is a first attempt to partly emulate the Linux directory /dev/disk/by-id. Useful to make sure the correct device is accessed in conjunction

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Corinna Vinschen
On Nov 3 10:55, Corinna Vinschen wrote: > Hi Christian, > > On Oct 3 14:39, Christian Franke wrote: > > Christian Franke wrote: > > > This is a first attempt to partly emulate the Linux directory > > > /dev/disk/by-id. Useful to make sure the correct device is accessed in > > > conjunction with

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-11-03 Thread Corinna Vinschen
Hi Christian, On Oct 3 14:39, Christian Franke wrote: > Christian Franke wrote: > > This is a first attempt to partly emulate the Linux directory > > /dev/disk/by-id. Useful to make sure the correct device is accessed in > > conjunction with dd, ddrescue, fdisk, > > Attached is the second

Re: [PATCH] Cygwin: Add /dev/disk/by-id symlinks

2023-10-03 Thread Christian Franke
Christian Franke wrote: This is a first attempt to partly emulate the Linux directory /dev/disk/by-id. Useful to make sure the correct device is accessed in conjunction with dd, ddrescue, fdisk, Attached is the second attempt. The additional '*-partN' links to partitions are not yet