[PATCH 22/23] monitor: Add const qualifier

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 6 12:56:44 UTC 2012


---
 cpukit/libmisc/monitor/mon-config.c    |   11 ++++----
 cpukit/libmisc/monitor/mon-driver.c    |   10 ++++----
 cpukit/libmisc/monitor/mon-extension.c |    6 ++--
 cpukit/libmisc/monitor/mon-itask.c     |    8 +++---
 cpukit/libmisc/monitor/mon-manager.c   |    2 +-
 cpukit/libmisc/monitor/mon-mpci.c      |    6 ++--
 cpukit/libmisc/monitor/mon-object.c    |    6 ++--
 cpukit/libmisc/monitor/mon-part.c      |    4 +-
 cpukit/libmisc/monitor/mon-queue.c     |    4 +-
 cpukit/libmisc/monitor/mon-region.c    |    4 +-
 cpukit/libmisc/monitor/mon-sema.c      |    4 +-
 cpukit/libmisc/monitor/mon-symbols.c   |   10 ++++----
 cpukit/libmisc/monitor/mon-task.c      |    4 +-
 cpukit/libmisc/monitor/monitor.h       |   40 ++++++++++++++++----------------
 14 files changed, 60 insertions(+), 59 deletions(-)

diff --git a/cpukit/libmisc/monitor/mon-config.c b/cpukit/libmisc/monitor/mon-config.c
index b5bc31c..d10c14c 100644
--- a/cpukit/libmisc/monitor/mon-config.c
+++ b/cpukit/libmisc/monitor/mon-config.c
@@ -27,10 +27,11 @@
 void
 rtems_monitor_config_canonical(
     rtems_monitor_config_t *canonical_config,
-    void                   *config_void
+    const void             *config_void
 )
 {
-    rtems_configuration_table *c = (rtems_configuration_table *) config_void;
+    const rtems_configuration_table *c =
+        (const rtems_configuration_table *) config_void;
     rtems_api_configuration_table *r = &Configuration_RTEMS_API;
 
     canonical_config->work_space_size = c->work_space_size;
@@ -53,14 +54,14 @@ rtems_monitor_config_canonical(
  *    other nodes...)
  */
 
-void *
+const void *
 rtems_monitor_config_next(
     void                  *object_info __attribute__((unused)),
     rtems_monitor_config_t *canonical_config __attribute__((unused)),
     rtems_id              *next_id
 )
 {
-    rtems_configuration_table *c = &Configuration;
+    const rtems_configuration_table *c = &Configuration;
     int n = rtems_object_id_get_index(*next_id);
 
     if (n >= 1)
@@ -69,7 +70,7 @@ rtems_monitor_config_next(
     _Thread_Disable_dispatch();
 
     *next_id += 1;
-    return (void *) c;
+    return (const void *) c;
 
 failed:
     *next_id = RTEMS_OBJECT_ID_FINAL;
diff --git a/cpukit/libmisc/monitor/mon-driver.c b/cpukit/libmisc/monitor/mon-driver.c
index 9fff2cd..7fc520f 100644
--- a/cpukit/libmisc/monitor/mon-driver.c
+++ b/cpukit/libmisc/monitor/mon-driver.c
@@ -37,10 +37,10 @@
 void
 rtems_monitor_driver_canonical(
     rtems_monitor_driver_t *canonical_driver,
-    void                   *driver_void
+    const void             *driver_void
 )
 {
-    rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
+    const rtems_driver_address_table *d = (const rtems_driver_address_table *) driver_void;
 
     rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
                                             (void *) d->initialization_entry);
@@ -58,14 +58,14 @@ rtems_monitor_driver_canonical(
 }
 
 
-void *
+const void *
 rtems_monitor_driver_next(
     void                  *object_info __attribute__((unused)),
     rtems_monitor_driver_t *canonical_driver,
     rtems_id              *next_id
 )
 {
-    rtems_configuration_table *c = &Configuration;
+    const rtems_configuration_table *c = &Configuration;
     uint32_t   n = rtems_object_id_get_index(*next_id);
 
     if (n >= c->number_of_device_drivers)
@@ -81,7 +81,7 @@ rtems_monitor_driver_next(
     canonical_driver->name = rtems_build_name('-', '-', '-', '-');
 
     *next_id += 1;
-    return (void *) (c->Device_driver_table + n);
+    return (const void *) (c->Device_driver_table + n);
 
 failed:
     *next_id = RTEMS_OBJECT_ID_FINAL;
diff --git a/cpukit/libmisc/monitor/mon-extension.c b/cpukit/libmisc/monitor/mon-extension.c
index 3f7bccc..e7e4424 100644
--- a/cpukit/libmisc/monitor/mon-extension.c
+++ b/cpukit/libmisc/monitor/mon-extension.c
@@ -14,11 +14,11 @@
 void
 rtems_monitor_extension_canonical(
     rtems_monitor_extension_t *canonical_extension,
-    void                  *extension_void
+    const void                *extension_void
 )
 {
-    Extension_Control     *rtems_extension = (Extension_Control *) extension_void;
-    rtems_extensions_table *e = &rtems_extension->Extension.Callouts;
+    const Extension_Control *rtems_extension = (const Extension_Control *) extension_void;
+    const rtems_extensions_table *e = &rtems_extension->Extension.Callouts;
 
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_create,
                                             (void *) e->thread_create);
diff --git a/cpukit/libmisc/monitor/mon-itask.c b/cpukit/libmisc/monitor/mon-itask.c
index e951bcb..8544761 100644
--- a/cpukit/libmisc/monitor/mon-itask.c
+++ b/cpukit/libmisc/monitor/mon-itask.c
@@ -19,10 +19,10 @@
 void
 rtems_monitor_init_task_canonical(
     rtems_monitor_init_task_t *canonical_itask,
-    void                  *itask_void
+    const void                *itask_void
 )
 {
-    rtems_initialization_tasks_table *rtems_itask = itask_void;
+    const rtems_initialization_tasks_table *rtems_itask = itask_void;
 
     rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry,
                                             (void *) rtems_itask->entry_point);
@@ -34,7 +34,7 @@ rtems_monitor_init_task_canonical(
     canonical_itask->attributes = rtems_itask->attribute_set;
 }
 
-void *
+const void *
 rtems_monitor_init_task_next(
     void                  *object_info __attribute__((unused)),
     rtems_monitor_init_task_t *canonical_init_task,
@@ -59,7 +59,7 @@ rtems_monitor_init_task_next(
     canonical_init_task->name = itask->name;
 
     *next_id += 1;
-    return (void *) itask;
+    return (const void *) itask;
 
 failed:
     *next_id = RTEMS_OBJECT_ID_FINAL;
diff --git a/cpukit/libmisc/monitor/mon-manager.c b/cpukit/libmisc/monitor/mon-manager.c
index f0ea29d..99c28ac 100644
--- a/cpukit/libmisc/monitor/mon-manager.c
+++ b/cpukit/libmisc/monitor/mon-manager.c
@@ -16,7 +16,7 @@
  * "next" routine for all objects that are RTEMS manager objects
  */
 
-void *
+const void *
 rtems_monitor_manager_next(
     void      *table_void,
     void      *canonical,
diff --git a/cpukit/libmisc/monitor/mon-mpci.c b/cpukit/libmisc/monitor/mon-mpci.c
index fe78da3..84f5014 100644
--- a/cpukit/libmisc/monitor/mon-mpci.c
+++ b/cpukit/libmisc/monitor/mon-mpci.c
@@ -29,7 +29,7 @@ rtems_monitor_mpci_canonical(
     void                  *config_void
 )
 {
-    rtems_configuration_table *c = &Configuration;
+    const rtems_configuration_table *c = &Configuration;
     rtems_multiprocessing_table *m;
     rtems_mpci_table *mt;
 
@@ -64,14 +64,14 @@ rtems_monitor_mpci_canonical(
  *    other nodes...)
  */
 
-void *
+const void *
 rtems_monitor_mpci_next(
     void                  *object_info,
     rtems_monitor_mpci_t  *canonical_mpci,
     rtems_id              *next_id
 )
 {
-    rtems_configuration_table *c = &Configuration;
+    const rtems_configuration_table *c = &Configuration;
     int n = rtems_object_id_get_index(*next_id);
 
     if (n >= 1)
diff --git a/cpukit/libmisc/monitor/mon-object.c b/cpukit/libmisc/monitor/mon-object.c
index fd2b20f..77f95be 100644
--- a/cpukit/libmisc/monitor/mon-object.c
+++ b/cpukit/libmisc/monitor/mon-object.c
@@ -234,8 +234,8 @@ rtems_monitor_object_canonical_next(
     void                        *canonical
 )
 {
-  rtems_id  next_id;
-  void     *raw_item;
+  rtems_id    next_id;
+  const void *raw_item;
 
 #if defined(RTEMS_MULTIPROCESSING)
     if ( ! _Objects_Is_local_id(id) ) {
@@ -249,7 +249,7 @@ rtems_monitor_object_canonical_next(
     {
       next_id = id;
 
-      raw_item = (void *) info->next(
+      raw_item = info->next(
         info->object_information,
         canonical,
         &next_id
diff --git a/cpukit/libmisc/monitor/mon-part.c b/cpukit/libmisc/monitor/mon-part.c
index 2ce922f..19e2d1c 100644
--- a/cpukit/libmisc/monitor/mon-part.c
+++ b/cpukit/libmisc/monitor/mon-part.c
@@ -15,10 +15,10 @@
 void
 rtems_monitor_part_canonical(
     rtems_monitor_part_t  *canonical_part,
-    void                  *part_void
+    const void            *part_void
 )
 {
-    Partition_Control *rtems_part = (Partition_Control *) part_void;
+    const Partition_Control *rtems_part = (const Partition_Control *) part_void;
 
     canonical_part->attribute = rtems_part->attribute_set;
     canonical_part->start_addr = rtems_part->starting_address;
diff --git a/cpukit/libmisc/monitor/mon-queue.c b/cpukit/libmisc/monitor/mon-queue.c
index 23a6b69..962e834 100644
--- a/cpukit/libmisc/monitor/mon-queue.c
+++ b/cpukit/libmisc/monitor/mon-queue.c
@@ -10,10 +10,10 @@
 void
 rtems_monitor_queue_canonical(
     rtems_monitor_queue_t *canonical_queue,
-    void                  *queue_void
+    const void            *queue_void
 )
 {
-    Message_queue_Control *rtems_queue = (Message_queue_Control *) queue_void;
+    const Message_queue_Control *rtems_queue = (const Message_queue_Control *) queue_void;
 
     canonical_queue->attributes = rtems_queue->attribute_set;
     canonical_queue->maximum_message_size = rtems_queue->message_queue.maximum_message_size;
diff --git a/cpukit/libmisc/monitor/mon-region.c b/cpukit/libmisc/monitor/mon-region.c
index 911b8f2..99b98c8 100644
--- a/cpukit/libmisc/monitor/mon-region.c
+++ b/cpukit/libmisc/monitor/mon-region.c
@@ -15,10 +15,10 @@
 void
 rtems_monitor_region_canonical(
     rtems_monitor_region_t  *canonical_region,
-    void                  *region_void
+    const void              *region_void
 )
 {
-    Region_Control *rtems_region = (Region_Control *) region_void;
+    const Region_Control *rtems_region = (const Region_Control *) region_void;
 
     canonical_region->attribute = rtems_region->attribute_set;
     canonical_region->start_addr = rtems_region->starting_address;
diff --git a/cpukit/libmisc/monitor/mon-sema.c b/cpukit/libmisc/monitor/mon-sema.c
index 21cb43a..b588ddc 100644
--- a/cpukit/libmisc/monitor/mon-sema.c
+++ b/cpukit/libmisc/monitor/mon-sema.c
@@ -15,10 +15,10 @@
 void
 rtems_monitor_sema_canonical(
     rtems_monitor_sema_t  *canonical_sema,
-    void                  *sema_void
+    const void            *sema_void
 )
 {
-    Semaphore_Control       *rtems_sema = (Semaphore_Control *) sema_void;
+    const Semaphore_Control *rtems_sema = (const Semaphore_Control *) sema_void;
 
     canonical_sema->attribute = rtems_sema->attribute_set;
     canonical_sema->priority_ceiling =
diff --git a/cpukit/libmisc/monitor/mon-symbols.c b/cpukit/libmisc/monitor/mon-symbols.c
index 9362481..0d1f1c9 100644
--- a/cpukit/libmisc/monitor/mon-symbols.c
+++ b/cpukit/libmisc/monitor/mon-symbols.c
@@ -139,9 +139,9 @@ static int
 rtems_symbol_compare(const void *e1,
                      const void *e2)
 {
-    rtems_symbol_t *s1, *s2;
-    s1 = (rtems_symbol_t *) e1;
-    s2 = (rtems_symbol_t *) e2;
+    const rtems_symbol_t *s1, *s2;
+    s1 = (const rtems_symbol_t *) e1;
+    s2 = (const rtems_symbol_t *) e2;
 
     if (s1->value < s2->value)
         return -1;
@@ -297,7 +297,7 @@ rtems_symbol_name_lookup(
     return NULL;
 }
 
-void *
+const void *
 rtems_monitor_symbol_next(
     void                   *object_info,
     rtems_monitor_symbol_t *canonical __attribute__((unused)),
@@ -322,7 +322,7 @@ rtems_monitor_symbol_next(
     _Thread_Disable_dispatch();
 
     *next_id += 1;
-    return (void *) (table->addresses + n);
+    return (const void *) (table->addresses + n);
 
 failed:
     *next_id = RTEMS_OBJECT_ID_FINAL;
diff --git a/cpukit/libmisc/monitor/mon-task.c b/cpukit/libmisc/monitor/mon-task.c
index c728df2..c2218b5 100644
--- a/cpukit/libmisc/monitor/mon-task.c
+++ b/cpukit/libmisc/monitor/mon-task.c
@@ -15,10 +15,10 @@
 void
 rtems_monitor_task_canonical(
     rtems_monitor_task_t  *canonical_task,
-    void                  *thread_void
+    const void            *thread_void
 )
 {
-    Thread_Control       *rtems_thread = (Thread_Control *) thread_void;
+    const Thread_Control *rtems_thread = (const Thread_Control *) thread_void;
     RTEMS_API_Control    *api;
 
     api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
diff --git a/cpukit/libmisc/monitor/monitor.h b/cpukit/libmisc/monitor/monitor.h
index 6d0612c..ba3a61e 100644
--- a/cpukit/libmisc/monitor/monitor.h
+++ b/cpukit/libmisc/monitor/monitor.h
@@ -350,8 +350,8 @@ struct rtems_monitor_command_entry_s {
 };
 
 
-typedef void *(*rtems_monitor_object_next_fn)(void *, void *, rtems_id *);
-typedef void (*rtems_monitor_object_canonical_fn)(void *, void *);
+typedef const void *(*rtems_monitor_object_next_fn)(void *, void *, rtems_id *);
+typedef void (*rtems_monitor_object_canonical_fn)(void *, const void *);
 typedef void (*rtems_monitor_object_dump_header_fn)(bool);
 typedef void (*rtems_monitor_object_dump_fn)(void *, bool);
 
@@ -418,66 +418,66 @@ rtems_id   rtems_monitor_id_fixup(rtems_id, uint32_t  , rtems_monitor_object_typ
 const rtems_monitor_object_info_t *rtems_monitor_object_lookup(rtems_monitor_object_type_t type);
 rtems_id   rtems_monitor_object_canonical_get(rtems_monitor_object_type_t, rtems_id, void *, size_t *size_p);
 rtems_id   rtems_monitor_object_canonical_next(const rtems_monitor_object_info_t *, rtems_id, void *);
-void      *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *);
-rtems_id   rtems_monitor_object_canonical(rtems_id, void *);
+const void *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *);
+rtems_id   rtems_monitor_object_canonical(rtems_id, const void *);
 void       rtems_monitor_object_cmd(int, char **, const rtems_monitor_command_arg_t*, bool);
 
 /* manager.c */
-void      *rtems_monitor_manager_next(void *, void *, rtems_id *);
+const void *rtems_monitor_manager_next(void *, void *, rtems_id *);
 
 /* config.c */
-void       rtems_monitor_config_canonical(rtems_monitor_config_t *, void *);
-void      *rtems_monitor_config_next(void *, rtems_monitor_config_t *, rtems_id *);
+void       rtems_monitor_config_canonical(rtems_monitor_config_t *, const void *);
+const void *rtems_monitor_config_next(void *, rtems_monitor_config_t *, rtems_id *);
 void       rtems_monitor_config_dump_header(bool);
 int        rtems_monitor_config_dump(rtems_monitor_config_t *, bool verbose);
 
 /* mpci.c */
 #if defined(RTEMS_MULTIPROCESSING)
-void       rtems_monitor_mpci_canonical(rtems_monitor_mpci_t *, void *);
-void      *rtems_monitor_mpci_next(void *, rtems_monitor_mpci_t *, rtems_id *);
+void       rtems_monitor_mpci_canonical(rtems_monitor_mpci_t *, const void *);
+const void *rtems_monitor_mpci_next(void *, rtems_monitor_mpci_t *, rtems_id *);
 void       rtems_monitor_mpci_dump_header(bool);
 void       rtems_monitor_mpci_dump(rtems_monitor_mpci_t *, bool verbose);
 #endif
 
 /* itask.c */
-void       rtems_monitor_init_task_canonical(rtems_monitor_init_task_t *, void *);
-void      *rtems_monitor_init_task_next(void *, rtems_monitor_init_task_t *, rtems_id *);
+void       rtems_monitor_init_task_canonical(rtems_monitor_init_task_t *, const void *);
+const void *rtems_monitor_init_task_next(void *, rtems_monitor_init_task_t *, rtems_id *);
 void       rtems_monitor_init_task_dump_header(bool);
 void       rtems_monitor_init_task_dump(rtems_monitor_init_task_t *, bool verbose);
 
 /* extension.c */
-void       rtems_monitor_extension_canonical(rtems_monitor_extension_t *, void *);
+void       rtems_monitor_extension_canonical(rtems_monitor_extension_t *, const void *);
 void       rtems_monitor_extension_dump_header(bool verbose);
 void       rtems_monitor_extension_dump(rtems_monitor_extension_t *, bool);
 
 /* task.c */
-void    rtems_monitor_task_canonical(rtems_monitor_task_t *, void *);
+void    rtems_monitor_task_canonical(rtems_monitor_task_t *, const void *);
 void    rtems_monitor_task_dump_header(bool verbose);
 void    rtems_monitor_task_dump(rtems_monitor_task_t *, bool);
 
 /* sema.c */
-void    rtems_monitor_sema_canonical(rtems_monitor_sema_t *, void *);
+void    rtems_monitor_sema_canonical(rtems_monitor_sema_t *, const void *);
 void    rtems_monitor_sema_dump_header(bool verbose);
 void    rtems_monitor_sema_dump(rtems_monitor_sema_t *, bool);
 
 /* queue.c */
-void    rtems_monitor_queue_canonical(rtems_monitor_queue_t *, void *);
+void    rtems_monitor_queue_canonical(rtems_monitor_queue_t *, const void *);
 void    rtems_monitor_queue_dump_header(bool verbose);
 void    rtems_monitor_queue_dump(rtems_monitor_queue_t *, bool);
 
 /* region.c */
-void    rtems_monitor_region_canonical(rtems_monitor_region_t *, void *);
+void    rtems_monitor_region_canonical(rtems_monitor_region_t *, const void *);
 void    rtems_monitor_region_dump_header(bool verbose);
 void    rtems_monitor_region_dump(rtems_monitor_region_t *, bool);
 
 /* partition.c */
-void    rtems_monitor_part_canonical(rtems_monitor_part_t *, void *);
+void    rtems_monitor_part_canonical(rtems_monitor_part_t *, const void *);
 void    rtems_monitor_part_dump_header(bool verbose);
 void    rtems_monitor_part_dump(rtems_monitor_part_t *, bool);
 
 /* driver.c */
-void    *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *);
-void     rtems_monitor_driver_canonical(rtems_monitor_driver_t *, void *);
+const void *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *);
+void     rtems_monitor_driver_canonical(rtems_monitor_driver_t *, const void *);
 void     rtems_monitor_driver_dump_header(bool);
 void     rtems_monitor_driver_dump(rtems_monitor_driver_t *, bool);
 
@@ -489,7 +489,7 @@ rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, const char *, uint32
 rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, uint32_t);
 const rtems_symbol_t *rtems_symbol_value_lookup_exact(rtems_symbol_table_t *, uint32_t);
 rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, const char *);
-void   *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *);
+const void *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *);
 void    rtems_monitor_symbol_canonical(rtems_monitor_symbol_t *, rtems_symbol_t *);
 void    rtems_monitor_symbol_canonical_by_name(rtems_monitor_symbol_t *, const char *);
 void    rtems_monitor_symbol_canonical_by_value(rtems_monitor_symbol_t *, void *);
-- 
1.7.7




More information about the devel mailing list