From: David van Moolenbroek Date: Sun, 1 May 2016 12:48:46 +0000 (+0000) Subject: libchardriver: make some pointers constant X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=91d0779762c1076cc79ebf98392124badd86861a;p=minix.git libchardriver: make some pointers constant Change-Id: Ieabc6962d10f9f6e0db7807fd24add212bcfc148 --- diff --git a/minix/include/minix/chardriver.h b/minix/include/minix/chardriver.h index 48f67ae84..a6ac1dff6 100644 --- a/minix/include/minix/chardriver.h +++ b/minix/include/minix/chardriver.h @@ -24,11 +24,11 @@ struct chardriver { /* Functions defined by libchardriver. */ void chardriver_announce(void); -int chardriver_get_minor(message *m, devminor_t *minor); -void chardriver_process(struct chardriver *cdp, message *m_ptr, +int chardriver_get_minor(const message *m, devminor_t *minor); +void chardriver_process(const struct chardriver *cdp, message *m_ptr, int ipc_status); void chardriver_terminate(void); -void chardriver_task(struct chardriver *cdp); +void chardriver_task(const struct chardriver *cdp); void chardriver_reply_task(endpoint_t endpt, cdev_id_t id, int r); void chardriver_reply_select(endpoint_t endpt, devminor_t minor, int ops); diff --git a/minix/lib/libchardriver/chardriver.c b/minix/lib/libchardriver/chardriver.c index 6d1922dd4..12b95f391 100644 --- a/minix/lib/libchardriver/chardriver.c +++ b/minix/lib/libchardriver/chardriver.c @@ -276,7 +276,7 @@ static void chardriver_reply(message *mess, int ipc_status, int r) /*===========================================================================* * do_open * *===========================================================================*/ -static int do_open(struct chardriver *cdp, message *m_ptr) +static int do_open(const struct chardriver *cdp, message *m_ptr) { /* Open a minor device. */ endpoint_t user_endpt; @@ -307,7 +307,7 @@ static int do_open(struct chardriver *cdp, message *m_ptr) /*===========================================================================* * do_close * *===========================================================================*/ -static int do_close(struct chardriver *cdp, message *m_ptr) +static int do_close(const struct chardriver *cdp, message *m_ptr) { /* Close a minor device. */ devminor_t minor; @@ -325,7 +325,8 @@ static int do_close(struct chardriver *cdp, message *m_ptr) /*===========================================================================* * do_trasnfer * *===========================================================================*/ -static int do_transfer(struct chardriver *cdp, message *m_ptr, int do_write) +static int do_transfer(const struct chardriver *cdp, message *m_ptr, + int do_write) { /* Carry out a read or write task request. */ devminor_t minor; @@ -359,7 +360,7 @@ static int do_transfer(struct chardriver *cdp, message *m_ptr, int do_write) /*===========================================================================* * do_ioctl * *===========================================================================*/ -static int do_ioctl(struct chardriver *cdp, message *m_ptr) +static int do_ioctl(const struct chardriver *cdp, message *m_ptr) { /* Carry out an I/O control task request. */ devminor_t minor; @@ -388,7 +389,7 @@ static int do_ioctl(struct chardriver *cdp, message *m_ptr) /*===========================================================================* * do_cancel * *===========================================================================*/ -static int do_cancel(struct chardriver *cdp, message *m_ptr) +static int do_cancel(const struct chardriver *cdp, message *m_ptr) { /* Cancel a suspended (read, write, ioctl) task request. The original request * may already have finished, in which case no reply should be sent. @@ -412,7 +413,7 @@ static int do_cancel(struct chardriver *cdp, message *m_ptr) /*===========================================================================* * do_select * *===========================================================================*/ -static int do_select(struct chardriver *cdp, message *m_ptr) +static int do_select(const struct chardriver *cdp, message *m_ptr) { /* Perform a select query on a minor device. */ devminor_t minor; @@ -451,7 +452,8 @@ static void do_block_open(message *m_ptr, int ipc_status) /*===========================================================================* * chardriver_process * *===========================================================================*/ -void chardriver_process(struct chardriver *cdp, message *m_ptr, int ipc_status) +void chardriver_process(const struct chardriver *cdp, message *m_ptr, + int ipc_status) { /* Call the appropiate driver function, based on the type of request. Send a * reply to the caller if necessary. @@ -544,7 +546,7 @@ void chardriver_terminate(void) /*===========================================================================* * chardriver_task * *===========================================================================*/ -void chardriver_task(struct chardriver *cdp) +void chardriver_task(const struct chardriver *cdp) { /* Main program of any character device driver task. */ int r, ipc_status; @@ -570,7 +572,7 @@ void chardriver_task(struct chardriver *cdp) /*===========================================================================* * chardriver_get_minor * *===========================================================================*/ -int chardriver_get_minor(message *m, devminor_t *minor) +int chardriver_get_minor(const message *m, devminor_t *minor) { assert(NULL != m); assert(NULL != minor);