Block protocol: add user endpoint to IOCTL request
I/O control requests now come with the endpoint of the user process that initiated the ioctl(2) call. It is stored in a new BDEV_USER field, which is an alias for BDEV_FLAGS. The contents of this field are to be used only in highly specific situations. It should be preserved (not replaced!) by services that forward IOCTL requests, and may be set to NONE for service-initiated IOCTL requests. Change-Id: I68a01b9ce43eca00e61b985a9cf87f55ba683de4
This commit is contained in:
parent
113635b019
commit
95624ae072
16 changed files with 43 additions and 32 deletions
|
@ -243,7 +243,7 @@ static ssize_t ahci_transfer(devminor_t minor, int do_write, u64_t position,
|
||||||
static struct device *ahci_part(devminor_t minor);
|
static struct device *ahci_part(devminor_t minor);
|
||||||
static void ahci_alarm(clock_t stamp);
|
static void ahci_alarm(clock_t stamp);
|
||||||
static int ahci_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
|
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 void ahci_intr(unsigned int mask);
|
||||||
static int ahci_device(devminor_t minor, device_id_t *id);
|
static int ahci_device(devminor_t minor, device_id_t *id);
|
||||||
static struct port_state *ahci_get_port(devminor_t minor);
|
static struct port_state *ahci_get_port(devminor_t minor);
|
||||||
|
@ -2632,7 +2632,7 @@ static ssize_t ahci_transfer(devminor_t minor, int do_write, u64_t position,
|
||||||
* ahci_ioctl *
|
* ahci_ioctl *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int ahci_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
|
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.
|
/* Process I/O control requests.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -157,7 +157,7 @@ static void w_need_reset(void);
|
||||||
static void ack_irqs(unsigned int);
|
static void ack_irqs(unsigned int);
|
||||||
static int w_do_close(devminor_t minor);
|
static int w_do_close(devminor_t minor);
|
||||||
static int w_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
|
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 void w_hw_int(unsigned int irqs);
|
||||||
static int com_simple(struct command *cmd);
|
static int com_simple(struct command *cmd);
|
||||||
static void w_timeout(void);
|
static void w_timeout(void);
|
||||||
|
@ -2212,7 +2212,7 @@ int do_dma;
|
||||||
* w_ioctl *
|
* w_ioctl *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int w_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
|
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;
|
int r, timeout, prev, count;
|
||||||
struct command cmd;
|
struct command cmd;
|
||||||
|
|
|
@ -34,7 +34,7 @@ static int cat24c256_blk_close(devminor_t minor);
|
||||||
static ssize_t cat24c256_blk_transfer(devminor_t minor, int do_write,
|
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);
|
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,
|
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 struct device *cat24c256_blk_part(devminor_t minor);
|
||||||
static void cat24c256_blk_other(message * m, int ipc_status);
|
static void cat24c256_blk_other(message * m, int ipc_status);
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ cat24c256_blk_transfer(devminor_t minor, int do_write, u64_t pos64,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cat24c256_blk_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
|
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);
|
log_trace(&log, "cat24c256_blk_ioctl(%d)\n", minor);
|
||||||
/* no supported ioctls for this device */
|
/* no supported ioctls for this device */
|
||||||
|
|
|
@ -20,7 +20,7 @@ static int fbd_close(devminor_t minor);
|
||||||
static int fbd_transfer(devminor_t minor, int do_write, u64_t position,
|
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);
|
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,
|
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. */
|
/* Variables. */
|
||||||
static char *fbd_buf; /* scratch buffer */
|
static char *fbd_buf; /* scratch buffer */
|
||||||
|
@ -190,7 +190,7 @@ static int fbd_close(devminor_t UNUSED(minor))
|
||||||
* fbd_ioctl *
|
* fbd_ioctl *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int fbd_ioctl(devminor_t UNUSED(minor), unsigned int request,
|
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. */
|
/* Handle an I/O control request. */
|
||||||
cp_grant_id_t gid;
|
cp_grant_id_t gid;
|
||||||
|
@ -215,6 +215,7 @@ static int fbd_ioctl(devminor_t UNUSED(minor), unsigned int request,
|
||||||
m.BDEV_MINOR = driver_minor;
|
m.BDEV_MINOR = driver_minor;
|
||||||
m.BDEV_REQUEST = request;
|
m.BDEV_REQUEST = request;
|
||||||
m.BDEV_GRANT = gid;
|
m.BDEV_GRANT = gid;
|
||||||
|
m.BDEV_USER = NONE;
|
||||||
m.BDEV_ID = 0;
|
m.BDEV_ID = 0;
|
||||||
|
|
||||||
if ((r = sendrec(driver_endpt, &m)) != OK)
|
if ((r = sendrec(driver_endpt, &m)) != OK)
|
||||||
|
|
|
@ -60,6 +60,7 @@ static int driver_open(int which)
|
||||||
msg.BDEV_MINOR = driver[which].minor;
|
msg.BDEV_MINOR = driver[which].minor;
|
||||||
msg.BDEV_REQUEST = DIOCGETP;
|
msg.BDEV_REQUEST = DIOCGETP;
|
||||||
msg.BDEV_GRANT = gid;
|
msg.BDEV_GRANT = gid;
|
||||||
|
msg.BDEV_USER = NONE;
|
||||||
msg.BDEV_ID = 0;
|
msg.BDEV_ID = 0;
|
||||||
|
|
||||||
r = sendrec(driver[which].endpt, &msg);
|
r = sendrec(driver[which].endpt, &msg);
|
||||||
|
|
|
@ -58,7 +58,7 @@ static int m_block_transfer(devminor_t minor, int do_write, u64_t position,
|
||||||
static int m_block_open(devminor_t minor, int access);
|
static int m_block_open(devminor_t minor, int access);
|
||||||
static int m_block_close(devminor_t minor);
|
static int m_block_close(devminor_t minor);
|
||||||
static int m_block_ioctl(devminor_t minor, unsigned int request, endpoint_t
|
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. */
|
/* Entry points to the CHARACTER part of this driver. */
|
||||||
static struct chardriver m_cdtab = {
|
static struct chardriver m_cdtab = {
|
||||||
|
@ -512,7 +512,7 @@ static int m_block_close(devminor_t minor)
|
||||||
* m_block_ioctl *
|
* m_block_ioctl *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int m_block_ioctl(devminor_t minor, unsigned int request,
|
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
|
/* I/O controls for the block devices of the memory driver. Currently there is
|
||||||
* one I/O control specific to the memory driver:
|
* one I/O control specific to the memory driver:
|
||||||
|
|
|
@ -49,8 +49,8 @@ static int block_transfer(devminor_t minor,
|
||||||
u64_t position,
|
u64_t position,
|
||||||
endpoint_t endpt, iovec_t * iov, unsigned int nr_req, int flags);
|
endpoint_t endpt, iovec_t * iov, unsigned int nr_req, int flags);
|
||||||
|
|
||||||
static int block_ioctl(devminor_t minor,
|
static int block_ioctl(devminor_t minor, unsigned int request,
|
||||||
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 *block_part(devminor_t minor);
|
static struct device *block_part(devminor_t minor);
|
||||||
|
|
||||||
/* System even handling */
|
/* System even handling */
|
||||||
|
@ -435,8 +435,8 @@ block_transfer(
|
||||||
* block_ioctl *
|
* block_ioctl *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int
|
static int
|
||||||
block_ioctl(devminor_t minor,
|
block_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
|
||||||
unsigned int request, endpoint_t endpt, cp_grant_id_t grant)
|
cp_grant_id_t grant, endpoint_t UNUSED(user_endpt))
|
||||||
{
|
{
|
||||||
/* IOCTL handling */
|
/* IOCTL handling */
|
||||||
struct sd_slot *slot;
|
struct sd_slot *slot;
|
||||||
|
|
|
@ -168,7 +168,7 @@ static int tda19988_blk_close(devminor_t minor);
|
||||||
static ssize_t tda19988_blk_transfer(devminor_t minor, int do_write, u64_t pos,
|
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);
|
endpoint_t endpt, iovec_t * iov, unsigned int count, int flags);
|
||||||
static int tda19988_blk_ioctl(devminor_t minor, unsigned int request,
|
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 struct device *tda19988_blk_part(devminor_t minor);
|
||||||
static void tda19988_blk_other(message * m, int ipc_status);
|
static void tda19988_blk_other(message * m, int ipc_status);
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ tda19988_blk_transfer(devminor_t minor, int do_write, u64_t pos64,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tda19988_blk_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt,
|
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);
|
log_trace(&log, "tda19988_blk_ioctl(%d)\n", minor);
|
||||||
/* no supported ioctls for this device */
|
/* no supported ioctls for this device */
|
||||||
|
|
|
@ -83,7 +83,7 @@ static ssize_t virtio_blk_transfer(devminor_t minor, int write, u64_t position,
|
||||||
endpoint_t endpt, iovec_t *iovec,
|
endpoint_t endpt, iovec_t *iovec,
|
||||||
unsigned int cnt, int flags);
|
unsigned int cnt, int flags);
|
||||||
static int virtio_blk_ioctl(devminor_t minor, unsigned int req,
|
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 struct device * virtio_blk_part(devminor_t minor);
|
||||||
static void virtio_blk_geometry(devminor_t minor, struct part_geom *entry);
|
static void virtio_blk_geometry(devminor_t minor, struct part_geom *entry);
|
||||||
static void virtio_blk_device_intr(void);
|
static void virtio_blk_device_intr(void);
|
||||||
|
@ -376,7 +376,7 @@ virtio_blk_transfer(devminor_t minor, int write, u64_t position,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virtio_blk_ioctl(devminor_t minor, unsigned int req, endpoint_t endpt,
|
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) {
|
switch (req) {
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ extern ssize_t bdev_gather(dev_t dev, u64_t pos, iovec_t *vec, int count,
|
||||||
int flags);
|
int flags);
|
||||||
extern ssize_t bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count,
|
extern ssize_t bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count,
|
||||||
int flags);
|
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. */
|
/* Asynchronous API. */
|
||||||
typedef int bdev_id_t;
|
typedef int bdev_id_t;
|
||||||
|
@ -36,7 +37,7 @@ extern bdev_id_t bdev_gather_asyn(dev_t dev, u64_t pos, iovec_t *vec,
|
||||||
extern bdev_id_t bdev_scatter_asyn(dev_t dev, u64_t pos, iovec_t *vec,
|
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);
|
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,
|
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);
|
extern int bdev_wait_asyn(bdev_id_t id);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ struct blockdriver {
|
||||||
ssize_t (*bdr_transfer)(devminor_t minor, int do_write, u64_t pos,
|
ssize_t (*bdr_transfer)(devminor_t minor, int do_write, u64_t pos,
|
||||||
endpoint_t endpt, iovec_t *iov, unsigned int count, int flags);
|
endpoint_t endpt, iovec_t *iov, unsigned int count, int flags);
|
||||||
int (*bdr_ioctl)(devminor_t minor, unsigned int request, endpoint_t endpt,
|
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);
|
void (*bdr_cleanup)(void);
|
||||||
struct device *(*bdr_part)(devminor_t minor);
|
struct device *(*bdr_part)(devminor_t minor);
|
||||||
void (*bdr_geometry)(devminor_t minor, struct part_geom *part);
|
void (*bdr_geometry)(devminor_t minor, struct part_geom *part);
|
||||||
|
|
|
@ -1325,6 +1325,7 @@
|
||||||
#define BDEV_COUNT m10_i2 /* number of bytes or elements in transfer */
|
#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_GRANT m10_i3 /* grant ID of buffer or vector */
|
||||||
#define BDEV_FLAGS m10_i4 /* transfer flags */
|
#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_ID m10_l1 /* opaque request ID */
|
||||||
#define BDEV_POS_LO m10_l2 /* transfer position (low bits) */
|
#define BDEV_POS_LO m10_l2 /* transfer position (low bits) */
|
||||||
#define BDEV_POS_HI m10_l3 /* transfer position (high bits) */
|
#define BDEV_POS_HI m10_l3 /* transfer position (high bits) */
|
||||||
|
|
|
@ -305,7 +305,8 @@ ssize_t bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count, int flags)
|
||||||
return bdev_vrdwt(BDEV_SCATTER, dev, pos, vec, count, flags);
|
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.
|
/* Set up an I/O control request.
|
||||||
*/
|
*/
|
||||||
|
@ -339,6 +340,7 @@ static int bdev_ioctl_setup(dev_t dev, int request, void *buf, message *m)
|
||||||
m->BDEV_MINOR = minor(dev);
|
m->BDEV_MINOR = minor(dev);
|
||||||
m->BDEV_REQUEST = request;
|
m->BDEV_REQUEST = request;
|
||||||
m->BDEV_GRANT = grant;
|
m->BDEV_GRANT = grant;
|
||||||
|
m->BDEV_USER = user_endpt;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -351,7 +353,7 @@ static void bdev_ioctl_cleanup(const message *m)
|
||||||
cpf_revoke(m->BDEV_GRANT);
|
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.
|
/* Perform a synchronous I/O control request.
|
||||||
*/
|
*/
|
||||||
|
@ -359,7 +361,7 @@ int bdev_ioctl(dev_t dev, int request, void *buf)
|
||||||
int r, driver_tries = 0;
|
int r, driver_tries = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ((r = bdev_ioctl_setup(dev, request, buf, &m)) != OK)
|
if ((r = bdev_ioctl_setup(dev, request, buf, user_endpt, &m)) != OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
r = bdev_sendrec(dev, &m);
|
r = bdev_sendrec(dev, &m);
|
||||||
|
@ -496,7 +498,7 @@ bdev_id_t bdev_scatter_asyn(dev_t dev, u64_t pos, iovec_t *vec, int count,
|
||||||
}
|
}
|
||||||
|
|
||||||
bdev_id_t bdev_ioctl_asyn(dev_t dev, int request, void *buf,
|
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.
|
/* Perform an asynchronous I/O control request.
|
||||||
*/
|
*/
|
||||||
|
@ -506,7 +508,8 @@ bdev_id_t bdev_ioctl_asyn(dev_t dev, int request, void *buf,
|
||||||
if ((call = bdev_call_alloc(1)) == NULL)
|
if ((call = bdev_call_alloc(1)) == NULL)
|
||||||
return ENOMEM;
|
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);
|
bdev_call_free(call);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -623,7 +626,8 @@ int bdev_restart_asyn(bdev_call_t *call)
|
||||||
bdev_ioctl_cleanup(&call->msg);
|
bdev_ioctl_cleanup(&call->msg);
|
||||||
|
|
||||||
r = bdev_ioctl_setup(call->dev, call->msg.BDEV_REQUEST,
|
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;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* Block drivers support the following requests. Message format m10 is used.
|
* Block drivers support the following requests. Message format m10 is used.
|
||||||
* Field names are prefixed with BDEV_. Separate field names are used for the
|
* 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
|
* m_type MINOR COUNT GRANT FLAGS ID POS_LO POS_HI
|
||||||
* +--------------+--------+----------+-------+-------+------+------+------+
|
* +--------------+--------+----------+-------+-------+------+------+------+
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
* |--------------+--------+----------+-------+-------+------+------+------|
|
* |--------------+--------+----------+-------+-------+------+------+------|
|
||||||
* | BDEV_SCATTER | minor | elements | grant | flags | id | position |
|
* | 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.
|
* The following reply message is used for all requests.
|
||||||
|
@ -320,11 +320,13 @@ static int do_ioctl(struct blockdriver *bdp, message *mp)
|
||||||
dev_t minor;
|
dev_t minor;
|
||||||
unsigned int request;
|
unsigned int request;
|
||||||
cp_grant_id_t grant;
|
cp_grant_id_t grant;
|
||||||
|
endpoint_t user_endpt;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
minor = mp->BDEV_MINOR;
|
minor = mp->BDEV_MINOR;
|
||||||
request = mp->BDEV_REQUEST;
|
request = mp->BDEV_REQUEST;
|
||||||
grant = mp->BDEV_GRANT;
|
grant = mp->BDEV_GRANT;
|
||||||
|
user_endpt = mp->BDEV_USER;
|
||||||
|
|
||||||
switch (request) {
|
switch (request) {
|
||||||
case BIOCTRACEBUF:
|
case BIOCTRACEBUF:
|
||||||
|
@ -348,7 +350,8 @@ static int do_ioctl(struct blockdriver *bdp, message *mp)
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
default:
|
default:
|
||||||
if (bdp->bdr_ioctl)
|
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
|
else
|
||||||
r = ENOTTY;
|
r = ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,6 +185,7 @@ static int bdev_ioctl(dev_t dev, endpoint_t proc_e, int req, void *buf)
|
||||||
dev_mess.BDEV_MINOR = minor_dev;
|
dev_mess.BDEV_MINOR = minor_dev;
|
||||||
dev_mess.BDEV_REQUEST = req;
|
dev_mess.BDEV_REQUEST = req;
|
||||||
dev_mess.BDEV_GRANT = gid;
|
dev_mess.BDEV_GRANT = gid;
|
||||||
|
dev_mess.BDEV_USER = proc_e;
|
||||||
dev_mess.BDEV_ID = 0;
|
dev_mess.BDEV_ID = 0;
|
||||||
|
|
||||||
/* Call the task. */
|
/* Call the task. */
|
||||||
|
|
|
@ -1090,10 +1090,9 @@ static int vir_ioctl(dev_t minor, int req, void *ptr, ssize_t exp,
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.m_type = BDEV_IOCTL;
|
m.m_type = BDEV_IOCTL;
|
||||||
m.BDEV_MINOR = minor;
|
m.BDEV_MINOR = minor;
|
||||||
m.BDEV_POS_LO = 0L;
|
|
||||||
m.BDEV_POS_HI = 0L;
|
|
||||||
m.BDEV_REQUEST = req;
|
m.BDEV_REQUEST = req;
|
||||||
m.BDEV_GRANT = grant;
|
m.BDEV_GRANT = grant;
|
||||||
|
m.BDEV_USER = NONE;
|
||||||
m.BDEV_ID = lrand48();
|
m.BDEV_ID = lrand48();
|
||||||
|
|
||||||
r = sendrec_driver(&m, exp, res);
|
r = sendrec_driver(&m, exp, res);
|
||||||
|
|
Loading…
Reference in a new issue