summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-03-18 08:47:43 (GMT)
committerJeff Garzik <jeff@garzik.org>2008-03-25 02:09:12 (GMT)
commitaacda37538e7f9cf2148eedf3766239829e51ba4 (patch)
tree0206d2db8ce636aadabf8e3effd1ee3114ccff2a /include
parentcc7feea39bed2951cc29af3ad642f39a99dfe8d3 (diff)
downloadlinux-aacda37538e7f9cf2148eedf3766239829e51ba4.tar.xz
libata: implement ata_qc_raw_nbytes()
Implement ata_qc_raw_nbytes() which determines the raw user-requested size of a PC command. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/libata.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index a05f600..269cdba 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -463,6 +463,7 @@ struct ata_queued_cmd {
unsigned int sect_size;
unsigned int nbytes;
+ unsigned int extrabytes;
unsigned int curbytes;
struct scatterlist *cursg;
@@ -1336,6 +1337,11 @@ static inline struct ata_queued_cmd *ata_qc_from_tag(struct ata_port *ap,
return NULL;
}
+static inline unsigned int ata_qc_raw_nbytes(struct ata_queued_cmd *qc)
+{
+ return qc->nbytes - min(qc->extrabytes, qc->nbytes);
+}
+
static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
{
memset(tf, 0, sizeof(*tf));
@@ -1354,7 +1360,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
qc->flags = 0;
qc->cursg = NULL;
qc->cursg_ofs = 0;
- qc->nbytes = qc->curbytes = 0;
+ qc->nbytes = qc->extrabytes = qc->curbytes = 0;
qc->n_elem = 0;
qc->err_mask = 0;
qc->sect_size = ATA_SECT_SIZE;