* fhandler_proc.cc (format_proc_partitions): Use new device code

to get major and minor device numbers.  Fix size evaluation.
This commit is contained in:
Corinna Vinschen 2003-10-23 08:54:00 +00:00
parent a3f95116e3
commit f49c14a197
2 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2003-10-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (format_proc_partitions): Use new device code
to get major and minor device numbers. Fix size evaluation.
2003-10-22 Corinna Vinschen <corinna@vinschen.de>
* external.cc (cygwin_internal): Add CW_GET_ERRNO_FROM_WINERROR

View File

@ -898,12 +898,16 @@ format_proc_partitions (char *destbuf, size_t maxsize)
debug_printf ("DeviceIoControl %E");
else
{
bufptr += __small_sprintf (bufptr, "%5d %5d %9U sd%c\n",
FH_FLOPPY,
drive_number * 16 + 32,
char devname[16];
__small_sprintf (devname, "/dev/sd%c", drive_number + 'a');
device dev;
dev.parse (devname);
bufptr += __small_sprintf (bufptr, "%5d %5d %9U %s\n",
dev.major,
dev.minor,
(long long)((dg.Cylinders.QuadPart * dg.TracksPerCylinder *
dg.SectorsPerTrack * dg.BytesPerSector) >> 6),
drive_number + 'a');
dg.SectorsPerTrack * dg.BytesPerSector) >> 10),
devname + 5);
}
while (dwRetCode = DeviceIoControl (hDevice,
IOCTL_DISK_GET_DRIVE_LAYOUT,
@ -924,12 +928,16 @@ format_proc_partitions (char *destbuf, size_t maxsize)
{
if (dli->PartitionEntry[partition].PartitionLength.QuadPart == 0)
continue;
bufptr += __small_sprintf (bufptr, "%5d %5d %9U sd%c%d\n",
FH_FLOPPY,
drive_number * 16 + partition + 33,
(long long)(dli->PartitionEntry[partition].PartitionLength.QuadPart >> 6),
drive_number + 'a',
partition + 1);
char devname[16];
__small_sprintf (devname, "/dev/sd%c%d",
drive_number + 'a',
partition + 1);
device dev;
dev.parse (devname);
bufptr += __small_sprintf (bufptr, "%5d %5d %9U %s\n",
dev.major, dev.minor,
(long long)(dli->PartitionEntry[partition].PartitionLength.QuadPart >> 10),
devname + 5);
}
}