Block protocol: use own [RW]_BIT definitions

The original R_BIT and W_BIT definitions have nothing to do with the
way these bits are used. Their distinct usage is more apparent when
they have different names.

Change-Id: Ia984457f900078b2e3502ceed565fead4e5bb965
This commit is contained in:
David van Moolenbroek
2013-07-27 00:49:49 +02:00
committed by Lionel Sambuc
parent 3fb735cc74
commit 113635b019
11 changed files with 21 additions and 12 deletions

View File

@@ -2497,7 +2497,7 @@ static int ahci_open(devminor_t minor, int access)
return ENXIO;
/* Some devices may only be opened in read-only mode. */
if ((ps->flags & FLAG_READONLY) && (access & W_BIT))
if ((ps->flags & FLAG_READONLY) && (access & BDEV_W_BIT))
return EACCES;
if (ps->open_count == 0) {

View File

@@ -622,7 +622,7 @@ static int w_do_open(devminor_t minor, int access)
}
#if ENABLE_ATAPI
if ((wn->state & ATAPI) && (access & W_BIT))
if ((wn->state & ATAPI) && (access & BDEV_W_BIT))
return(EACCES);
#endif

View File

@@ -92,7 +92,7 @@ do_read(endpoint_t driver_endpt, uint8_t *buf, size_t bufsize)
/* Open Device - required for drivers using libblockdriver */
memset(&m, '\0', sizeof(message));
m.m_type = BDEV_OPEN;
m.BDEV_ACCESS = R_BIT;
m.BDEV_ACCESS = BDEV_R_BIT;
m.BDEV_ID = 0;
m.BDEV_MINOR = 0;

View File

@@ -31,7 +31,7 @@ static int driver_open(int which)
memset(&msg, 0, sizeof(msg));
msg.m_type = BDEV_OPEN;
msg.BDEV_MINOR = driver[which].minor;
msg.BDEV_ACCESS = R_BIT | W_BIT;
msg.BDEV_ACCESS = BDEV_R_BIT | BDEV_W_BIT;
msg.BDEV_ID = 0;
r = sendrec(driver[which].endpt, &msg);

View File

@@ -124,7 +124,8 @@ virtio_blk_open(devminor_t minor, int access)
return ENXIO;
/* Read only devices should only be mounted... read-only */
if ((access & W_BIT) && virtio_host_supports(blk_dev, VIRTIO_BLK_F_RO))
if ((access & BDEV_W_BIT) &&
virtio_host_supports(blk_dev, VIRTIO_BLK_F_RO))
return EACCES;
/* Partition magic when opened the first time or re-opened after