Duplicates in /proc/partitions
Lavrentiev, Anton (NIH/NLM/NCBI) [C]
lavr@ncbi.nlm.nih.gov
Wed Aug 18 18:18:31 GMT 2021
> printf ("%5d %5d %9llu sd%c (%lu, %ls)\n",
> 8, (dev_name - 'a') * 16, size >> 10, dev_name,
> (unsigned long) context, dbi->ObjectName.Buffer);
I replaced with this instead (read_bytes added):
printf ("%5d %5d %9llu sd%c (%lu, %ls, %u)\n",
8, (dev_name - 'a') * 16, size >> 10, dev_name,
(unsigned long) context, dbi->ObjectName.Buffer, bytes_read);
and here's the output:
$ ./proc_partition
major minor #blocks name win-mounts
8 0 500107608 sda (282, Harddisk0, 144)
8 1 102400 sda1
8 2 488280064 sda2 C:\
8 16 1000204632 sdb (299, Harddisk1, 144)
8 17 1000202240 sdb1 D:\
8 32 1000204632 sdc (300, Harddisk1, 144)
8 33 1000202240 sdc1 D:\
8 48 1000204632 sdd (313, Harddisk2, 144)
8 49 1000202240 sdd1 G:\
8 64 1000204632 sde (314, Harddisk2, 144)
8 65 1000202240 sde1 G:\
8 80 1000204632 sdf (329, Harddisk3, 144)
8 81 1000202240 sdf1 I:\
8 96 1000204632 sdg (330, Harddisk3, 144)
8 97 1000202240 sdg1 I:\
8 112 234431064 sdh (339, Harddisk4, 144)
8 113 234428416 sdh1 F:\
8 128 234431064 sdi (340, Harddisk4, 144)
8 129 234428416 sdi1 F:\
DeviceIoControl (Harddisk5\Partition0, IOCTL_DISK_GET_PARTITION_INFO{_EX}) 5 8 144 0 sdj (352, Harddisk5, 624)
It prints the correct Harddisk names (corresponding to the duplicates), so it's consistent.
I was thinking that the "context" value seems to change just by 1 when there's a duplicate
coming out; otherwise, it jumps by more than 10, when it is really a new drive...
The directory handle is used (indirectly) in NtOpenFile() through the attributes, and
I wonder if that call somehow distorts the internal position within the handle, and so
it restarts from the wrong internal position in the outer loop.
Anton Lavrentiev
Contractor NIH/NLM/NCBI
More information about the Cygwin
mailing list