static struct device *ahci_part(devminor_t minor);
static void ahci_alarm(clock_t stamp);
static int ahci_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
- cp_grant_id_t grant);
+ cp_grant_id_t grant, endpoint_t user_endpt);
static void ahci_intr(unsigned int mask);
static int ahci_device(devminor_t minor, device_id_t *id);
static struct port_state *ahci_get_port(devminor_t minor);
* ahci_ioctl *
*===========================================================================*/
static int ahci_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
- cp_grant_id_t grant)
+ cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
{
/* Process I/O control requests.
*/
static void ack_irqs(unsigned int);
static int w_do_close(devminor_t minor);
static int w_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
- cp_grant_id_t grant);
+ cp_grant_id_t grant, endpoint_t user_endpt);
static void w_hw_int(unsigned int irqs);
static int com_simple(struct command *cmd);
static void w_timeout(void);
* w_ioctl *
*===========================================================================*/
static int w_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
- cp_grant_id_t grant)
+ cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
{
int r, timeout, prev, count;
struct command cmd;
static ssize_t cat24c256_blk_transfer(devminor_t minor, int do_write,
u64_t pos, endpoint_t endpt, iovec_t * iov, unsigned int count, int flags);
static int cat24c256_blk_ioctl(devminor_t minor, unsigned int request,
- endpoint_t endpt, cp_grant_id_t grant);
+ endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt);
static struct device *cat24c256_blk_part(devminor_t minor);
static void cat24c256_blk_other(message * m, int ipc_status);
static int
cat24c256_blk_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
- cp_grant_id_t grant)
+ cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
{
log_trace(&log, "cat24c256_blk_ioctl(%d)\n", minor);
/* no supported ioctls for this device */
static int fbd_transfer(devminor_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags);
static int fbd_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
- cp_grant_id_t grant);
+ cp_grant_id_t grant, endpoint_t user_endpt);
/* Variables. */
static char *fbd_buf; /* scratch buffer */
* fbd_ioctl *
*===========================================================================*/
static int fbd_ioctl(devminor_t UNUSED(minor), unsigned int request,
- endpoint_t endpt, cp_grant_id_t grant)
+ endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
{
/* Handle an I/O control request. */
cp_grant_id_t gid;
m.BDEV_MINOR = driver_minor;
m.BDEV_REQUEST = request;
m.BDEV_GRANT = gid;
+ m.BDEV_USER = NONE;
m.BDEV_ID = 0;
if ((r = sendrec(driver_endpt, &m)) != OK)
msg.BDEV_MINOR = driver[which].minor;
msg.BDEV_REQUEST = DIOCGETP;
msg.BDEV_GRANT = gid;
+ msg.BDEV_USER = NONE;
msg.BDEV_ID = 0;
r = sendrec(driver[which].endpt, &msg);
static int m_block_open(devminor_t minor, int access);
static int m_block_close(devminor_t minor);
static int m_block_ioctl(devminor_t minor, unsigned int request, endpoint_t
- endpt, cp_grant_id_t grant);
+ endpt, cp_grant_id_t grant, endpoint_t user_endpt);
/* Entry points to the CHARACTER part of this driver. */
static struct chardriver m_cdtab = {
* m_block_ioctl *
*===========================================================================*/
static int m_block_ioctl(devminor_t minor, unsigned int request,
- endpoint_t endpt, cp_grant_id_t grant)
+ endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
{
/* I/O controls for the block devices of the memory driver. Currently there is
* one I/O control specific to the memory driver:
u64_t position,
endpoint_t endpt, iovec_t * iov, unsigned int nr_req, int flags);
-static int block_ioctl(devminor_t minor,
- unsigned int request, endpoint_t endpt, cp_grant_id_t grant);
+static int block_ioctl(devminor_t minor, unsigned int request,
+ endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt);
static struct device *block_part(devminor_t minor);
/* System even handling */
* block_ioctl *
*===========================================================================*/
static int
-block_ioctl(devminor_t minor,
- unsigned int request, endpoint_t endpt, cp_grant_id_t grant)
+block_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
+ cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
{
/* IOCTL handling */
struct sd_slot *slot;
static ssize_t tda19988_blk_transfer(devminor_t minor, int do_write, u64_t pos,
endpoint_t endpt, iovec_t * iov, unsigned int count, int flags);
static int tda19988_blk_ioctl(devminor_t minor, unsigned int request,
- endpoint_t endpt, cp_grant_id_t grant);
+ endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt);
static struct device *tda19988_blk_part(devminor_t minor);
static void tda19988_blk_other(message * m, int ipc_status);
static int
tda19988_blk_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
- cp_grant_id_t grant)
+ cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
{
log_trace(&log, "tda19988_blk_ioctl(%d)\n", minor);
/* no supported ioctls for this device */
endpoint_t endpt, iovec_t *iovec,
unsigned int cnt, int flags);
static int virtio_blk_ioctl(devminor_t minor, unsigned int req,
- endpoint_t endpt, cp_grant_id_t grant);
+ endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt);
static struct device * virtio_blk_part(devminor_t minor);
static void virtio_blk_geometry(devminor_t minor, struct part_geom *entry);
static void virtio_blk_device_intr(void);
static int
virtio_blk_ioctl(devminor_t minor, unsigned int req, endpoint_t endpt,
- cp_grant_id_t grant)
+ cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
{
switch (req) {
int flags);
extern ssize_t bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count,
int flags);
-extern int bdev_ioctl(dev_t dev, int request, void *buf);
+extern int bdev_ioctl(dev_t dev, int request, void *buf,
+ endpoint_t user_endpt);
/* Asynchronous API. */
typedef int bdev_id_t;
extern bdev_id_t bdev_scatter_asyn(dev_t dev, u64_t pos, iovec_t *vec,
int count, int flags, bdev_callback_t callback, bdev_param_t param);
extern bdev_id_t bdev_ioctl_asyn(dev_t dev, int request, void *buf,
- bdev_callback_t callback, bdev_param_t param);
+ endpoint_t user_endpt, bdev_callback_t callback, bdev_param_t param);
extern int bdev_wait_asyn(bdev_id_t id);
ssize_t (*bdr_transfer)(devminor_t minor, int do_write, u64_t pos,
endpoint_t endpt, iovec_t *iov, unsigned int count, int flags);
int (*bdr_ioctl)(devminor_t minor, unsigned int request, endpoint_t endpt,
- cp_grant_id_t grant);
+ cp_grant_id_t grant, endpoint_t user_endpt);
void (*bdr_cleanup)(void);
struct device *(*bdr_part)(devminor_t minor);
void (*bdr_geometry)(devminor_t minor, struct part_geom *part);
#define BDEV_COUNT m10_i2 /* number of bytes or elements in transfer */
#define BDEV_GRANT m10_i3 /* grant ID of buffer or vector */
#define BDEV_FLAGS m10_i4 /* transfer flags */
+#define BDEV_USER m10_i4 /* user endpoint requesting I/O control */
#define BDEV_ID m10_l1 /* opaque request ID */
#define BDEV_POS_LO m10_l2 /* transfer position (low bits) */
#define BDEV_POS_HI m10_l3 /* transfer position (high bits) */
return bdev_vrdwt(BDEV_SCATTER, dev, pos, vec, count, flags);
}
-static int bdev_ioctl_setup(dev_t dev, int request, void *buf, message *m)
+static int bdev_ioctl_setup(dev_t dev, int request, void *buf,
+ endpoint_t user_endpt, message *m)
{
/* Set up an I/O control request.
*/
m->BDEV_MINOR = minor(dev);
m->BDEV_REQUEST = request;
m->BDEV_GRANT = grant;
+ m->BDEV_USER = user_endpt;
return OK;
}
cpf_revoke(m->BDEV_GRANT);
}
-int bdev_ioctl(dev_t dev, int request, void *buf)
+int bdev_ioctl(dev_t dev, int request, void *buf, endpoint_t user_endpt)
{
/* Perform a synchronous I/O control request.
*/
int r, driver_tries = 0;
do {
- if ((r = bdev_ioctl_setup(dev, request, buf, &m)) != OK)
+ if ((r = bdev_ioctl_setup(dev, request, buf, user_endpt, &m)) != OK)
break;
r = bdev_sendrec(dev, &m);
}
bdev_id_t bdev_ioctl_asyn(dev_t dev, int request, void *buf,
- bdev_callback_t callback, bdev_param_t param)
+ endpoint_t user_endpt, bdev_callback_t callback, bdev_param_t param)
{
/* Perform an asynchronous I/O control request.
*/
if ((call = bdev_call_alloc(1)) == NULL)
return ENOMEM;
- if ((r = bdev_ioctl_setup(dev, request, buf, &call->msg)) != OK) {
+ if ((r = bdev_ioctl_setup(dev, request, buf, user_endpt,
+ &call->msg)) != OK) {
bdev_call_free(call);
return r;
bdev_ioctl_cleanup(&call->msg);
r = bdev_ioctl_setup(call->dev, call->msg.BDEV_REQUEST,
- (char *) call->vec[0].iov_addr, &call->msg);
+ (char *) call->vec[0].iov_addr, call->msg.BDEV_USER,
+ &call->msg);
break;
*
* Block drivers support the following requests. Message format m10 is used.
* Field names are prefixed with BDEV_. Separate field names are used for the
- * "access" and "request" fields.
+ * "access", "request", and "user" fields.
*
* m_type MINOR COUNT GRANT FLAGS ID POS_LO POS_HI
* +--------------+--------+----------+-------+-------+------+------+------+
* |--------------+--------+----------+-------+-------+------+------+------|
* | BDEV_SCATTER | minor | elements | grant | flags | id | position |
* |--------------+--------+----------+-------+-------+------+------+------|
- * | BDEV_IOCTL | minor | request | grant | flags | id | | |
+ * | BDEV_IOCTL | minor | request | grant | user | id | | |
* -------------------------------------------------------------------------
*
* The following reply message is used for all requests.
dev_t minor;
unsigned int request;
cp_grant_id_t grant;
+ endpoint_t user_endpt;
int r;
minor = mp->BDEV_MINOR;
request = mp->BDEV_REQUEST;
grant = mp->BDEV_GRANT;
+ user_endpt = mp->BDEV_USER;
switch (request) {
case BIOCTRACEBUF:
/* fall-through */
default:
if (bdp->bdr_ioctl)
- r = (*bdp->bdr_ioctl)(minor, request, mp->m_source, grant);
+ r = (*bdp->bdr_ioctl)(minor, request, mp->m_source, grant,
+ user_endpt);
else
r = ENOTTY;
}
dev_mess.BDEV_MINOR = minor_dev;
dev_mess.BDEV_REQUEST = req;
dev_mess.BDEV_GRANT = gid;
+ dev_mess.BDEV_USER = proc_e;
dev_mess.BDEV_ID = 0;
/* Call the task. */
memset(&m, 0, sizeof(m));
m.m_type = BDEV_IOCTL;
m.BDEV_MINOR = minor;
- m.BDEV_POS_LO = 0L;
- m.BDEV_POS_HI = 0L;
m.BDEV_REQUEST = req;
m.BDEV_GRANT = grant;
+ m.BDEV_USER = NONE;
m.BDEV_ID = lrand48();
r = sendrec_driver(&m, exp, res);