bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/8] i386: qualify pointers whose dereferenced values are constan


From: Marin Ramesa
Subject: [PATCH 2/8] i386: qualify pointers whose dereferenced values are constant with const
Date: Mon, 16 Dec 2013 23:55:13 +0100

---
 i386/i386/ast_check.c    |  4 ++--
 i386/i386/db_disasm.c    | 10 +++++-----
 i386/i386/db_interface.c | 14 +++++++-------
 i386/i386/db_interface.h |  2 +-
 i386/i386/db_trace.c     | 14 +++++++-------
 i386/i386/debug.h        |  2 +-
 i386/i386/debug_i386.c   |  2 +-
 i386/i386/fpu.c          |  4 ++--
 i386/i386/hardclock.c    |  8 ++++----
 i386/i386/io_perm.c      |  2 +-
 i386/i386/loose_ends.c   |  4 ++--
 i386/i386/machine_task.c |  2 +-
 i386/i386/mp_desc.c      |  2 +-
 i386/i386/pcb.c          |  4 ++--
 i386/i386/pcb.h          |  2 +-
 i386/i386/trap.c         |  2 +-
 i386/i386/user_ldt.c     |  4 ++--
 i386/i386at/autoconf.c   |  4 ++--
 i386/i386at/kd_event.c   |  2 +-
 i386/i386at/kd_queue.c   |  4 ++--
 i386/i386at/kd_queue.h   |  4 ++--
 21 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/i386/i386/ast_check.c b/i386/i386/ast_check.c
index 61c68da..f3e1c35 100644
--- a/i386/i386/ast_check.c
+++ b/i386/i386/ast_check.c
@@ -38,7 +38,7 @@
  * Initialize for remote invocation of ast_check.
  */
 void init_ast_check(processor)
-       processor_t     processor;
+       const processor_t processor;
 {
 }
 
@@ -46,7 +46,7 @@ void init_ast_check(processor)
  * Cause remote invocation of ast_check.  Caller is at splsched().
  */
 void cause_ast_check(processor)
-       processor_t     processor;
+       const processor_t processor;
 {
 }
 
