]> Zhao Yanbai Git Server - minix.git/commitdiff
Message type for CDEV_CANCEL
authorLionel Sambuc <lionel@minix3.org>
Fri, 6 Jun 2014 11:19:58 +0000 (13:19 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:52 +0000 (17:05 +0200)
Change-Id: I4a58f314e140c043392503c079e3d9b994c50b2f

include/minix/ipc.h
lib/libchardriver/chardriver.c
servers/vfs/device.c

index ed12ca229a9946213c5c375fe6e6bd826a72e14b..350ce871ba454274519db45ad92f853dd74ddeb0 100644 (file)
@@ -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;
index ab7f604f026dd58487709701d17f5e6fbb29dcfa..fca505c0fe8ae59d147cf943da9e48d80860372c 100644 (file)
@@ -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;
index 3803eab5f61f2fa1d5acd9cbe6bcd3af13fbec22..84264f2539b2944b959526c247bca1998f4b0fdf 100644 (file)
@@ -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)