Message type for CDEV_CANCEL

Change-Id: I4a58f314e140c043392503c079e3d9b994c50b2f
This commit is contained in:
Lionel Sambuc 2014-06-06 13:19:58 +02:00
parent e7f5493031
commit 3e6f0b3e98
3 changed files with 23 additions and 6 deletions

View file

@ -1574,6 +1574,14 @@ typedef struct {
} mess_vfs_fs_utime; } mess_vfs_fs_utime;
_ASSERT_MSG_SIZE(mess_vfs_fs_utime); _ASSERT_MSG_SIZE(mess_vfs_fs_utime);
typedef struct {
endpoint_t id;
devminor_t minor;
uint8_t padding[48];
} mess_vfs_lchardriver_cancel;
_ASSERT_MSG_SIZE(mess_vfs_lchardriver_cancel);
typedef struct { typedef struct {
endpoint_t id; endpoint_t id;
endpoint_t user; endpoint_t user;
@ -1871,6 +1879,7 @@ typedef struct {
mess_vfs_lc_lseek m_vfs_lc_lseek; mess_vfs_lc_lseek m_vfs_lc_lseek;
mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel;
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose; mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
mess_vfs_utimens m_vfs_utimens; mess_vfs_utimens m_vfs_utimens;

View file

@ -246,12 +246,18 @@ static void chardriver_reply(message *mess, int ipc_status, int r)
case CDEV_READ: case CDEV_READ:
case CDEV_WRITE: case CDEV_WRITE:
case CDEV_IOCTL: case CDEV_IOCTL:
case CDEV_CANCEL: /* For cancel, this is a reply to the original request! */
reply_mess.m_type = CDEV_REPLY; reply_mess.m_type = CDEV_REPLY;
reply_mess.m_lchardriver_vfs_reply.status = r; reply_mess.m_lchardriver_vfs_reply.status = r;
reply_mess.m_lchardriver_vfs_reply.id = mess->CDEV_ID; reply_mess.m_lchardriver_vfs_reply.id = mess->CDEV_ID;
break; break;
case CDEV_CANCEL: /* For cancel, this is a reply to the original request! */
reply_mess.m_type = CDEV_REPLY;
reply_mess.m_lchardriver_vfs_reply.status = r;
reply_mess.m_lchardriver_vfs_reply.id =
mess->m_vfs_lchardriver_cancel.id;
break;
case CDEV_SELECT: case CDEV_SELECT:
reply_mess.m_type = CDEV_SEL1_REPLY; reply_mess.m_type = CDEV_SEL1_REPLY;
reply_mess.m_lchardriver_vfs_sel1.minor = mess->CDEV_MINOR; reply_mess.m_lchardriver_vfs_sel1.minor = mess->CDEV_MINOR;
@ -394,9 +400,9 @@ static int do_cancel(struct chardriver *cdp, message *m_ptr)
return EDONTREPLY; return EDONTREPLY;
/* Call the cancel hook. */ /* Call the cancel hook. */
minor = m_ptr->CDEV_MINOR; minor = m_ptr->m_vfs_lchardriver_cancel.minor;
endpt = m_ptr->m_source; endpt = m_ptr->m_source;
id = m_ptr->CDEV_ID; id = m_ptr->m_vfs_lchardriver_cancel.id;
return cdp->cdr_cancel(minor, endpt, id); return cdp->cdr_cancel(minor, endpt, id);
} }
@ -573,10 +579,12 @@ int chardriver_get_minor(message *m, devminor_t *minor)
case CDEV_CLOSE: case CDEV_CLOSE:
*minor = m->m_vfs_lchardriver_openclose.minor; *minor = m->m_vfs_lchardriver_openclose.minor;
return OK; return OK;
case CDEV_CANCEL:
*minor = m->m_vfs_lchardriver_cancel.minor;
return OK;
case CDEV_READ: case CDEV_READ:
case CDEV_WRITE: case CDEV_WRITE:
case CDEV_IOCTL: case CDEV_IOCTL:
case CDEV_CANCEL:
case CDEV_SELECT: case CDEV_SELECT:
*minor = m->CDEV_MINOR; *minor = m->CDEV_MINOR;
return OK; return OK;

View file

@ -575,8 +575,8 @@ int cdev_cancel(dev_t dev)
memset(&dev_mess, 0, sizeof(dev_mess)); memset(&dev_mess, 0, sizeof(dev_mess));
dev_mess.m_type = CDEV_CANCEL; dev_mess.m_type = CDEV_CANCEL;
dev_mess.CDEV_MINOR = minor_dev; dev_mess.m_vfs_lchardriver_cancel.minor = minor_dev;
dev_mess.CDEV_ID = fp->fp_endpoint; dev_mess.m_vfs_lchardriver_cancel.id = fp->fp_endpoint;
/* Send the request to the driver. */ /* Send the request to the driver. */
if ((r = asynsend3(dp->dmap_driver, &dev_mess, AMF_NOREPLY)) != OK) if ((r = asynsend3(dp->dmap_driver, &dev_mess, AMF_NOREPLY)) != OK)