diff --git a/i386/i386/db_disasm.c b/i386/i386/db_disasm.c
index e15293b..4afbcf3 100644
--- a/i386/i386/db_disasm.c
+++ b/i386/i386/db_disasm.c
@@ -950,10 +950,10 @@ db_read_address(
 
 void
 db_print_address(
-       char *          seg,
-       int             size,
-       struct i_addr   *addrp,
-       task_t          task)
+       const char *            seg,
+       int                     size,
+       const struct i_addr     *addrp,
+       task_t                  task)
 {
        if (addrp->is_reg) {
            db_printf("%s", db_reg[size][addrp->disp]);
@@ -986,7 +986,7 @@ db_disasm_esc(
        int             inst,
        int             short_addr,
        int             size,
-       char *          seg,
+       const char *    seg,
        task_t          task)
 {
        int             regmodrm;
diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c
index f07c12c..ca58ff3 100644
--- a/i386/i386/db_interface.c
+++ b/i386/i386/db_interface.c
@@ -172,8 +172,8 @@ void db_dr (
 
 boolean_t
 db_set_hw_watchpoint(
-       db_watchpoint_t watch,
-       unsigned        num)
+       const db_watchpoint_t   watch,
+       unsigned                num)
 {
        vm_size_t       size = watch->hiaddr - watch->loaddr;
        db_addr_t       addr = watch->loaddr;
@@ -410,7 +410,7 @@ boolean_t db_no_vm_fault = TRUE;
 
 int
 db_user_to_kernel_address(
-       task_t          task,
+       const task_t    task,
        vm_offset_t     addr,
        vm_offset_t     *kaddr,
        int             flag)
@@ -617,7 +617,7 @@ boolean_t
 db_phys_eq(
        task_t          task1,
        vm_offset_t     addr1,
-       task_t          task2,
+       const task_t    task2,
        vm_offset_t     addr2)
 {
        vm_offset_t     kern_addr1, kern_addr2;
@@ -645,7 +645,7 @@ db_phys_eq(
 #ifndef GNU
 static boolean_t
 db_search_null(
-       task_t          task,
+       const task_t    task,
        vm_offset_t     *svaddr,
        vm_offset_t     evaddr,
        vm_offset_t     *skaddr,
@@ -678,7 +678,7 @@ db_search_null(
 #ifdef GNU
 static boolean_t
 looks_like_command(
-       task_t          task,
+       const task_t    task,
        char*           kaddr)
 {
        char *c;
@@ -722,7 +722,7 @@ looks_like_command(
 
 void
 db_task_name(
-       task_t          task)
+       const task_t task)
 {
        char *p;
        int n;
diff --git a/i386/i386/db_interface.h b/i386/i386/db_interface.h
index d41a97d..97ff5c7 100644
--- a/i386/i386/db_interface.h
+++ b/i386/i386/db_interface.h
@@ -95,7 +95,7 @@ db_stack_trace_cmd(
        db_expr_t       addr,
        boolean_t       have_addr,
        db_expr_t       count,
-       char            *modif);
+       const char      *modif);
 
 extern void
 db_reset_cpu(void);
diff --git a/i386/i386/db_trace.c b/i386/i386/db_trace.c
index d0c434e..0f0bbdc 100644
--- a/i386/i386/db_trace.c
+++ b/i386/i386/db_trace.c
@@ -107,8 +107,8 @@ struct i386_kregs {
 
 long *
 db_lookup_i386_kreg(
-       char    *name,
-       long    *kregp)
+       const char *name,
+       const long *kregp)
 {
        struct i386_kregs *kp;
 
@@ -259,7 +259,7 @@ db_nextframe(
        struct i386_frame **fp,         /* in/out */
        db_addr_t         *ip,          /* out */
        long              frame_type,   /* in */
-       thread_t          thread)       /* in */
+       const thread_t    thread)       /* in */
 {
        struct i386_saved_state *saved_regs;
        struct interrupt_frame *ifp;
@@ -321,7 +321,7 @@ db_stack_trace_cmd(
        db_expr_t       addr,
        boolean_t       have_addr,
        db_expr_t       count,
-       char            *modif)
+       const char      *modif)
 {
        boolean_t       trace_thread = FALSE;
        struct i386_frame *frame;
@@ -330,7 +330,7 @@ db_stack_trace_cmd(
        thread_t        th;
 
        {
-           char *cp = modif;
+           const char *cp = modif;
            char c;
 
            while ((c = *cp++) != 0) {
@@ -399,7 +399,7 @@ db_stack_trace_cmd(
 
 void
 db_i386_stack_trace(
-       thread_t        th,
+       const thread_t  th,
        struct i386_frame *frame,
        db_addr_t       callpc,
        db_expr_t       count,
@@ -633,7 +633,7 @@ void db_trace_cproc(
 }
 
 void db_all_cprocs(
-       task_t          task,
+       const task_t    task,
        db_expr_t       cproc_list)
 {
        jmp_buf_t       db_jmpbuf;
diff --git a/i386/i386/debug.h b/i386/i386/debug.h
index f87b95b..e94649b 100644
--- a/i386/i386/debug.h
+++ b/i386/i386/debug.h
@@ -26,7 +26,7 @@
 /* Dump a saved state.
    Probably a good idea to have this around
    even when DEBUG isn't turned on.  */
-void dump_ss(struct i386_saved_state *st);
+void dump_ss(const struct i386_saved_state *st);
 
 #ifdef DEBUG
 
diff --git a/i386/i386/debug_i386.c b/i386/i386/debug_i386.c
index 01f26a0..7657808 100644
--- a/i386/i386/debug_i386.c
+++ b/i386/i386/debug_i386.c
@@ -27,7 +27,7 @@
 #include "trap.h"
 #include "debug.h"
 
-void dump_ss(struct i386_saved_state *st)
+void dump_ss(const struct i386_saved_state *st)
 {
        printf("Dump of i386_saved_state %p:\n", st);
        printf("EAX %08lx EBX %08lx ECX %08lx EDX %08lx\n",
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index b1aed91..fd5f4b6 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -292,7 +292,7 @@ twd_fxsr_to_i387 (struct i386_xfp_save *fxsave)
  */
 kern_return_t
 fpu_set_state(thread, state)
-       thread_t        thread;
+       const thread_t          thread;
        struct i386_float_state *state;
 {
        pcb_t pcb = thread->pcb;
@@ -403,7 +403,7 @@ ASSERT_IPL(SPL0);
  */
 kern_return_t
 fpu_get_state(thread, state)
-       thread_t        thread;
+       const thread_t          thread;
        struct i386_float_state *state;
 {
        pcb_t pcb = thread->pcb;
diff --git a/i386/i386/hardclock.c b/i386/i386/hardclock.c
index f119c6b..d262e11 100644
--- a/i386/i386/hardclock.c
+++ b/i386/i386/hardclock.c
@@ -47,10 +47,10 @@ extern char return_to_iret[];
 
 void
 hardclock(iunit,        old_ipl, irq, ret_addr, regs)
-        int     iunit;          /* 'unit' number */
-       int     old_ipl;        /* old interrupt level */
-       int     irq;            /* irq number */
-       char *  ret_addr;       /* return address in interrupt handler */
+       int             iunit;          /* 'unit' number */
+       int             old_ipl;        /* old interrupt level */
+       int             irq;            /* irq number */
+       const char *    ret_addr;       /* return address in interrupt handler 
*/
        struct i386_interrupt_state *regs;
                                /* saved registers */
 {
diff --git a/i386/i386/io_perm.c b/i386/i386/io_perm.c
index 4704275..6a6e660 100644
--- a/i386/i386/io_perm.c
+++ b/i386/i386/io_perm.c
@@ -175,7 +175,7 @@ io_bitmap_clear (unsigned char *iopb, io_port_t from, 
io_port_t to)
 
    The function is exported.  */
 kern_return_t
-i386_io_perm_create (ipc_port_t master_port, io_port_t from, io_port_t to,
+i386_io_perm_create (const ipc_port_t master_port, io_port_t from, io_port_t 
to,
                     io_perm_t *new)
 {
   if (master_port != master_device_port)
diff --git a/i386/i386/loose_ends.c b/i386/i386/loose_ends.c
index 30e7763..bb2e5b6 100644
--- a/i386/i386/loose_ends.c
+++ b/i386/i386/loose_ends.c
@@ -54,8 +54,8 @@ delay(n)
  * levels of return pc information.
  */
 void machine_callstack(
-       unsigned long   *buf,
-       int             callstack_max)
+       const unsigned long     *buf,
+       int                     callstack_max)
 {
 }
 
diff --git a/i386/i386/machine_task.c b/i386/i386/machine_task.c
index 62b22e3..490b102 100644
--- a/i386/i386/machine_task.c
+++ b/i386/i386/machine_task.c
@@ -55,7 +55,7 @@ machine_task_init (task_t task)
 /* Destroy the machine specific part of task TASK and release all
    associated resources.  */
 void
-machine_task_terminate (task_t task)
+machine_task_terminate (const task_t task)
 {
   if (task->machine.iopb)
     kmem_cache_free (&machine_task_iopb_cache,
diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c
index 5ede8f1..4ff5e61 100644
--- a/i386/i386/mp_desc.c
+++ b/i386/i386/mp_desc.c
@@ -238,7 +238,7 @@ simple_lock_pause(void)
 }
 
 kern_return_t
-cpu_control(int cpu, int *info, unsigned int count)
+cpu_control(int cpu, const int *info, unsigned int count)
 {
        printf("cpu_control(%d, %p, %d) not implemented\n",
               cpu, info, count);
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index 82b2faf..a0578d1 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -429,7 +429,7 @@ void pcb_terminate(thread)
  */
 
 void pcb_collect(thread)
-       thread_t thread;
+       const thread_t thread;
 {
 }
 
@@ -827,7 +827,7 @@ vm_offset_t
 set_user_regs(stack_base, stack_size, exec_info, arg_size)
        vm_offset_t     stack_base;     /* low address */
        vm_offset_t     stack_size;
-       struct exec_info *exec_info;
+       const struct exec_info *exec_info;
        vm_size_t       arg_size;
 {
        vm_offset_t     arg_addr;
diff --git a/i386/i386/pcb.h b/i386/i386/pcb.h
index b2e5f07..708f30d 100644
--- a/i386/i386/pcb.h
+++ b/i386/i386/pcb.h
@@ -58,7 +58,7 @@ extern vm_offset_t user_stack_low (vm_size_t stack_size);
 extern vm_offset_t set_user_regs (
    vm_offset_t stack_base,
    vm_offset_t stack_size,
-   struct exec_info *exec_info,
+   const struct exec_info *exec_info,
    vm_size_t   arg_size);
 
 extern void load_context (thread_t new);
diff --git a/i386/i386/trap.c b/i386/i386/trap.c
index 9796940..391b600 100644
--- a/i386/i386/trap.c
+++ b/i386/i386/trap.c
@@ -626,7 +626,7 @@ i386_exception(exc, code, subcode)
  */
 unsigned
 interrupted_pc(t)
-       thread_t t;
+       const thread_t t;
 {
        struct i386_saved_state *iss;
 
diff --git a/i386/i386/user_ldt.c b/i386/i386/user_ldt.c
index 07be0a0..a83bc12 100644
--- a/i386/i386/user_ldt.c
+++ b/i386/i386/user_ldt.c
@@ -255,7 +255,7 @@ i386_set_ldt(thread, first_selector, desc_list, count, 
desc_list_inline)
 
 kern_return_t
 i386_get_ldt(thread, first_selector, selector_count, desc_list, count)
-       thread_t        thread;
+       const thread_t  thread;
        int             first_selector;
        int             selector_count;         /* number wanted */
        struct real_descriptor **desc_list;     /* in/out */
@@ -431,7 +431,7 @@ i386_set_gdt (thread_t thread, int *selector, struct 
real_descriptor desc)
 }
 
 kern_return_t
-i386_get_gdt (thread_t thread, int selector, struct real_descriptor *desc)
+i386_get_gdt (const thread_t thread, int selector, struct real_descriptor 
*desc)
 {
   if (thread == THREAD_NULL)
     return KERN_INVALID_ARGUMENT;
diff --git a/i386/i386at/autoconf.c b/i386/i386at/autoconf.c
index 31bb73c..908c3ec 100644
--- a/i386/i386at/autoconf.c
+++ b/i386/i386at/autoconf.c
@@ -122,7 +122,7 @@ void probeio(void)
 }
 
 void take_dev_irq(
-       struct bus_device *dev)
+       const struct bus_device *dev)
 {
        int pic = (int)dev->sysdep1;
 
@@ -144,7 +144,7 @@ void take_dev_irq(
 }
 
 void take_ctlr_irq(
-       struct bus_ctlr *ctlr)
+       const struct bus_ctlr *ctlr)
 {
        int pic = ctlr->sysdep1;
        if (intpri[pic] == 0) {
diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c
index ac87b20..30a7f77 100644
--- a/i386/i386at/kd_event.c
+++ b/i386/i386at/kd_event.c
@@ -311,7 +311,7 @@ int   X_kdb_enter_len = 0,  X_kdb_exit_len = 0;
 
 void
 kdb_in_out(p)
-u_int *p;
+const u_int *p;
 {
        int t = p[0];
 
diff --git a/i386/i386at/kd_queue.c b/i386/i386at/kd_queue.c
index 2b83044..2086eb1 100644
--- a/i386/i386at/kd_queue.c
+++ b/i386/i386at/kd_queue.c
@@ -72,14 +72,14 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 boolean_t
 kdq_empty(q)
-       kd_event_queue *q;
+       const kd_event_queue *q;
 {
        return(q->firstfree == q->firstout);
 }
 
 boolean_t
 kdq_full(q)
-       kd_event_queue *q;
+       const kd_event_queue *q;
 {
        return(q_next(q->firstfree) == q->firstout);
 }
diff --git a/i386/i386at/kd_queue.h b/i386/i386at/kd_queue.h
index bd3fc7b..702efe8 100644
--- a/i386/i386at/kd_queue.h
+++ b/i386/i386at/kd_queue.h
@@ -79,8 +79,8 @@ typedef struct {
 
 extern void kdq_put(kd_event_queue *, kd_event *);
 extern void kdq_reset(kd_event_queue *);
-extern boolean_t kdq_empty(kd_event_queue *);
-extern boolean_t kdq_full(kd_event_queue *);
+extern boolean_t kdq_empty(const kd_event_queue *);
+extern boolean_t kdq_full(const kd_event_queue *);
 extern kd_event *kdq_get(kd_event_queue *);
 
 #endif /* _KD_QUEUE_H_ */
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]