From: David van Moolenbroek Date: Tue, 10 Sep 2013 21:57:32 +0000 (+0200) Subject: Block drivers: make IOCTL request unsigned long X-Git-Tag: v3.3.0~591 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=refs%2Fchanges%2F66%2F966%2F2;p=minix.git Block drivers: make IOCTL request unsigned long The block driver protocol and libblockdriver's bdr_ioctl hook are changed, as well as the users of this hook. Other parts of the system are expected to change accordingly eventually, since the ioctl(2) prototype has been aligned with NetBSD's. Change-Id: Ide46245b22cfa89ed267a38088fb0ab7696eba92 --- diff --git a/drivers/ahci/ahci.c b/drivers/ahci/ahci.c index b3dfc59f9..17a356502 100644 --- a/drivers/ahci/ahci.c +++ b/drivers/ahci/ahci.c @@ -242,8 +242,8 @@ static ssize_t ahci_transfer(devminor_t minor, int do_write, u64_t position, endpoint_t endpt, iovec_t *iovec, unsigned int count, int flags); 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, endpoint_t user_endpt); +static int ahci_ioctl(devminor_t minor, unsigned long request, + endpoint_t endpt, 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); @@ -2631,8 +2631,8 @@ static ssize_t ahci_transfer(devminor_t minor, int do_write, u64_t position, /*===========================================================================* * ahci_ioctl * *===========================================================================*/ -static int ahci_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt, - cp_grant_id_t grant, endpoint_t UNUSED(user_endpt)) +static int ahci_ioctl(devminor_t minor, unsigned long request, + endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt)) { /* Process I/O control requests. */ diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index e33ed009b..6694b620d 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -156,7 +156,7 @@ static int setup_dma(unsigned *sizep, endpoint_t proc_nr, iovec_t *iov, static void w_need_reset(void); 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, +static int w_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt); static void w_hw_int(unsigned int irqs); static int com_simple(struct command *cmd); @@ -2211,7 +2211,7 @@ int do_dma; /*===========================================================================* * w_ioctl * *===========================================================================*/ -static int w_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt, +static int w_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt)) { int r, timeout, prev, count; diff --git a/drivers/cat24c256/cat24c256.c b/drivers/cat24c256/cat24c256.c index 5a97ca091..7a02cbdab 100644 --- a/drivers/cat24c256/cat24c256.c +++ b/drivers/cat24c256/cat24c256.c @@ -33,7 +33,7 @@ static int cat24c256_blk_open(devminor_t minor, int access); static int cat24c256_blk_close(devminor_t minor); 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, +static int cat24c256_blk_ioctl(devminor_t minor, unsigned long request, 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); @@ -209,7 +209,7 @@ cat24c256_blk_transfer(devminor_t minor, int do_write, u64_t pos64, } static int -cat24c256_blk_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt, +cat24c256_blk_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt)) { log_trace(&log, "cat24c256_blk_ioctl(%d)\n", minor); diff --git a/drivers/fbd/fbd.c b/drivers/fbd/fbd.c index 6e86eb934..ac79a82f5 100644 --- a/drivers/fbd/fbd.c +++ b/drivers/fbd/fbd.c @@ -19,7 +19,7 @@ static int fbd_open(devminor_t minor, int access); static int fbd_close(devminor_t minor); 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, +static int fbd_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt); /* Variables. */ @@ -189,7 +189,7 @@ static int fbd_close(devminor_t UNUSED(minor)) /*===========================================================================* * fbd_ioctl * *===========================================================================*/ -static int fbd_ioctl(devminor_t UNUSED(minor), unsigned int request, +static int fbd_ioctl(devminor_t UNUSED(minor), unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt)) { /* Handle an I/O control request. */ diff --git a/drivers/filter/main.c b/drivers/filter/main.c index 742a543fa..023f8902a 100644 --- a/drivers/filter/main.c +++ b/drivers/filter/main.c @@ -267,7 +267,7 @@ static int do_ioctl(message *m) break; default: - printf("Filter: unknown ioctl request: %d!\n", + printf("Filter: unknown ioctl request: %ld!\n", m->BDEV_REQUEST); return ENOTTY; } diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index 45bf5bdb7..ec9cf5e63 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -57,7 +57,7 @@ static int m_block_transfer(devminor_t minor, int do_write, u64_t position, endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags); 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 +static int m_block_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt); /* Entry points to the CHARACTER part of this driver. */ @@ -511,7 +511,7 @@ static int m_block_close(devminor_t minor) /*===========================================================================* * m_block_ioctl * *===========================================================================*/ -static int m_block_ioctl(devminor_t minor, unsigned int request, +static int m_block_ioctl(devminor_t minor, unsigned long request, 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 diff --git a/drivers/mmc/mmcblk.c b/drivers/mmc/mmcblk.c index 8a6353f54..a3bcb171b 100644 --- a/drivers/mmc/mmcblk.c +++ b/drivers/mmc/mmcblk.c @@ -49,7 +49,7 @@ static int block_transfer(devminor_t minor, 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, +static int block_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt); static struct device *block_part(devminor_t minor); @@ -435,7 +435,7 @@ block_transfer( * block_ioctl * *===========================================================================*/ static int -block_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt, +block_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt)) { /* IOCTL handling */ diff --git a/drivers/tda19988/tda19988.c b/drivers/tda19988/tda19988.c index 8e2225a52..25176d10a 100644 --- a/drivers/tda19988/tda19988.c +++ b/drivers/tda19988/tda19988.c @@ -167,7 +167,7 @@ static int tda19988_blk_open(devminor_t minor, int access); static int tda19988_blk_close(devminor_t minor); 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, +static int tda19988_blk_ioctl(devminor_t minor, unsigned long request, 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); @@ -314,7 +314,7 @@ tda19988_blk_transfer(devminor_t minor, int do_write, u64_t pos64, } static int -tda19988_blk_ioctl(devminor_t minor, unsigned int request, endpoint_t endpt, +tda19988_blk_ioctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt)) { log_trace(&log, "tda19988_blk_ioctl(%d)\n", minor); diff --git a/drivers/virtio_blk/virtio_blk.c b/drivers/virtio_blk/virtio_blk.c index 5a13619c6..4583101c7 100644 --- a/drivers/virtio_blk/virtio_blk.c +++ b/drivers/virtio_blk/virtio_blk.c @@ -82,7 +82,7 @@ static int virtio_blk_close(devminor_t minor); static ssize_t virtio_blk_transfer(devminor_t minor, int write, u64_t position, endpoint_t endpt, iovec_t *iovec, 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 long req, 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); @@ -375,7 +375,7 @@ virtio_blk_transfer(devminor_t minor, int write, u64_t position, } static int -virtio_blk_ioctl(devminor_t minor, unsigned int req, endpoint_t endpt, +virtio_blk_ioctl(devminor_t minor, unsigned long req, endpoint_t endpt, cp_grant_id_t grant, endpoint_t UNUSED(user_endpt)) { switch (req) { diff --git a/include/minix/blockdriver.h b/include/minix/blockdriver.h index 0c172182b..d7e1e7d89 100644 --- a/include/minix/blockdriver.h +++ b/include/minix/blockdriver.h @@ -19,7 +19,7 @@ struct blockdriver { int (*bdr_close)(devminor_t minor); 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, + int (*bdr_ioctl)(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant, endpoint_t user_endpt); void (*bdr_cleanup)(void); struct device *(*bdr_part)(devminor_t minor); diff --git a/include/minix/com.h b/include/minix/com.h index 2bf4be570..60ae42ef7 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -1321,12 +1321,12 @@ #define BDEV_MINOR m10_i1 /* minor device number */ #define BDEV_STATUS m10_i1 /* OK or error code */ #define BDEV_ACCESS m10_i2 /* access bits for open requests */ -#define BDEV_REQUEST m10_i2 /* I/O control request */ #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_REQUEST m10_l2 /* I/O control request */ #define BDEV_POS_LO m10_l2 /* transfer position (low bits) */ #define BDEV_POS_HI m10_l3 /* transfer position (high bits) */ diff --git a/lib/libblockdriver/driver.c b/lib/libblockdriver/driver.c index aadc9b0a3..a6c002135 100644 --- a/lib/libblockdriver/driver.c +++ b/lib/libblockdriver/driver.c @@ -4,29 +4,29 @@ * Field names are prefixed with BDEV_. Separate field names are used for the * "access", "request", and "user" fields. * - * m_type MINOR COUNT GRANT FLAGS ID POS_LO POS_HI - * +--------------+--------+----------+-------+-------+------+------+------+ - * | BDEV_OPEN | minor | access | | | id | | | - * |--------------+--------+----------+-------+-------+------+------+------| - * | BDEV_CLOSE | minor | | | | id | | | - * |--------------+--------+----------+-------+-------+------+------+------| - * | BDEV_READ | minor | bytes | grant | flags | id | position | - * |--------------+--------+----------+-------+-------+------+------+------| - * | BDEV_WRITE | minor | bytes | grant | flags | id | position | - * |--------------+--------+----------+-------+-------+------+------+------| - * | BDEV_GATHER | minor | elements | grant | flags | id | position | - * |--------------+--------+----------+-------+-------+------+------+------| - * | BDEV_SCATTER | minor | elements | grant | flags | id | position | - * |--------------+--------+----------+-------+-------+------+------+------| - * | BDEV_IOCTL | minor | request | grant | user | id | | | - * ------------------------------------------------------------------------- + * m_type MINOR COUNT GRANT FLAGS ID POS_LO POS_HI + * +--------------+--------+----------+-------+-------+------+---------+------+ + * | BDEV_OPEN | minor | access | | | id | | | + * |--------------+--------+----------+-------+-------+------+---------+------| + * | BDEV_CLOSE | minor | | | | id | | | + * |--------------+--------+----------+-------+-------+------+---------+------| + * | BDEV_READ | minor | bytes | grant | flags | id | position | + * |--------------+--------+----------+-------+-------+------+---------+------| + * | BDEV_WRITE | minor | bytes | grant | flags | id | position | + * |--------------+--------+----------+-------+-------+------+---------+------| + * | BDEV_GATHER | minor | elements | grant | flags | id | position | + * |--------------+--------+----------+-------+-------+------+---------+------| + * | BDEV_SCATTER | minor | elements | grant | flags | id | position | + * |--------------+--------+----------+-------+-------+------+---------+------| + * | BDEV_IOCTL | minor | | grant | user | id | request | | + * ---------------------------------------------------------------------------- * * The following reply message is used for all requests. * * m_type STATUS ID - * +--------------+--------+----------+-------+-------+------+------+------+ - * | BDEV_REPLY | status | | | | id | | | - * ------------------------------------------------------------------------- + * +--------------+--------+----------+-------+-------+------+---------+------+ + * | BDEV_REPLY | status | | | | id | | | + * ---------------------------------------------------------------------------- * * Changes: * Oct 16, 2011 split character and block protocol (D.C. van Moolenbroek) @@ -263,7 +263,7 @@ static int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id) * do_dioctl * *===========================================================================*/ static int do_dioctl(struct blockdriver *bdp, dev_t minor, - unsigned int request, endpoint_t endpt, cp_grant_id_t grant) + unsigned long request, endpoint_t endpt, cp_grant_id_t grant) { /* Carry out a disk-specific I/O control request. */ struct device *dv; @@ -318,7 +318,7 @@ static int do_ioctl(struct blockdriver *bdp, message *mp) * has specified that it is a disk driver. */ dev_t minor; - unsigned int request; + unsigned long request; cp_grant_id_t grant; endpoint_t user_endpt; int r; diff --git a/lib/libblockdriver/trace.c b/lib/libblockdriver/trace.c index 395066847..555470266 100644 --- a/lib/libblockdriver/trace.c +++ b/lib/libblockdriver/trace.c @@ -48,7 +48,7 @@ static u32_t trace_gettime(void) /*===========================================================================* * trace_ctl * *===========================================================================*/ -int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt, +int trace_ctl(dev_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant) { /* Process a block trace control request. @@ -195,7 +195,7 @@ void trace_start(thread_id_t id, message *m_ptr) switch (m_ptr->m_type) { case BDEV_OPEN: case BDEV_CLOSE: - pos = ((u64_t)(0)); + pos = 0; size = m_ptr->BDEV_ACCESS; flags = 0; @@ -212,7 +212,7 @@ void trace_start(thread_id_t id, message *m_ptr) break; case BDEV_IOCTL: - pos = ((u64_t)(0)); + pos = 0; size = m_ptr->BDEV_REQUEST; flags = 0; diff --git a/lib/libblockdriver/trace.h b/lib/libblockdriver/trace.h index 4bf3bfdf4..bb15289d9 100644 --- a/lib/libblockdriver/trace.h +++ b/lib/libblockdriver/trace.h @@ -1,7 +1,7 @@ #ifndef _BLOCKDRIVER_TRACE_H #define _BLOCKDRIVER_TRACE_H -int trace_ctl(dev_t minor, unsigned int request, endpoint_t endpt, +int trace_ctl(dev_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant); void trace_start(thread_id_t thread_id, message *m_ptr);