From b2867a68b9f94402e2afba49de978d9e8f9abaeb Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
Date: Thu, 23 Jun 2016 16:56:41 +0200
Subject: Handle up to 63 partitions per drive

Revamp device parsing code.  Introducing support for more partitions
into the shilka-generated parser has the unfortunate side-effect of
raising the size of the DLL by almost 2 Megs.  Therefore we split out
the handling for /dev/sdXY devices into a tiny bit of hand-written
code.

While at it, remove some unused cruft from devices.* and generally
clean up the device class to provide access methods instead of direct
access to members.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
---
 winsup/cygwin/fhandler_floppy.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'winsup/cygwin/fhandler_floppy.cc')

diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
index 15b727b..8c9ef9d 100644
--- a/winsup/cygwin/fhandler_floppy.cc
+++ b/winsup/cygwin/fhandler_floppy.cc
@@ -159,8 +159,9 @@ fhandler_dev_floppy::lock_partition (DWORD to_write)
   /* The simple case.  We have only a single partition open anyway.
      Try to lock the partition so that a subsequent write succeeds.
      If there's some file handle open on one of the affected partitions,
-     this fails, but that's how it works on Vista and later... */
-  if (get_minor () % 16 != 0)
+     this fails, but that's how it works on Vista and later...
+     Only DEV_SD7_MAJOR and less can point to partition 0. */
+  if (get_major () <= DEV_SD7_MAJOR && get_minor () % 16 != 0)
     {
       if (!DeviceIoControl (get_handle (), FSCTL_LOCK_VOLUME,
 			   NULL, 0, NULL, 0, &bytes_read, NULL))
-- 
cgit v1.1