projects
/
lwext4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
10f7a67
)
Try using DISK_GEOMETRY_EX instead of plain DISK_GEOMETRY so that the disk size is...
author
Carl Hetherington
<cth@carlh.net>
Sun, 12 Apr 2020 21:18:16 +0000
(23:18 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Sun, 12 Apr 2020 21:22:25 +0000
(23:22 +0200)
blockdev/windows/file_windows.c
patch
|
blob
|
history
diff --git
a/blockdev/windows/file_windows.c
b/blockdev/windows/file_windows.c
index 291fc114015956ceae94ede58040576ff388ef7f..45588e3af6085455c9b7ab7aeb5a9f394debd4a4 100644
(file)
--- a/
blockdev/windows/file_windows.c
+++ b/
blockdev/windows/file_windows.c
@@
-67,7
+67,7
@@
EXT4_BLOCKDEV_STATIC_INSTANCE(_filedev, EXT4_IORAW_BSIZE, 0, file_open,
static int file_open(struct ext4_blockdev *bdev)
{
char path[64];
static int file_open(struct ext4_blockdev *bdev)
{
char path[64];
- DISK_GEOMETRY pdg;
+ DISK_GEOMETRY
_EX
pdg;
uint64_t disk_size;
BOOL bResult = FALSE;
DWORD junk;
uint64_t disk_size;
BOOL bResult = FALSE;
DWORD junk;
@@
-84,7
+84,7
@@
static int file_open(struct ext4_blockdev *bdev)
}
bResult =
}
bResult =
- DeviceIoControl(dev_file, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0,
+ DeviceIoControl(dev_file, IOCTL_DISK_GET_DRIVE_GEOMETRY
_EX
, NULL, 0,
&pdg, sizeof(pdg), &junk, (LPOVERLAPPED)NULL);
if (bResult == FALSE) {
&pdg, sizeof(pdg), &junk, (LPOVERLAPPED)NULL);
if (bResult == FALSE) {
@@
-92,19
+92,16
@@
static int file_open(struct ext4_blockdev *bdev)
return EIO;
}
return EIO;
}
- _filedev.bdif->ph_bsize = pdg.BytesPerSector;
+ _filedev.bdif->ph_bsize = pdg.
Geometry.
BytesPerSector;
if (part_size == 0) {
/* whole disk */
if (part_size == 0) {
/* whole disk */
- disk_size = pdg.Cylinders.QuadPart * (ULONG)pdg.TracksPerCylinder *
- (ULONG)pdg.SectorsPerTrack * (ULONG)pdg.BytesPerSector;
-
- _filedev.bdif->ph_bcnt = disk_size / pdg.BytesPerSector;
+ _filedev.bdif->ph_bcnt = pdg.DiskSize.QuadPart / pdg.Geometry.BytesPerSector;
_filedev.part_offset = 0;
_filedev.part_offset = 0;
- _filedev.part_size =
disk_size
;
+ _filedev.part_size =
pdg.DiskSize.QuadPart
;
} else {
/* specified partition */
} else {
/* specified partition */
- _filedev.bdif->ph_bcnt = part_size / pdg.BytesPerSector;
+ _filedev.bdif->ph_bcnt = part_size / pdg.
Geometry.
BytesPerSector;
_filedev.part_offset = part_offset;
_filedev.part_size = part_size;
}
_filedev.part_offset = part_offset;
_filedev.part_size = part_size;
}