summaryrefslogtreecommitdiff
path: root/kernel/virtio_disk.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2019-07-17 05:53:47 -0400
committerFrans Kaashoek <[email protected]>2019-07-17 05:53:47 -0400
commitb924e44f06c9c0882a2cffe6c9215b12c5aee2e6 (patch)
treeb1204b01142d7a5b41988b87a4c06b0aabe8b5c9 /kernel/virtio_disk.c
parentce53416f4970ebb137c8e66dc75488cfefaf084d (diff)
parentebc39372096280a4a5957d3e3836c859e5d78a79 (diff)
downloadxv6-labs-b924e44f06c9c0882a2cffe6c9215b12c5aee2e6.tar.gz
xv6-labs-b924e44f06c9c0882a2cffe6c9215b12c5aee2e6.tar.bz2
xv6-labs-b924e44f06c9c0882a2cffe6c9215b12c5aee2e6.zip
Merge branch 'riscv' of g.csail.mit.edu:xv6-dev into riscv
Diffstat (limited to 'kernel/virtio_disk.c')
-rw-r--r--kernel/virtio_disk.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/virtio_disk.c b/kernel/virtio_disk.c
index 8637b56..1a29ce7 100644
--- a/kernel/virtio_disk.c
+++ b/kernel/virtio_disk.c
@@ -20,7 +20,7 @@
// the address of virtio mmio register r.
#define R(r) ((volatile uint32 *)(VIRTIO0 + (r)))
-struct spinlock virtio_disk_lock;
+struct spinlock vdisk_lock;
// memory for virtio descriptors &c for queue 0.
// this is a global instead of allocated because it has
@@ -49,7 +49,7 @@ virtio_disk_init(void)
{
uint32 status = 0;
- initlock(&virtio_disk_lock, "virtio_disk");
+ initlock(&vdisk_lock, "virtio_disk");
if(*R(VIRTIO_MMIO_MAGIC_VALUE) != 0x74726976 ||
*R(VIRTIO_MMIO_VERSION) != 1 ||
@@ -168,7 +168,7 @@ virtio_disk_rw(struct buf *b)
{
uint64 sector = b->blockno * (BSIZE / 512);
- acquire(&virtio_disk_lock);
+ acquire(&vdisk_lock);
// the spec says that legacy block operations use three
// descriptors: one for type/reserved/sector, one for
@@ -180,7 +180,7 @@ virtio_disk_rw(struct buf *b)
if(alloc3_desc(idx) == 0) {
break;
}
- sleep(&free[0], &virtio_disk_lock);
+ sleep(&free[0], &vdisk_lock);
}
// format the three descriptors.
@@ -234,16 +234,16 @@ virtio_disk_rw(struct buf *b)
// Wait for virtio_disk_intr() to say request has finished.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
- sleep(b, &virtio_disk_lock);
+ sleep(b, &vdisk_lock);
}
- release(&virtio_disk_lock);
+ release(&vdisk_lock);
}
void
virtio_disk_intr()
{
- acquire(&virtio_disk_lock);
+ acquire(&vdisk_lock);
while((used_idx % NUM) != (used->id % NUM)){
int id = used->elems[used_idx].id;
@@ -262,5 +262,5 @@ virtio_disk_intr()
used_idx = (used_idx + 1) % NUM;
}
- release(&virtio_disk_lock);
+ release(&vdisk_lock);
}