add physical_block_size field where applicable
only scsi_disk checks the actual value, other drivers take the logical block size. This change reports the physical block size from the disk rather than the block size used by IDE/SATA/SCSI commands. On typical modern SATA disks, the SATA commands will use 512 byte blocks, but the disk will actually read and write 4K blocks internally. This is only of importance for partition alignment for DriveSetup, and is independant of file systems or partitioning systems. This could also influence the recommended block size for some file systems. Change-Id: Id0f2e22659e89fcef64c1f8d04f81cd68995e01f Reviewed-on: https://review.haiku-os.org/c/haiku/+/5667 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
285fe6257a
commit
688acf41a3
@@ -144,6 +144,7 @@ typedef struct {
|
||||
bool removable; /* non-zero if removable */
|
||||
bool read_only; /* non-zero if read only */
|
||||
bool write_once; /* non-zero if write-once */
|
||||
uint32 bytes_per_physical_sector; /* physical sector size in bytes */
|
||||
} device_geometry;
|
||||
|
||||
|
||||
@@ -174,6 +175,7 @@ typedef struct {
|
||||
off_t offset; /* offset (in bytes) */
|
||||
off_t size; /* size (in bytes) */
|
||||
int32 logical_block_size; /* logical block size of partition */
|
||||
int32 physical_block_size; /* physical block size of partition */
|
||||
int32 session; /* id of session */
|
||||
int32 partition; /* id of partition */
|
||||
char device[256]; /* path to the physical device */
|
||||
|
||||
@@ -130,6 +130,7 @@ typedef struct {
|
||||
bool removable; /* non-zero if removable */
|
||||
bool read_only; /* non-zero if read only */
|
||||
bool write_once; /* non-zero if write-once */
|
||||
uint32 bytes_per_physical_sector; /* physical sector size in bytes */
|
||||
} device_geometry;
|
||||
|
||||
enum {
|
||||
@@ -151,6 +152,7 @@ typedef struct {
|
||||
off_t offset; /* offset (in bytes) */
|
||||
off_t size; /* size (in bytes) */
|
||||
int32 logical_block_size; /* logical block size of partition */
|
||||
int32 physical_block_size; /* physical block size of partition */
|
||||
int32 session; /* id of session */
|
||||
int32 partition; /* id of partition */
|
||||
char device[256]; /* path to the physical device */
|
||||
|
||||
@@ -25,6 +25,7 @@ typedef struct partition_data {
|
||||
off_t size;
|
||||
off_t content_size;
|
||||
uint32 block_size;
|
||||
uint32 physical_block_size;
|
||||
int32 child_count;
|
||||
int32 index; // [sys]
|
||||
uint32 status;
|
||||
|
||||
@@ -63,7 +63,7 @@ typedef struct scsi_periph_callbacks {
|
||||
// informs of new size of medium
|
||||
// (set to NULL if not a block device)
|
||||
void (*set_capacity)(periph_device_cookie cookie, uint64 capacity,
|
||||
uint32 blockSize);
|
||||
uint32 blockSize, uint32 physicalBlockSize);
|
||||
|
||||
// *** removable devices
|
||||
// called when media got changed (can be NULL if medium is not changable)
|
||||
|
||||
@@ -70,6 +70,9 @@ public:
|
||||
void SetBlockSize(uint32 blockSize);
|
||||
uint32 BlockSize() const;
|
||||
|
||||
void SetPhysicalBlockSize(uint32 blockSize);
|
||||
uint32 PhysicalBlockSize() const;
|
||||
|
||||
void SetIndex(int32 index);
|
||||
int32 Index() const; // 0 for devices
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
off_t Size() const;
|
||||
off_t ContentSize() const; // 0 if uninitialized
|
||||
uint32 BlockSize() const;
|
||||
uint32 PhysicalBlockSize() const;
|
||||
int32 Index() const; // 0 for devices
|
||||
uint32 Status() const;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ struct user_partition_data {
|
||||
off_t size;
|
||||
off_t content_size;
|
||||
uint32 block_size;
|
||||
uint32 physical_block_size;
|
||||
uint32 status;
|
||||
uint32 flags;
|
||||
dev_t volume;
|
||||
|
||||
Reference in New Issue
Block a user