NTFS: Fixed an issue with seek and read calls
Use B_GET_PARTITION_INFO and B_GET_GEOMETRY instead of libntfs' home-brewn device size detection. This avoids KDL in AHCI module. By the way the mentioned problem with seek a should be investigated separately - it looks like a bug in AHCI module.
This commit is contained in:
@@ -67,6 +67,9 @@
|
||||
#ifdef HAVE_LINUX_HDREG_H
|
||||
#include <linux/hdreg.h>
|
||||
#endif
|
||||
#ifdef __HAIKU__
|
||||
#include <Drivers.h>
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "mst.h"
|
||||
@@ -589,6 +592,24 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size)
|
||||
return blocks * sector_size / block_size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef __HAIKU__
|
||||
{
|
||||
off_t size = 0;
|
||||
|
||||
partition_info partitionInfo;
|
||||
device_geometry geometry;
|
||||
|
||||
if (dev->d_ops->ioctl(dev, B_GET_PARTITION_INFO, &partitionInfo) == 0)
|
||||
size = partitionInfo.size;
|
||||
else if (dev->d_ops->ioctl(dev, B_GET_GEOMETRY, &geometry) == 0) {
|
||||
size = (off_t)geometry.cylinder_count * geometry.sectors_per_track
|
||||
* geometry.head_count * geometry.bytes_per_sector;
|
||||
}
|
||||
|
||||
if (size > 0)
|
||||
return (s64)size / block_size;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* We couldn't figure it out by using a specialized ioctl,
|
||||
|
||||
Reference in New Issue
Block a user