if (m.m_type != BDEV_REPLY)
panic("invalid reply from driver (%d)\n", m.m_type);
- return m.BDEV_STATUS;
+ return m.m_lblockdriver_lbdev_reply.status;
}
/*===========================================================================*
if (m.m_type != BDEV_REPLY)
panic("invalid reply from driver (%d)\n", m.m_type);
- return m.BDEV_STATUS;
+ return m.m_lblockdriver_lbdev_reply.status;
}
/*===========================================================================*
cpf_revoke(gid);
- return m.BDEV_STATUS;
+ return m.m_lblockdriver_lbdev_reply.status;
}
/*===========================================================================*
for (i = 0; i < count; i++)
cpf_revoke(iovec[i].iov_grant);
- return m.BDEV_STATUS;
+ return m.m_lblockdriver_lbdev_reply.status;
}
/*===========================================================================*
rule_io_hook(ptr, size, position, FBD_FLAG_READ);
/* Upon success, copy back whatever has been processed. */
- rsize = m.BDEV_STATUS;
+ rsize = m.m_lblockdriver_lbdev_reply.status;
for (i = j = off = 0; rsize > 0 && i < count; i++) {
len = MIN(rsize, iov[i].iov_size);
if (ptr != fbd_buf)
free_contig(ptr, size);
- return m.BDEV_STATUS;
+ return m.m_lblockdriver_lbdev_reply.status;
}
/*===========================================================================*
return RET_REDO;
}
- if(msg.m_type != BDEV_REPLY || msg.BDEV_STATUS != OK) {
+ if(msg.m_type != BDEV_REPLY ||
+ msg.m_lblockdriver_lbdev_reply.status != OK) {
printf("Filter: driver_open: ipc_sendrec returned %d, %d\n",
- msg.m_type, msg.BDEV_STATUS);
+ msg.m_type, msg.m_lblockdriver_lbdev_reply.status);
return RET_REDO;
}
cpf_revoke(gid);
- if (r != OK || msg.m_type != BDEV_REPLY || msg.BDEV_STATUS != OK) {
+ if (r != OK || msg.m_type != BDEV_REPLY ||
+ msg.m_lblockdriver_lbdev_reply.status != OK) {
/* Not sure what to do here, either. */
printf("Filter: ioctl(DIOCGETP) returned (%d, %d)\n",
r, msg.m_type);
return RET_REDO;
}
- if(msg.m_type != BDEV_REPLY || msg.BDEV_STATUS != OK) {
+ if(msg.m_type != BDEV_REPLY ||
+ msg.m_lblockdriver_lbdev_reply.status != OK) {
printf("Filter: driver_close: ipc_sendrec returned %d, %d\n",
- msg.m_type, msg.BDEV_STATUS);
+ msg.m_type, msg.m_lblockdriver_lbdev_reply.status);
return RET_REDO;
}
return r;
}
- if (m1.m_type != BDEV_REPLY || m1.BDEV_STATUS < 0) {
+ if (m1.m_type != BDEV_REPLY ||
+ m1.m_lblockdriver_lbdev_reply.status < 0) {
printf("Filter: unexpected/invalid reply from main driver: "
- "(%x, %d)\n", m1.m_type, m1.BDEV_STATUS);
+ "(%x, %d)\n", m1.m_type,
+ m1.m_lblockdriver_lbdev_reply.status);
return bad_driver(DRIVER_MAIN, BD_PROTO,
- (m1.m_type == BDEV_REPLY) ? m1.BDEV_STATUS : EFAULT);
+ (m1.m_type == BDEV_REPLY) ?
+ m1.m_lblockdriver_lbdev_reply.status : EFAULT);
}
- if (m1.BDEV_STATUS != (ssize_t) *sizep) {
+ if (m1.m_lblockdriver_lbdev_reply.status != (ssize_t) *sizep) {
printf("Filter: truncated reply from main driver\n");
/* If the driver returned a value *larger* than we requested,
* OR if we did NOT exceed the disk size, then we should
* report the driver for acting strangely!
*/
- if (m1.BDEV_STATUS > (ssize_t) *sizep ||
- (pos + (unsigned int) m1.BDEV_STATUS < disk_size))
+ if (m1.m_lblockdriver_lbdev_reply.status > (ssize_t) *sizep ||
+ (pos + (unsigned int)
+ m1.m_lblockdriver_lbdev_reply.status < disk_size))
return bad_driver(DRIVER_MAIN, BD_PROTO, EFAULT);
/* Return the actual size. */
- *sizep = m1.BDEV_STATUS;
+ *sizep = m1.m_lblockdriver_lbdev_reply.status;
}
if (both) {
- if (m2.m_type != BDEV_REPLY || m2.BDEV_STATUS < 0) {
+ if (m2.m_type != BDEV_REPLY ||
+ m2.m_lblockdriver_lbdev_reply.status < 0) {
printf("Filter: unexpected/invalid reply from "
"backup driver (%x, %d)\n",
- m2.m_type, m2.BDEV_STATUS);
+ m2.m_type,
+ m2.m_lblockdriver_lbdev_reply.status);
return bad_driver(DRIVER_BACKUP, BD_PROTO,
- m2.m_type == BDEV_REPLY ? m2.BDEV_STATUS :
+ m2.m_type == BDEV_REPLY ?
+ m2.m_lblockdriver_lbdev_reply.status :
EFAULT);
}
- if (m2.BDEV_STATUS != (ssize_t) *sizep) {
+ if (m2.m_lblockdriver_lbdev_reply.status != (ssize_t) *sizep) {
printf("Filter: truncated reply from backup driver\n");
/* As above */
- if (m2.BDEV_STATUS > (ssize_t) *sizep ||
- (pos + (unsigned int) m2.BDEV_STATUS <
- disk_size))
+ if (m2.m_lblockdriver_lbdev_reply.status > (ssize_t) *sizep ||
+ (pos + (unsigned int)
+ m2.m_lblockdriver_lbdev_reply.status
+ < disk_size))
return bad_driver(DRIVER_BACKUP, BD_PROTO,
EFAULT);
/* Return the actual size. */
- if ((ssize_t) *sizep >= m2.BDEV_STATUS)
- *sizep = m2.BDEV_STATUS;
+ if ((ssize_t)*sizep >= m2.m_lblockdriver_lbdev_reply.status)
+ *sizep = m2.m_lblockdriver_lbdev_reply.status;
}
}
/* Field names for block device messages. */
#define BDEV_MINOR m10_i1 /* minor device number */
-#define BDEV_STATUS m10_i1 /* OK or error code */
#define BDEV_ACCESS m10_i2 /* access bits for open requests */
#define BDEV_COUNT m10_i2 /* number of bytes or elements in transfer */
#define BDEV_GRANT m10_i3 /* grant ID of buffer or vector */
} mess_lsys_krn_readbios;
_ASSERT_MSG_SIZE(mess_lsys_krn_readbios);
+typedef struct {
+ int status;
+ int id;
+
+ uint8_t padding[48];
+} mess_lblockdriver_lbdev_reply;
+_ASSERT_MSG_SIZE(mess_lblockdriver_lbdev_reply);
+
typedef struct {
int action;
int freq;
mess_notify m_notify;
mess_sigcalls m_sigcalls;
+ mess_lblockdriver_lbdev_reply m_lblockdriver_lbdev_reply;
mess_lc_pm_cprof m_lc_pm_cprof;
mess_lc_pm_sprof m_lc_pm_sprof;
mess_lsys_krn_sys_diagctl m_lsys_krn_sys_diagctl;
/* The protocol contract states that no asynchronous reply can satisfy a
* synchronous SENDREC call, so we can never get an asynchronous reply here.
*/
- if (m.BDEV_ID != NO_ID) {
- printf("bdev: driver (%d) sent invalid ID (%ld)\n", endpt, m.BDEV_ID);
+ if (m.m_lblockdriver_lbdev_reply.id != NO_ID) {
+ printf("bdev: driver (%d) sent invalid ID (%d)\n", endpt,
+ m.m_lblockdriver_lbdev_reply.id);
return EINVAL;
}
* device, and then resend the request. If the call keeps failing, the caller
* will eventually give up.
*/
- if (m.BDEV_STATUS == ERESTART) {
+ if (m.m_lblockdriver_lbdev_reply.status == ERESTART) {
printf("bdev: got ERESTART from driver (%d), sleeping for reopen\n",
endpt);
}
/* Return the result of our request. */
- return m.BDEV_STATUS;
+ return m.m_lblockdriver_lbdev_reply.status;
}
static int bdev_receive(dev_t dev, message *m)
assert(m->m_type == BDEV_REPLY);
/* Get the corresponding asynchronous call structure. */
- id = m->BDEV_ID;
+ id = m->m_lblockdriver_lbdev_reply.id;
if ((call = bdev_call_get(id)) == NULL) {
- printf("bdev: driver (%d) replied to unknown request (%ld)\n",
- m->m_source, m->BDEV_ID);
+ printf("bdev: driver (%d) replied to unknown request (%d)\n",
+ m->m_source, m->m_lblockdriver_lbdev_reply.id);
return;
}
}
/* See the ERESTART comment in bdev_sendrec(). */
- if (m->BDEV_STATUS == ERESTART) {
+ if (m->m_lblockdriver_lbdev_reply.status == ERESTART) {
printf("bdev: got ERESTART from driver (%d), sleeping for reopen\n",
endpt);
return;
}
- bdev_callback_asyn(call, m->BDEV_STATUS);
+ bdev_callback_asyn(call, m->m_lblockdriver_lbdev_reply.status);
}
int bdev_wait_asyn(bdev_id_t id)
return EINVAL;
}
- if (m.BDEV_ID != NO_ID) {
+ if (m.m_lblockdriver_lbdev_reply.id != NO_ID) {
printf("bdev: driver (%d) sent invalid ID (%ld)\n",
- endpt, m.BDEV_ID);
+ endpt, m.m_lblockdriver_lbdev_reply.id);
return EINVAL;
}
- if ((r = m.BDEV_STATUS) != OK) {
+ if ((r = m.m_lblockdriver_lbdev_reply.status) != OK) {
printf("bdev: driver (%d) failed device reopen (%d)\n",
endpt, r);
return r;
memset(&m_reply, 0, sizeof(m_reply));
m_reply.m_type = BDEV_REPLY;
- m_reply.BDEV_STATUS = reply;
- m_reply.BDEV_ID = m_ptr->BDEV_ID;
+ m_reply.m_lblockdriver_lbdev_reply.status = reply;
+ m_reply.m_lblockdriver_lbdev_reply.id = m_ptr->BDEV_ID;
send_reply(m_ptr->m_source, &m_reply, ipc_status);
}
memset(&m_reply, 0, sizeof(m_reply));
m_reply.m_type = BDEV_REPLY;
- m_reply.BDEV_STATUS = ENXIO;
- m_reply.BDEV_ID = m_ptr->BDEV_ID;
+ m_reply.m_lblockdriver_lbdev_reply.status = ENXIO;
+ m_reply.m_lblockdriver_lbdev_reply.id = m_ptr->BDEV_ID;
send_reply(m_ptr->m_source, &m_reply, ipc_status);
}
if (r != OK)
return r;
- return dev_mess.BDEV_STATUS;
+ return dev_mess.m_lblockdriver_lbdev_reply.status;
}
if (r != OK)
return r;
- return dev_mess.BDEV_STATUS;
+ return dev_mess.m_lblockdriver_lbdev_reply.status;
}
if (r != OK)
return(r);
- return(dev_mess.BDEV_STATUS);
+ return(dev_mess.m_lblockdriver_lbdev_reply.status);
}
if (r != OK)
return r;
- status = mess_ptr->BDEV_STATUS;
+ status = mess_ptr->m_lblockdriver_lbdev_reply.status;
if (status == ERESTART) {
r = EDEADEPT;
*mess_ptr = mess_retry;
if (m_ptr->m_type != BDEV_REPLY)
return set_result(res, RESULT_BADTYPE, m_ptr->m_type);
- if (m_ptr->BDEV_ID != m_orig.BDEV_ID)
- return set_result(res, RESULT_BADID, m_ptr->BDEV_ID);
+ if (m_ptr->m_lblockdriver_lbdev_reply.id != m_orig.BDEV_ID)
+ return set_result(res, RESULT_BADID,
+ m_ptr->m_lblockdriver_lbdev_reply.id);
- if ((exp < 0 && m_ptr->BDEV_STATUS >= 0) ||
- (exp >= 0 && m_ptr->BDEV_STATUS < 0))
- return set_result(res, RESULT_BADSTATUS, m_ptr->BDEV_STATUS);
+ if ((exp < 0 && m_ptr->m_lblockdriver_lbdev_reply.status >= 0) ||
+ (exp >= 0 &&
+ m_ptr->m_lblockdriver_lbdev_reply.status < 0))
+ return set_result(res, RESULT_BADSTATUS,
+ m_ptr->m_lblockdriver_lbdev_reply.status);
return set_result(res, RESULT_OK, 0);
}
if (r != RESULT_OK)
return;
- if (m.BDEV_STATUS == exp)
+ if (m.m_lblockdriver_lbdev_reply.status == exp)
return;
if (exp < 0)
- set_result(res, RESULT_BADSTATUS, m.BDEV_STATUS);
+ set_result(res, RESULT_BADSTATUS,
+ m.m_lblockdriver_lbdev_reply.status);
else
- set_result(res, RESULT_TRUNC, exp - m.BDEV_STATUS);
+ set_result(res, RESULT_TRUNC,
+ exp - m.m_lblockdriver_lbdev_reply.status);
}
static void vir_xfer(dev_t minor, u64_t pos, iovec_t *iovec, int nr_req,
sendrec_driver(&m, OK, &res);
- if (res.type == RESULT_OK && m.BDEV_STATUS != (ssize_t) iov.iov_size) {
+ if (res.type == RESULT_OK &&
+ m.m_lblockdriver_lbdev_reply.status != (ssize_t) iov.iov_size) {
res.type = RESULT_TRUNC;
- res.value = m.BDEV_STATUS;
+ res.value = m.m_lblockdriver_lbdev_reply.status;
}
got_result(&res, "normal request");
sendrec_driver(&m, OK, &res);
- if (res.type == RESULT_OK && m.BDEV_STATUS != (ssize_t) iov.iov_size) {
+ if (res.type == RESULT_OK &&
+ m.m_lblockdriver_lbdev_reply.status != (ssize_t) iov.iov_size) {
res.type = RESULT_TRUNC;
- res.value = m.BDEV_STATUS;
+ res.value = m.m_lblockdriver_lbdev_reply.status;
}
got_result(&res, "normal request");