Subversion Repositories HelenOS

Rev

Rev 2894 | Rev 3435 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2894 Rev 2946
Line 54... Line 54...
54
    ipcarg_t method;
54
    ipcarg_t method;
55
    oper_t *oper;
55
    oper_t *oper;
56
    link_t link;
56
    link_t link;
57
} method_oper_t;
57
} method_oper_t;
58
 
58
 
-
 
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 = {
-
 
65
    .hash = srv_proto_hash,
-
 
66
    .compare = srv_proto_compare,
-
 
67
    .remove_callback = srv_proto_remove_callback
-
 
68
};
-
 
69
 
-
 
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 = {
-
 
76
    .hash = method_oper_hash,
-
 
77
    .compare = method_oper_compare,
-
 
78
    .remove_callback = method_oper_remove_callback
-
 
79
};
-
 
80
 
59
hash_index_t srv_proto_hash(unsigned long key[])
81
static hash_index_t srv_proto_hash(unsigned long key[])
60
{
82
{
61
    return key[0] % SRV_PROTO_TABLE_CHAINS;
83
    return key[0] % SRV_PROTO_TABLE_CHAINS;
62
}
84
}
63
 
85
 
64
int srv_proto_compare(unsigned long key[], hash_count_t keys,
86
static int srv_proto_compare(unsigned long key[], hash_count_t keys,
65
    link_t *item)
87
    link_t *item)
66
{
88
{
67
    srv_proto_t *sp;
89
    srv_proto_t *sp;
68
 
90
 
69
    sp = hash_table_get_instance(item, srv_proto_t, link);
91
    sp = hash_table_get_instance(item, srv_proto_t, link);
70
 
92
 
71
    return key[0] == sp->srv;
93
    return key[0] == sp->srv;
72
}
94
}
73
 
95
 
74
void srv_proto_remove_callback(link_t *item)
96
static void srv_proto_remove_callback(link_t *item)
75
{
97
{
76
}
98
}
77
 
99
 
78
hash_table_operations_t srv_proto_ops = {
-
 
79
    .hash = srv_proto_hash,
-
 
80
    .compare = srv_proto_compare,
-
 
81
    .remove_callback = srv_proto_remove_callback
-
 
82
};
-
 
83
 
-
 
84
hash_index_t method_oper_hash(unsigned long key[])
100
static hash_index_t method_oper_hash(unsigned long key[])
85
{
101
{
86
    return key[0] % METHOD_OPER_TABLE_CHAINS;
102
    return key[0] % METHOD_OPER_TABLE_CHAINS;
87
}
103
}
88
 
104
 
89
int method_oper_compare(unsigned long key[], hash_count_t keys,
105
static int method_oper_compare(unsigned long key[], hash_count_t keys,
90
    link_t *item)
106
    link_t *item)
91
{
107
{
92
    method_oper_t *mo;
108
    method_oper_t *mo;
93
 
109
 
94
    mo = hash_table_get_instance(item, method_oper_t, link);
110
    mo = hash_table_get_instance(item, method_oper_t, link);
95
 
111
 
96
    return key[0] == mo->method;
112
    return key[0] == mo->method;
97
}
113
}
98
 
114
 
99
void method_oper_remove_callback(link_t *item)
115
static void method_oper_remove_callback(link_t *item)
100
{
116
{
101
}
117
}
102
 
118
 
103
hash_table_operations_t method_oper_ops = {
-
 
104
    .hash = method_oper_hash,
-
 
105
    .compare = method_oper_compare,
-
 
106
    .remove_callback = method_oper_remove_callback
-
 
107
};
-
 
108
 
-
 
109
 
119
 
110
void proto_init(void)
120
void proto_init(void)
111
{
121
{
112
    hash_table_create(&srv_proto, SRV_PROTO_TABLE_CHAINS, 1,
122
    hash_table_create(&srv_proto, SRV_PROTO_TABLE_CHAINS, 1,
113
        &srv_proto_ops);
123
        &srv_proto_ops);