From ca7231fbefc8f75d7e1540fe81e429afb15189a1 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Fri, 6 Jun 2014 14:21:20 +0200 Subject: [PATCH] Message type for CDEV_SELECT Change-Id: I74e67ef2206102fe4686efb35d1aaf42db5cd236 --- include/minix/com.h | 1 - include/minix/ipc.h | 9 +++++++++ lib/libchardriver/chardriver.c | 11 +++++++---- servers/vfs/device.c | 4 ++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/minix/com.h b/include/minix/com.h index 210975317..0ee25611c 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -1012,7 +1012,6 @@ /* Field names for block device messages. */ #define CDEV_MINOR m10_i1 /* minor device number */ #define CDEV_GRANT m10_i2 /* grant ID of buffer */ -#define CDEV_OPS m10_i2 /* requested select operations */ #define CDEV_COUNT m10_i3 /* number of bytes to transfer */ #define CDEV_USER m10_i3 /* endpoint of user process */ #define CDEV_FLAGS m10_i4 /* transfer flags */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 350ce871b..a668079ab 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -1592,6 +1592,14 @@ typedef struct { } mess_vfs_lchardriver_openclose; _ASSERT_MSG_SIZE(mess_vfs_lchardriver_openclose); +typedef struct { + devminor_t minor; + int ops; + + uint8_t padding[48]; +} mess_vfs_lchardriver_select; +_ASSERT_MSG_SIZE(mess_vfs_lchardriver_select); + typedef struct { int status; uint32_t id; /* should be cdev_id_t */ @@ -1881,6 +1889,7 @@ typedef struct { mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel; mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose; + mess_vfs_lchardriver_select m_vfs_lchardriver_select; mess_vfs_utimens m_vfs_utimens; mess_vm_vfs_mmap m_vm_vfs_mmap; diff --git a/lib/libchardriver/chardriver.c b/lib/libchardriver/chardriver.c index fca505c0f..586a9c656 100644 --- a/lib/libchardriver/chardriver.c +++ b/lib/libchardriver/chardriver.c @@ -260,8 +260,9 @@ static void chardriver_reply(message *mess, int ipc_status, int r) case CDEV_SELECT: reply_mess.m_type = CDEV_SEL1_REPLY; - reply_mess.m_lchardriver_vfs_sel1.minor = mess->CDEV_MINOR; reply_mess.m_lchardriver_vfs_sel1.status = r; + reply_mess.m_lchardriver_vfs_sel1.minor = + mess->m_vfs_lchardriver_select.minor; break; default: @@ -422,8 +423,8 @@ static int do_select(struct chardriver *cdp, message *m_ptr) return EBADF; /* Call the select hook. */ - minor = m_ptr->CDEV_MINOR; - ops = m_ptr->CDEV_OPS; + minor = m_ptr->m_vfs_lchardriver_select.minor; + ops = m_ptr->m_vfs_lchardriver_select.ops; endpt = m_ptr->m_source; return cdp->cdr_select(minor, ops, endpt); @@ -582,10 +583,12 @@ int chardriver_get_minor(message *m, devminor_t *minor) case CDEV_CANCEL: *minor = m->m_vfs_lchardriver_cancel.minor; return OK; + case CDEV_SELECT: + *minor = m->m_vfs_lchardriver_select.minor; + return OK; case CDEV_READ: case CDEV_WRITE: case CDEV_IOCTL: - case CDEV_SELECT: *minor = m->CDEV_MINOR; return OK; default: diff --git a/servers/vfs/device.c b/servers/vfs/device.c index 84264f253..56478944c 100644 --- a/servers/vfs/device.c +++ b/servers/vfs/device.c @@ -545,8 +545,8 @@ int cdev_select(dev_t dev, int ops) memset(&dev_mess, 0, sizeof(dev_mess)); dev_mess.m_type = CDEV_SELECT; - dev_mess.CDEV_MINOR = minor_dev; - dev_mess.CDEV_OPS = ops; + dev_mess.m_vfs_lchardriver_select.minor = minor_dev; + dev_mess.m_vfs_lchardriver_select.ops = ops; /* Send the request to the driver. */ if ((r = asynsend3(dp->dmap_driver, &dev_mess, AMF_NOREPLY)) != OK)