Message type for CDEV_SELECT

Change-Id: I74e67ef2206102fe4686efb35d1aaf42db5cd236
This commit is contained in:
Lionel Sambuc 2014-06-06 14:21:20 +02:00
parent 3e6f0b3e98
commit ca7231fbef
4 changed files with 18 additions and 7 deletions

View file

@ -1012,7 +1012,6 @@
/* Field names for block device messages. */ /* Field names for block device messages. */
#define CDEV_MINOR m10_i1 /* minor device number */ #define CDEV_MINOR m10_i1 /* minor device number */
#define CDEV_GRANT m10_i2 /* grant ID of buffer */ #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_COUNT m10_i3 /* number of bytes to transfer */
#define CDEV_USER m10_i3 /* endpoint of user process */ #define CDEV_USER m10_i3 /* endpoint of user process */
#define CDEV_FLAGS m10_i4 /* transfer flags */ #define CDEV_FLAGS m10_i4 /* transfer flags */

View file

@ -1592,6 +1592,14 @@ typedef struct {
} mess_vfs_lchardriver_openclose; } mess_vfs_lchardriver_openclose;
_ASSERT_MSG_SIZE(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 { typedef struct {
int status; int status;
uint32_t id; /* should be cdev_id_t */ 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_cancel m_vfs_lchardriver_cancel;
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose; mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
mess_vfs_lchardriver_select m_vfs_lchardriver_select;
mess_vfs_utimens m_vfs_utimens; mess_vfs_utimens m_vfs_utimens;
mess_vm_vfs_mmap m_vm_vfs_mmap; mess_vm_vfs_mmap m_vm_vfs_mmap;

View file

@ -260,8 +260,9 @@ static void chardriver_reply(message *mess, int ipc_status, int r)
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.status = r; reply_mess.m_lchardriver_vfs_sel1.status = r;
reply_mess.m_lchardriver_vfs_sel1.minor =
mess->m_vfs_lchardriver_select.minor;
break; break;
default: default:
@ -422,8 +423,8 @@ static int do_select(struct chardriver *cdp, message *m_ptr)
return EBADF; return EBADF;
/* Call the select hook. */ /* Call the select hook. */
minor = m_ptr->CDEV_MINOR; minor = m_ptr->m_vfs_lchardriver_select.minor;
ops = m_ptr->CDEV_OPS; ops = m_ptr->m_vfs_lchardriver_select.ops;
endpt = m_ptr->m_source; endpt = m_ptr->m_source;
return cdp->cdr_select(minor, ops, endpt); return cdp->cdr_select(minor, ops, endpt);
@ -582,10 +583,12 @@ int chardriver_get_minor(message *m, devminor_t *minor)
case CDEV_CANCEL: case CDEV_CANCEL:
*minor = m->m_vfs_lchardriver_cancel.minor; *minor = m->m_vfs_lchardriver_cancel.minor;
return OK; return OK;
case CDEV_SELECT:
*minor = m->m_vfs_lchardriver_select.minor;
return OK;
case CDEV_READ: case CDEV_READ:
case CDEV_WRITE: case CDEV_WRITE:
case CDEV_IOCTL: case CDEV_IOCTL:
case CDEV_SELECT:
*minor = m->CDEV_MINOR; *minor = m->CDEV_MINOR;
return OK; return OK;
default: default:

View file

@ -545,8 +545,8 @@ int cdev_select(dev_t dev, int ops)
memset(&dev_mess, 0, sizeof(dev_mess)); memset(&dev_mess, 0, sizeof(dev_mess));
dev_mess.m_type = CDEV_SELECT; dev_mess.m_type = CDEV_SELECT;
dev_mess.CDEV_MINOR = minor_dev; dev_mess.m_vfs_lchardriver_select.minor = minor_dev;
dev_mess.CDEV_OPS = ops; dev_mess.m_vfs_lchardriver_select.ops = ops;
/* 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)