Changeset a000878c in mainline for uspace/srv


Ignore:
Timestamp:
2010-02-25T19:11:25Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
958de16
Parents:
a634485
Message:

make sure that all statically allocated strings are declared as "const char *"
and are treated as read-only

Location:
uspace/srv
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/adb_mouse/adb_dev.c

    ra634485 ra000878c  
    5050int adb_dev_init(void)
    5151{
    52         char *input = "/dev/adb/mouse";
     52        const char *input = "/dev/adb/mouse";
    5353        int input_fd;
    5454
  • uspace/srv/hid/char_mouse/chardev.c

    ra634485 ra000878c  
    5252int mouse_port_init(void)
    5353{
    54         char *input = "/dev/char/ps2b";
     54        const char *input = "/dev/char/ps2b";
    5555        int input_fd;
    5656
  • uspace/srv/hid/fb/serial_console.c

    ra634485 ra000878c  
    100100};
    101101
    102 void serial_puts(char *str)
     102void serial_puts(const char *str)
    103103{
    104104        while (*str)
  • uspace/srv/hid/fb/serial_console.h

    ra634485 ra000878c  
    4343typedef void (*putc_function_t)(char);
    4444
    45 void serial_puts(char *str);
     45void serial_puts(const char *str);
    4646void serial_goto(const unsigned int col, const unsigned int row);
    4747void serial_clrscr(void);
  • uspace/srv/hid/kbd/port/adb.c

    ra634485 ra000878c  
    5353int kbd_port_init(void)
    5454{
    55         char *input = "/dev/adb/kbd";
     55        const char *input = "/dev/adb/kbd";
    5656        int input_fd;
    5757
  • uspace/srv/hid/kbd/port/chardev.c

    ra634485 ra000878c  
    5252int kbd_port_init(void)
    5353{
    54         char *input = "/dev/char/ps2a";
     54        const char *input = "/dev/char/ps2a";
    5555        int input_fd;
    5656
  • uspace/srv/loader/elf_load.c

    ra634485 ra000878c  
    6060#define DPRINTF(...)
    6161
    62 static char *error_codes[] = {
     62static const char *error_codes[] = {
    6363        "no error",
    6464        "invalid image",
     
    9595 * pointed to by @a info.
    9696 *
    97  * @param file_name     Path to the ELF file.
    98  * @param so_bias       Bias to use if the file is a shared object.
    99  * @param info          Pointer to a structure for storing information
    100  *                      extracted from the binary.
     97 * @param file_name Path to the ELF file.
     98 * @param so_bias   Bias to use if the file is a shared object.
     99 * @param info      Pointer to a structure for storing information
     100 *                  extracted from the binary.
    101101 *
    102102 * @return EOK on success or negative error code.
    103  */
    104 int elf_load_file(char *file_name, size_t so_bias, elf_info_t *info)
     103 *
     104 */
     105int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info)
    105106{
    106107        elf_ld_t elf;
     
    130131 * earlier with elf_load_file(). This function does not return.
    131132 *
    132  * @param info  Info structure filled earlier by elf_load_file()
     133 * @param info Info structure filled earlier by elf_load_file()
     134 *
    133135 */
    134136void elf_run(elf_info_t *info, pcb_t *pcb)
     
    280282 * @return NULL terminated description of error.
    281283 */
    282 char *elf_error(unsigned int rc)
     284const char *elf_error(unsigned int rc)
    283285{
    284286        assert(rc < sizeof(error_codes) / sizeof(char *));
  • uspace/srv/loader/include/elf.h

    ra634485 ra000878c  
    337337#endif
    338338
    339 extern char *elf_error(unsigned int rc);
     339extern const char *elf_error(unsigned int rc);
    340340
    341341#endif
  • uspace/srv/loader/include/elf_load.h

    ra634485 ra000878c  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    5151
    5252        /** ELF interpreter name or NULL if statically-linked */
    53         char *interp;
     53        const char *interp;
    5454
    5555        /** Pointer to the dynamic section */
     
    7474} elf_ld_t;
    7575
    76 int elf_load_file(char *file_name, size_t so_bias, elf_info_t *info);
     76int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info);
    7777void elf_run(elf_info_t *info, pcb_t *pcb);
    7878void elf_create_pcb(elf_info_t *info, pcb_t *pcb);
  • uspace/srv/net/il/ip/ip.c

    ra634485 ra000878c  
    479479        ERROR_DECLARE;
    480480
    481         measured_string_t       names[] = {{ "IPV", 3 }, { "IP_CONFIG", 9 }, { "IP_ADDR", 7 }, { "IP_NETMASK", 10 }, { "IP_GATEWAY", 10 }, { "IP_BROADCAST", 12 }, { "ARP", 3 }, { "IP_ROUTING", 10 }};
     481        measured_string_t       names[] = {{ str_dup("IPV"), 3 }, { str_dup("IP_CONFIG"), 9 }, { str_dup("IP_ADDR"), 7 }, { str_dup("IP_NETMASK"), 10 }, { str_dup("IP_GATEWAY"), 10 }, { str_dup("IP_BROADCAST"), 12 }, { str_dup("ARP"), 3 }, { str_dup("IP_ROUTING"), 10 }};
    482482        measured_string_ref     configuration;
    483483        size_t                          count = sizeof( names ) / sizeof( measured_string_t );
  • uspace/srv/net/net/net.c

    ra634485 ra000878c  
    154154 *  @returns Other error codes as defined for the add_configuration() function.
    155155 */
    156 int     read_netif_configuration( char * name, netif_ref netif );
     156int     read_netif_configuration( const char * name, netif_ref netif );
    157157
    158158/** Networking module global data.
     
    413413}
    414414
    415 int read_netif_configuration( char * name, netif_ref netif ){
     415int read_netif_configuration( const char * name, netif_ref netif ){
    416416        // read the netif configuration file
    417417        return read_configuration_file( CONF_DIR, name, & netif->configuration );
     
    485485
    486486#ifdef CONFIG_NETIF_DP8390
    487         char *          conf_files[] = { "lo", "ne2k" };
     487        const char *            conf_files[] = { "lo", "ne2k" };
    488488#else
    489         char *          conf_files[] = { "lo" };
     489        const char *            conf_files[] = { "lo" };
    490490#endif
    491491
  • uspace/srv/net/net/start/netstart.c

    ra634485 ra000878c  
    6969 *  @returns Other error codes as defined for the task_spawn() function.
    7070 */
    71 task_id_t       spawn( char * fname );
     71task_id_t       spawn( const char * fname );
    7272
    7373int main( int argc, char * argv[] ){
     
    9797}
    9898
    99 task_id_t spawn( char * fname ){
    100         char *  argv[ 2 ];
     99task_id_t spawn( const char * fname ){
     100        const char *    argv[ 2 ];
    101101        task_id_t       res;
    102102
  • uspace/srv/net/netif/lo/lo.c

    ra634485 ra000878c  
    102102int netif_get_addr_message( device_id_t device_id, measured_string_ref address ){
    103103        if( ! address ) return EBADMEM;
    104         address->value = DEFAULT_ADDR;
     104        address->value = str_dup(DEFAULT_ADDR);
    105105        address->length = DEFAULT_ADDR_LEN;
    106106        return EOK;
  • uspace/srv/net/nil/eth/eth.c

    ra634485 ra000878c  
    308308        eth_device_ref  device;
    309309        int                             index;
    310         measured_string_t       names[ 2 ] = {{ "ETH_MODE", 8 }, { "ETH_DUMMY", 9 }};
     310        measured_string_t       names[ 2 ] = {{ str_dup("ETH_MODE"), 8 }, { str_dup("ETH_DUMMY"), 9 }};
    311311        measured_string_ref     configuration;
    312312        size_t                          count = sizeof( names ) / sizeof( measured_string_t );
  • uspace/srv/net/structures/module_map.c

    ra634485 ra000878c  
    4949GENERIC_CHAR_MAP_IMPLEMENT( modules, module_t )
    5050
    51 int add_module( module_ref * module, modules_ref modules, char * name, char * filename, services_t service, task_id_t task_id, connect_module_t connect_module ){
     51int add_module( module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t connect_module ){
    5252        ERROR_DECLARE;
    5353
     
    8686}
    8787
    88 task_id_t spawn( char * fname ){
    89         char * argv[ 2 ];
     88task_id_t spawn( const char * fname ){
     89        const char * argv[ 2 ];
    9090        task_id_t       res;
    9191
  • uspace/srv/net/structures/module_map.h

    ra634485 ra000878c  
    7979        /** Module name.
    8080         */
    81         char *          name;
     81        const char *            name;
    8282        /** Module full path filename.
    8383         */
    84         char *          filename;
     84        const char *            filename;
    8585        /** Connecting function.
    8686         */
     
    9999 *  @returns ENOMEM if there is not enough memory left.
    100100 */
    101 int     add_module( module_ref * module, modules_ref modules, char * name, char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module );
     101int     add_module( module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module );
    102102
    103103/** Searches and returns the specified module.
     
    116116 *  @returns 0 if there is no such module.
    117117 */
    118 task_id_t       spawn( char * fname );
     118task_id_t       spawn( const char * fname );
    119119
    120120#endif
  • uspace/srv/net/tl/icmp/icmp.c

    ra634485 ra000878c  
    464464        ERROR_DECLARE;
    465465
    466         measured_string_t       names[] = {{ "ICMP_ERROR_REPORTING", 20 }, { "ICMP_ECHO_REPLYING", 18 }};
     466        measured_string_t       names[] = {{ str_dup("ICMP_ERROR_REPORTING"), 20 }, { str_dup("ICMP_ECHO_REPLYING"), 18 }};
    467467        measured_string_ref     configuration;
    468468        size_t                          count = sizeof( names ) / sizeof( measured_string_t );
  • uspace/srv/net/tl/udp/udp.c

    ra634485 ra000878c  
    192192        ERROR_DECLARE;
    193193
    194         measured_string_t       names[] = {{ "UDP_CHECKSUM_COMPUTING", 22 }, { "UDP_AUTOBINDING", 15 }};
     194        measured_string_t       names[] = {{ str_dup("UDP_CHECKSUM_COMPUTING"), 22 }, { str_dup("UDP_AUTOBINDING"), 15 }};
    195195        measured_string_ref     configuration;
    196196        size_t                          count = sizeof( names ) / sizeof( measured_string_t );
  • uspace/srv/taskmon/taskmon.c

    ra634485 ra000878c  
    4949static void fault_event(ipc_callid_t callid, ipc_call_t *call)
    5050{
    51         char *argv[6];
    52         char *fname;
     51        const char *argv[6];
     52        const char *fname;
    5353        char *dump_fname;
    5454        char *s_taskid;
    55         char **s;
     55        const char **s;
    5656
    5757        task_id_t taskid;
     
    8989
    9090        printf(NAME ": Executing");
    91         s = argv;
     91       
     92        s = argv;
    9293        while (*s != NULL) {
    9394                printf(" %s", *s);
Note: See TracChangeset for help on using the changeset viewer.