From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) by sourceware.org (Postfix) with ESMTPS id D7663389ECAA for ; Tue, 17 Aug 2021 13:51:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D7663389ECAA Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MRSdf-1mU3yg0hm9-00NPXP for ; Tue, 17 Aug 2021 15:51:55 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id 76E8DA80DC5; Tue, 17 Aug 2021 15:51:54 +0200 (CEST) Date: Tue, 17 Aug 2021 15:51:54 +0200 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Duplicates in /proc/partitions Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <9a770c83-62ef-6849-16e7-e6956f4d2fab@SystematicSw.ab.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:DhSGUgZzzTRFCO488ulRPAej4Vd3Dy5PJUIOf1M+HM+bvLvoNvi PH1VXXE9V8gtfUCOVnLcjHHYjeDyUHCOw2f5JRhZb5ZW421S9n9CIqsMrlcvPJ56N3XsYfI zkhAyl4pxYwgIEj1SirxzCo6OtNcqnO+XkcLsd3ih6rwkUu9LgW1BCKBvHW7wvCuhfEe6eE l64cH7yz2Z6LrYv5FfNSQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:ioXC3g/jLvo=:jhPGEhVFkmECNbJI2cBtlk +8JPxEofRvGG3yfeor75YV1QY9JGSjgKrp/YfGVRGX7Lcc+xHPP0tlvE6GHb4e0vNXMtOcGs2 Jg04M0D5ySrlT2t3hk0eP7BIm0W6uGDBXQYtY9aJmdS8139u7MkLPdfnBMhmHt1PAHMMQvTDN CHAk8BckJ5u0LaWBGSBVZYVcvbV3HSbNa/DzjzR1A1e0vRG8prXtbBXw97mC38kIZA53x4vXh caXfSo8v+aWCdb00h88vtzllXFwcIILJeUcBu2MypKJlTj1aSIAIan1oYL3u21AtOWG1x3c7/ SQ15pInYCsiaD30i66ZZhN+xwZMaPWqNUETAMo4q9fug7PPLALiVMdjz0/YhICkctRfvOQ51g kLMFshJx7RGRHFSf+/yBr5n4VyV9U/UYFIW36ZUVSHf+0MFC/sYYMGEGvxp5WBlXVtnotFcyY upS2eCM2yJM7hPKgPypTXkrJcukbpSydHTV4ZZBldnV6BxlTi4tSfuQh4A7wfvlW647C2WWvg NqBcuHszALFgNBqNhLHqHYQeV083Ljjj9LdzUFEuZsok35rmWyc8XXEql+tQLuNrS5TWU409S 0j4yczcoECtzQewZFfSFrR5PwJFyJKD6p/h/ouLbeo3lnlPA1p7Hsp2job7261NovuqqI8+8P Mb9HhgZEp6Pgz+jyFqecmEgPRfhpbM8GbffHFCwxKqOHXlZv7IV/QZrmwO2nhEi7DpMAYZFAq /6ussjQiNjS3OtE4sweogX/LCdb3zE+n9gOElw4UzADdtxkXhtzePPDXoxiFyjYXXG7Ncou8I zEfomfC2+S0nUJWWjviwMPxHQO+EMHIa/pUn8l9aXlHNo+TrAA8cwe1wN/IFGrZnYWiINucsh N2saOQDH9zAiDYEQ4XpQ== X-Spam-Status: No, score=-99.9 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 13:51:58 -0000 On Aug 17 12:57, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote: > > $ gcc -g -O2 -o proc_partition_O2 proc_partition.c -lntdll > > I ran the program (without gdb yet, can't doit right away)... Its > output is a bit different from /proc/partitions (w.r.t. drive names), Yes, it's just faked in the most dirt-simple way. I added a comment to the code to outline why that is. > but I still see the duplicates: Great! That means it should be pretty straightforward to see why the problem occurs by stepping through the code. For a start I'd suggest to set a breakpoint to line 103, that's the first DeviceIoControl call. That line is only reached for actual disks when looping over the native \Device directory. On second thought, I have a vague idea... Could you please just add something to the output, i.e, change lines 124/125 from printf ("%5d %5d %9llu sd%c\n", 8, (dev_name - 'a') * 16, size >> 10, dev_name); to printf ("%5d %5d %9llu sd%c (%lu)\n", 8, (dev_name - 'a') * 16, size >> 10, dev_name, (unsigned long) context); and just compile and run the testcase again? Thanks, Corinna