From: Lionel Sambuc Date: Fri, 6 Jun 2014 11:19:58 +0000 (+0200) Subject: Message type for CDEV_CANCEL X-Git-Tag: v3.3.0~193 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/dnssec-dsfromkey.html?a=commitdiff_plain;h=3e6f0b3e98a117f437cc9000fe0506aad4f489ab;p=minix.git Message type for CDEV_CANCEL Change-Id: I4a58f314e140c043392503c079e3d9b994c50b2f --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index ed12ca229..350ce871b 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -1574,6 +1574,14 @@ typedef struct { } 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 { endpoint_t id; endpoint_t user; @@ -1871,6 +1879,7 @@ typedef struct { 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_utimens m_vfs_utimens; diff --git a/lib/libchardriver/chardriver.c b/lib/libchardriver/chardriver.c index ab7f604f0..fca505c0f 100644 --- a/lib/libchardriver/chardriver.c +++ b/lib/libchardriver/chardriver.c @@ -246,12 +246,18 @@ static void chardriver_reply(message *mess, int ipc_status, int r) case CDEV_READ: case CDEV_WRITE: 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_lchardriver_vfs_reply.status = r; reply_mess.m_lchardriver_vfs_reply.id = mess->CDEV_ID; 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: reply_mess.m_type = CDEV_SEL1_REPLY; 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; /* Call the cancel hook. */ - minor = m_ptr->CDEV_MINOR; + minor = m_ptr->m_vfs_lchardriver_cancel.minor; 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); } @@ -573,10 +579,12 @@ int chardriver_get_minor(message *m, devminor_t *minor) case CDEV_CLOSE: *minor = m->m_vfs_lchardriver_openclose.minor; return OK; + case CDEV_CANCEL: + *minor = m->m_vfs_lchardriver_cancel.minor; + return OK; case CDEV_READ: case CDEV_WRITE: case CDEV_IOCTL: - case CDEV_CANCEL: case CDEV_SELECT: *minor = m->CDEV_MINOR; return OK; diff --git a/servers/vfs/device.c b/servers/vfs/device.c index 3803eab5f..84264f253 100644 --- a/servers/vfs/device.c +++ b/servers/vfs/device.c @@ -575,8 +575,8 @@ int cdev_cancel(dev_t dev) memset(&dev_mess, 0, sizeof(dev_mess)); dev_mess.m_type = CDEV_CANCEL; - dev_mess.CDEV_MINOR = minor_dev; - dev_mess.CDEV_ID = fp->fp_endpoint; + dev_mess.m_vfs_lchardriver_cancel.minor = minor_dev; + dev_mess.m_vfs_lchardriver_cancel.id = fp->fp_endpoint; /* Send the request to the driver. */ if ((r = asynsend3(dp->dmap_driver, &dev_mess, AMF_NOREPLY)) != OK)