diff options
Diffstat (limited to 'kernel/drivers/scsi/sd.h')
-rw-r--r-- | kernel/drivers/scsi/sd.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/drivers/scsi/sd.h b/kernel/drivers/scsi/sd.h index 5f2a84aff..765a6f1ac 100644 --- a/kernel/drivers/scsi/sd.h +++ b/kernel/drivers/scsi/sd.h @@ -65,7 +65,7 @@ struct scsi_disk { struct device dev; struct gendisk *disk; atomic_t openers; - sector_t capacity; /* size in 512-byte sectors */ + sector_t capacity; /* size in logical blocks */ u32 max_xfer_blocks; u32 opt_xfer_blocks; u32 max_ws_blocks; @@ -146,6 +146,16 @@ static inline int scsi_medium_access_command(struct scsi_cmnd *scmd) return 0; } +static inline sector_t logical_to_sectors(struct scsi_device *sdev, sector_t blocks) +{ + return blocks << (ilog2(sdev->sector_size) - 9); +} + +static inline unsigned int logical_to_bytes(struct scsi_device *sdev, sector_t blocks) +{ + return blocks * sdev->sector_size; +} + /* * A DIF-capable target device can be formatted with different * protection schemes. Currently 0 through 3 are defined: |