Changeset b800b0e in mainline for uspace/app


Ignore:
Timestamp:
2012-10-23T13:16:49Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ecf5b8
Parents:
32b3a12 (diff), b2ac3998 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

Location:
uspace/app
Files:
19 added
12 edited
2 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/Makefile

    r32b3a12 rb800b0e  
    5353        cmds/modules/unmount/unmount.c \
    5454        cmds/modules/kcon/kcon.c \
     55        cmds/modules/cmp/cmp.c \
    5556        cmds/builtins/batch/batch.c \
    5657        cmds/builtins/exit/exit.c \
  • uspace/app/bdsh/cmds/modules/modules.h

    r32b3a12 rb800b0e  
    6363#include "printf/entry.h"
    6464#include "echo/entry.h"
     65#include "cmp/entry.h"
    6566
    6667/* Each .def function fills the module_t struct with the individual name, entry
     
    8687#include "printf/printf_def.h"
    8788#include "echo/echo_def.h"
     89#include "cmp/cmp_def.h"
    8890
    8991        {NULL, NULL, NULL, NULL}
  • uspace/app/bdsh/config.h

    r32b3a12 rb800b0e  
    5555#define PACKAGE_STRING "The brain dead shell"
    5656#define PACKAGE_TARNAME "bdsh"
    57 #define PACKAGE_VERSION "0.0.1"
    58 
    59 
    60 
     57#define PACKAGE_VERSION "0.1.0"
  • uspace/app/devctl/devctl.c

    r32b3a12 rb800b0e  
    151151        rc = devman_fun_offline(funh);
    152152        if (rc != EOK) {
    153                 printf(NAME ": Failed to offline function '%s'.\n", path);
     153                printf(NAME ": Failed to offline function '%s' (%s)\n", path,
     154                    str_error(rc));
    154155                return rc;
    155156        }
  • uspace/app/mkexfat/mkexfat.c

    r32b3a12 rb800b0e  
    4949#include <str.h>
    5050#include <getopt.h>
     51#include <macros.h>
    5152#include "exfat.h"
    5253#include "upcase.h"
     
    8788#define FIRST_FREE_CLUSTER   2
    8889
    89 #define min(x, y) ((x) < (y) ? (x) : (y))
    9090
    9191typedef struct exfat_cfg {
  • uspace/app/tester/Makefile

    r32b3a12 rb800b0e  
    2929
    3030USPACE_PREFIX = ../..
    31 LIBS = $(LIBEXT2_PREFIX)/libext2.a $(LIBBLOCK_PREFIX)/libblock.a
    32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBEXT2_PREFIX)
     31LIBS = $(LIBEXT2_PREFIX)/libext2.a $(LIBBLOCK_PREFIX)/libblock.a $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
     32EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBEXT2_PREFIX) -I$(LIBSOFTFLOAT_PREFIX)
    3333BINARY = tester
    3434
     
    4545        stdio/stdio1.c \
    4646        stdio/stdio2.c \
     47        stdio/logger1.c \
     48        stdio/logger2.c \
    4749        fault/fault1.c \
    4850        fault/fault2.c \
    4951        fault/fault3.c \
     52        float/float1.c \
     53        float/softfloat1.c \
    5054        vfs/vfs1.c \
    5155        ipc/ping_pong.c \
     
    5963        hw/misc/virtchar1.c \
    6064        hw/serial/serial1.c \
    61         libext2/libext2_1.c
     65        ext2/ext2_1.c
    6266
    6367include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/tester/ext2/ext2_1.c

    r32b3a12 rb800b0e  
    5151}
    5252
    53 const char *test_libext2_1(void)
     53const char *test_ext2_1(void)
    5454{
    5555        ext2_superblock_t *fake1;
    5656       
    57         TPRINTF("Testing libext2 superblock getters...\n");
     57        TPRINTF("Testing ext2 superblock getters...\n");
    5858        TPRINTF("Simple test for correct position and byte order\n");
    5959       
  • uspace/app/tester/ext2/ext2_1.def

    r32b3a12 rb800b0e  
    11{
    2         "libext2_1",
     2        "ext2_1",
    33        "Superblock getters test",
    4         &test_libext2_1,
     4        &test_ext2_1,
    55        true
    66},
  • uspace/app/tester/tester.c

    r32b3a12 rb800b0e  
    3939#include <stdio.h>
    4040#include <str.h>
     41#include <io/log.h>
    4142#include "tester.h"
    4243
     
    5556#include "stdio/stdio1.def"
    5657#include "stdio/stdio2.def"
     58#include "stdio/logger1.def"
     59#include "stdio/logger2.def"
    5760#include "fault/fault1.def"
    5861#include "fault/fault2.def"
    5962#include "fault/fault3.def"
     63#include "float/float1.def"
     64#include "float/softfloat1.def"
    6065#include "vfs/vfs1.def"
    6166#include "ipc/ping_pong.def"
     
    6873#include "hw/serial/serial1.def"
    6974#include "hw/misc/virtchar1.def"
    70 #include "libext2/libext2_1.def"
     75#include "ext2/ext2_1.def"
    7176        {NULL, NULL, NULL, false}
    7277};
     
    138143        }
    139144       
     145        log_init("tester");
     146
    140147        test_quiet = false;
    141148        test_argc = argc - 2;
  • uspace/app/tester/tester.h

    r32b3a12 rb800b0e  
    8888extern const char *test_stdio1(void);
    8989extern const char *test_stdio2(void);
     90extern const char *test_logger1(void);
     91extern const char *test_logger2(void);
    9092extern const char *test_fault1(void);
    9193extern const char *test_fault2(void);
    9294extern const char *test_fault3(void);
     95extern const char *test_float1(void);
     96extern const char *test_softfloat1(void);
    9397extern const char *test_vfs1(void);
    9498extern const char *test_ping_pong(void);
     
    101105extern const char *test_serial1(void);
    102106extern const char *test_virtchar1(void);
    103 extern const char *test_libext2_1(void);
     107extern const char *test_ext2_1(void);
    104108extern const char *test_devman1(void);
    105109extern const char *test_devman2(void);
  • uspace/app/trace/ipcp.c

    r32b3a12 rb800b0e  
    3838#include <sys/typefmt.h>
    3939#include <abi/ipc/methods.h>
     40#include <macros.h>
    4041#include "ipc_desc.h"
    4142#include "proto.h"
     
    5253        ipc_callid_t call_hash;
    5354
    54         link_t link;
     55        ht_link_t link;
    5556} pending_call_t;
    5657
     
    6465int have_conn[MAX_PHONE];
    6566
    66 #define PCALL_TABLE_CHAINS 32
    67 hash_table_t pending_calls;
     67static hash_table_t pending_calls;
    6868
    6969/*
     
    7373proto_t *proto_unknown;         /**< Protocol with no known methods. */
    7474
    75 static hash_index_t pending_call_hash(unsigned long key[]);
    76 static int pending_call_compare(unsigned long key[], hash_count_t keys,
    77     link_t *item);
    78 static void pending_call_remove_callback(link_t *item);
    79 
    80 hash_table_operations_t pending_call_ops = {
     75
     76static size_t pending_call_key_hash(void *key)
     77{
     78        ipc_callid_t *call_id = (ipc_callid_t *)key;
     79        return *call_id;
     80}
     81
     82static size_t pending_call_hash(const ht_link_t *item)
     83{
     84        pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link);
     85        return hs->call_hash;
     86}
     87
     88static bool pending_call_key_equal(void *key, const ht_link_t *item)
     89{
     90        ipc_callid_t *call_id = (ipc_callid_t *)key;
     91        pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link);
     92
     93        return *call_id == hs->call_hash;
     94}
     95
     96static hash_table_ops_t pending_call_ops = {
    8197        .hash = pending_call_hash,
    82         .compare = pending_call_compare,
    83         .remove_callback = pending_call_remove_callback
     98        .key_hash = pending_call_key_hash,
     99        .key_equal = pending_call_key_equal,
     100        .equal = NULL,
     101        .remove_callback = NULL
    84102};
    85 
    86 
    87 static hash_index_t pending_call_hash(unsigned long key[])
    88 {
    89 //      printf("pending_call_hash\n");
    90         return key[0] % PCALL_TABLE_CHAINS;
    91 }
    92 
    93 static int pending_call_compare(unsigned long key[], hash_count_t keys,
    94     link_t *item)
    95 {
    96         pending_call_t *hs;
    97 
    98 //      printf("pending_call_compare\n");
    99         hs = hash_table_get_instance(item, pending_call_t, link);
    100 
    101         // FIXME: this will fail if sizeof(long) < sizeof(void *).
    102         return key[0] == hs->call_hash;
    103 }
    104 
    105 static void pending_call_remove_callback(link_t *item)
    106 {
    107 //      printf("pending_call_remove_callback\n");
    108 }
    109103
    110104
     
    177171        }
    178172
    179         hash_table_create(&pending_calls, PCALL_TABLE_CHAINS, 1, &pending_call_ops);
     173        bool ok = hash_table_create(&pending_calls, 0, 0, &pending_call_ops);
     174        assert(ok);
    180175}
    181176
     
    190185        pending_call_t *pcall;
    191186        proto_t *proto;
    192         unsigned long key[1];
    193187        oper_t *oper;
    194188        sysarg_t *args;
     
    254248        pcall->oper = oper;
    255249
    256         key[0] = hash;
    257 
    258         hash_table_insert(&pending_calls, key, &pcall->link);
     250        hash_table_insert(&pending_calls, &pcall->link);
    259251}
    260252
     
    334326void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash)
    335327{
    336         link_t *item;
     328        ht_link_t *item;
    337329        pending_call_t *pcall;
    338         unsigned long key[1];
    339330       
    340331        if ((hash & IPC_CALLID_ANSWERED) == 0 && hash != IPCP_CALLID_SYNC) {
     
    347338       
    348339        hash = hash & ~IPC_CALLID_ANSWERED;
    349         key[0] = hash;
    350        
    351         item = hash_table_find(&pending_calls, key);
     340       
     341        item = hash_table_find(&pending_calls, &hash);
    352342        if (item == NULL)
    353343                return; /* No matching question found */
     
    357347         */
    358348       
    359         pcall = hash_table_get_instance(item, pending_call_t, link);
    360         hash_table_remove(&pending_calls, key, 1);
     349        pcall = hash_table_get_inst(item, pending_call_t, link);
     350        hash_table_remove(&pending_calls, &hash);
    361351       
    362352        parse_answer(hash, pcall, call);
  • uspace/app/trace/proto.c

    r32b3a12 rb800b0e  
    4040#include "proto.h"
    4141
    42 #define SRV_PROTO_TABLE_CHAINS 32
    43 #define METHOD_OPER_TABLE_CHAINS 32
    44 
    45 hash_table_t srv_proto;
     42
     43/* Maps service number to protocol */
     44static hash_table_t srv_proto;
    4645
    4746typedef struct {
    48         unsigned srv;
     47        int srv;
    4948        proto_t *proto;
    50         link_t link;
     49        ht_link_t link;
    5150} srv_proto_t;
    5251
    5352typedef struct {
    54         sysarg_t method;
     53        int method;
    5554        oper_t *oper;
    56         link_t link;
     55        ht_link_t link;
    5756} method_oper_t;
    5857
    59 static hash_index_t srv_proto_hash(unsigned long key[]);
    60 static int srv_proto_compare(unsigned long key[], hash_count_t keys,
    61     link_t *item);
    62 static void srv_proto_remove_callback(link_t *item);
    63 
    64 hash_table_operations_t srv_proto_ops = {
     58/* Hash table operations. */
     59
     60static size_t srv_proto_key_hash(void *key)
     61{
     62        return *(int *)key;
     63}
     64
     65static size_t srv_proto_hash(const ht_link_t *item)
     66{
     67        srv_proto_t *sp = hash_table_get_inst(item, srv_proto_t, link);
     68        return sp->srv;
     69}
     70
     71static bool srv_proto_key_equal(void *key, const ht_link_t *item)
     72{
     73        srv_proto_t *sp = hash_table_get_inst(item, srv_proto_t, link);
     74        return sp->srv == *(int *)key;
     75}
     76
     77static hash_table_ops_t srv_proto_ops = {
    6578        .hash = srv_proto_hash,
    66         .compare = srv_proto_compare,
    67         .remove_callback = srv_proto_remove_callback
     79        .key_hash = srv_proto_key_hash,
     80        .key_equal = srv_proto_key_equal,
     81        .equal = NULL,
     82        .remove_callback = NULL
    6883};
    6984
    70 static hash_index_t method_oper_hash(unsigned long key[]);
    71 static int method_oper_compare(unsigned long key[], hash_count_t keys,
    72     link_t *item);
    73 static void method_oper_remove_callback(link_t *item);
    74 
    75 hash_table_operations_t method_oper_ops = {
     85
     86static size_t method_oper_key_hash(void *key)
     87{
     88        return *(int *)key;
     89}
     90
     91static size_t method_oper_hash(const ht_link_t *item)
     92{
     93        method_oper_t *mo = hash_table_get_inst(item, method_oper_t, link);
     94        return mo->method;
     95}
     96
     97static bool method_oper_key_equal(void *key, const ht_link_t *item)
     98{
     99        method_oper_t *mo = hash_table_get_inst(item, method_oper_t, link);
     100        return mo->method == *(int *)key;
     101}
     102
     103static hash_table_ops_t method_oper_ops = {
    76104        .hash = method_oper_hash,
    77         .compare = method_oper_compare,
    78         .remove_callback = method_oper_remove_callback
     105        .key_hash = method_oper_key_hash,
     106        .key_equal = method_oper_key_equal,
     107        .equal = NULL,
     108        .remove_callback = NULL
    79109};
    80110
    81 static hash_index_t srv_proto_hash(unsigned long key[])
    82 {
    83         return key[0] % SRV_PROTO_TABLE_CHAINS;
    84 }
    85 
    86 static int srv_proto_compare(unsigned long key[], hash_count_t keys,
    87     link_t *item)
     111
     112void proto_init(void)
     113{
     114        /* todo: check return value. */
     115        bool ok = hash_table_create(&srv_proto, 0, 0, &srv_proto_ops);
     116        assert(ok);
     117}
     118
     119void proto_cleanup(void)
     120{
     121        hash_table_destroy(&srv_proto);
     122}
     123
     124void proto_register(int srv, proto_t *proto)
    88125{
    89126        srv_proto_t *sp;
    90 
    91         sp = hash_table_get_instance(item, srv_proto_t, link);
    92 
    93         return key[0] == sp->srv;
    94 }
    95 
    96 static void srv_proto_remove_callback(link_t *item)
    97 {
    98 }
    99 
    100 static hash_index_t method_oper_hash(unsigned long key[])
    101 {
    102         return key[0] % METHOD_OPER_TABLE_CHAINS;
    103 }
    104 
    105 static int method_oper_compare(unsigned long key[], hash_count_t keys,
    106     link_t *item)
    107 {
    108         method_oper_t *mo;
    109 
    110         mo = hash_table_get_instance(item, method_oper_t, link);
    111 
    112         return key[0] == mo->method;
    113 }
    114 
    115 static void method_oper_remove_callback(link_t *item)
    116 {
    117 }
    118 
    119 
    120 void proto_init(void)
    121 {
    122         hash_table_create(&srv_proto, SRV_PROTO_TABLE_CHAINS, 1,
    123             &srv_proto_ops);
    124 }
    125 
    126 void proto_cleanup(void)
    127 {
    128         hash_table_destroy(&srv_proto);
    129 }
    130 
    131 void proto_register(int srv, proto_t *proto)
    132 {
    133         srv_proto_t *sp;
    134         unsigned long key;
    135127
    136128        sp = malloc(sizeof(srv_proto_t));
    137129        sp->srv = srv;
    138130        sp->proto = proto;
    139         key = srv;
    140 
    141         hash_table_insert(&srv_proto, &key, &sp->link);
     131
     132        hash_table_insert(&srv_proto, &sp->link);
    142133}
    143134
    144135proto_t *proto_get_by_srv(int srv)
    145136{
    146         unsigned long key;
    147         link_t *item;
    148         srv_proto_t *sp;
    149 
    150         key = srv;
    151         item = hash_table_find(&srv_proto, &key);
     137        ht_link_t *item = hash_table_find(&srv_proto, &srv);
    152138        if (item == NULL) return NULL;
    153139
    154         sp = hash_table_get_instance(item, srv_proto_t, link);
     140        srv_proto_t *sp = hash_table_get_inst(item, srv_proto_t, link);
    155141        return sp->proto;
    156142}
     
    159145{
    160146        proto->name = name;
    161         hash_table_create(&proto->method_oper, SRV_PROTO_TABLE_CHAINS, 1,
    162             &method_oper_ops);
     147        /* todo: check return value. */
     148        bool ok = hash_table_create(&proto->method_oper, 0, 0, &method_oper_ops);
     149        assert(ok);
    163150}
    164151
     
    181168{
    182169        method_oper_t *mo;
    183         unsigned long key;
    184170
    185171        mo = malloc(sizeof(method_oper_t));
    186172        mo->method = method;
    187173        mo->oper = oper;
    188         key = method;
    189 
    190         hash_table_insert(&proto->method_oper, &key, &mo->link);       
     174
     175        hash_table_insert(&proto->method_oper, &mo->link);     
    191176}
    192177
    193178oper_t *proto_get_oper(proto_t *proto, int method)
    194179{
    195         unsigned long key;
    196         link_t *item;
    197         method_oper_t *mo;
    198 
    199         key = method;
    200         item = hash_table_find(&proto->method_oper, &key);
     180        ht_link_t *item = hash_table_find(&proto->method_oper, &method);
    201181        if (item == NULL) return NULL;
    202182
    203         mo = hash_table_get_instance(item, method_oper_t, link);
     183        method_oper_t *mo = hash_table_get_inst(item, method_oper_t, link);
    204184        return mo->oper;
    205185}
  • uspace/app/trace/proto.h

    r32b3a12 rb800b0e  
    6262} proto_t;
    6363
    64 /* Maps service number to protocol */
    65 extern hash_table_t srv_proto;
    6664
    6765extern void proto_init(void);
  • uspace/app/vuhid/main.c

    r32b3a12 rb800b0e  
    155155        int rc;
    156156
    157         usb_log_enable(USB_LOG_LEVEL_DEBUG2, "vusbhid");
     157        log_init("vuhid");
    158158
    159159        fibril_mutex_initialize(&vuhid_data.iface_count_mutex);
Note: See TracChangeset for help on using the changeset viewer.